TIUFHA4 ; SLC/MAM - LM Templates H and A action Edit Name/Owner/PrintName ;4/17/97 11:02
;;1.0;TEXT INTEGRATION UTILITIES;**13**;Jun 20, 1997
EDATTR ; Actions Edit Name/Owner/PrintName.
N FIELDS,ATTR,OLDLNO,TIUFDA,NEWLNO,TIUFXNOD,TIUFFULL,EDIT
N DTOUT,DIRUT,DIROUT
S VALMBCK="",TIUFXNOD=$G(XQORNOD(0))
S EDIT=$S(TIUFXNOD["Print":"PRINT NAME",TIUFXNOD["Owner":"OWNER",1:"NAME")
W !!,"Selecting entries for "_EDIT_" Edit"
D EN^VALM2(XQORNOD,"O") I '$O(VALMY(0)) G EDATX
S OLDLNO=0 F S OLDLNO=$O(VALMY(OLDLNO)) Q:'OLDLNO S TIUFDA(OLDLNO)=$P(^TMP("TIUF1IDX",$J,OLDLNO),U,2)
I TIUFTMPL="A"!(TIUFTMPL="J") D ;if Temp=A,J delete selected entries:
. S OLDLNO=0 F S OLDLNO=$O(VALMY(OLDLNO)) Q:'OLDLNO D
. . S NEWLNO=$O(^TMP("TIUF1IDX",$J,"DAF",TIUFDA(OLDLNO),0)) D UPDATE^TIUFLLM1("A",-1,NEWLNO-1) S VALMCNT=VALMCNT-1
S FIELDS=$S(EDIT="NAME":";.01;",EDIT="OWNER":";.05;.06;",1:";.03;")
D BASIC(EDIT)
EDATX I $D(DTOUT) S VALMBCK="Q" Q
I $G(TIUFFULL) S VALMBCK="R" D RESET^TIUFXHLX
Q
;
BASIC(EDIT) ; Edit one basic field.
N LINENO,FILEDA,NODE0,CNTCHNG,NOMATCH,STATUS,EXITFLG,MSG
N SHARED,NATL,TYPE,PFILEDA,PLINENO,BYPASS
S LINENO=0 K DUOUT
F S LINENO=$O(VALMY(LINENO)) Q:'LINENO!$D(DTOUT)!$D(DUOUT) D
. S FILEDA=TIUFDA(LINENO),NODE0=^TIU(8925.1,FILEDA,0),NATL=+$P(NODE0,U,13),TYPE=$P(NODE0,U,4),STATUS=$$STATWORD^TIUFLF5($P(NODE0,U,7)),SHARED=$P(NODE0,U,10)
. S NOMATCH=0,MSG=" Editing Entry "_LINENO W !!,MSG
. I TIUFWHO'="N",NATL,EDIT'="OWNER" S MSG=" Entry "_LINENO_" is National; Can't Edit" W !!,MSG,! D PAUSE^TIUFXHLX G AUPDATE
. ; W Msg, G AUPDATE if editing field other than Owner and active and not Shared component or Object, and not Natl User.
. ; G AUPDATE if editing field other than Owner and active and Natl user and user chooses NO.
. I SHARED,TIUFTMPL'="A" W !,"Shared Components can be edited only through the SORT Option",! D PAUSE^TIUFXHLX G AUPDATE
. I EDIT'="OWNER",SHARED,'$$PERSOWNS^TIUFLF2(FILEDA,DUZ) W !,"Only the Owner can edit Shared Components",! D PAUSE^TIUFXHLX G AUPDATE
. I EDIT'="OWNER",TYPE="O" W !,"To Edit Name or Print Name of an Object, please select Detailed Display and then",!,"select Basics.",! D PAUSE^TIUFXHLX G AUPDATE
. I EDIT'="OWNER",SHARED,'$$CANEDIT^TIUFLF6(FILEDA) W !,"Shared Component has parent that isn't Inactive: Can't Edit",! D PAUSE^TIUFXHLX G AUPDATE
. I 'SHARED,STATUS="NO/BAD",TYPE'="O" W !!," Entry has No Status/Bad Status; Can't Edit",! D PAUSE^TIUFXHLX G AUPDATE
. I 'SHARED,EDIT'="OWNER",STATUS'="INACTIVE" K DIRUT D Q:$D(DTOUT) G:TIUFWHO'="N" AUPDATE G:$D(DIRUT)!(BYPASS'=1) AUPDATE
. . I TIUFWHO'="N" W !!," Entry "_LINENO_" is not Inactive; Can't Edit",! D PAUSE^TIUFXHLX Q
. . N DIR,X,Y D ; Let Natl Developer choose to bypass safety:
. . . S DIR(0)="Y",(DIR("A",1),DIR("A",2),DIR("A",3))=" "
. . . S DIR("A",4)=" Entry "_LINENO_" is Active. Do you want to bypass safety measures and edit"
. . . S DIR("A",5)="even though this may cause errors if e.g. a document is being entered"
. . . S DIR("A")="on this entry.",DIR("B")="NO" D ^DIR S BYPASS=Y K DIR,X,Y
. L +^TIU(8925.1,FILEDA):1 I '$T W !!,"Another user is editing this entry; please try later.",! H 2 G LOOPX
. S EXITFLG=0 D ASKFLDS^TIUFLF1(FILEDA,FIELDS,0,0,.EXITFLG) G:$D(DTOUT) LOOPX
. G:EXITFLG AUPDATE
. S NODE0=^TIU(8925.1,FILEDA,0),VALMBCK="R"
. I TIUFTMPL="H" N INFO S INFO=^TMP("TIUF1IDX",$J,LINENO) D LINEUP^TIUFLLM1(.INFO,"H") G LOOPX
AUPDATE . I TIUFTMPL="A"!(TIUFTMPL="J") D
. . S NODE0=^TIU(8925.1,FILEDA,0)
. . D AUPDATE^TIUFLA1(NODE0,FILEDA,.CNTCHNG) S:CNTCHNG=1 VALMCNT=VALMCNT+1 I 'CNTCHNG S NOMATCH=1
. . I NOMATCH S MSG=" Edited Entry Not in current View" W !!,MSG,! K MSG D PAUSE^TIUFXHLX
LOOPX . L -^TIU(8925.1,FILEDA)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUFHA4 3776 printed Dec 13, 2024@02:40:47 Page 2
TIUFHA4 ; SLC/MAM - LM Templates H and A action Edit Name/Owner/PrintName ;4/17/97 11:02
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**13**;Jun 20, 1997
EDATTR ; Actions Edit Name/Owner/PrintName.
+1 NEW FIELDS,ATTR,OLDLNO,TIUFDA,NEWLNO,TIUFXNOD,TIUFFULL,EDIT
+2 NEW DTOUT,DIRUT,DIROUT
+3 SET VALMBCK=""
SET TIUFXNOD=$GET(XQORNOD(0))
+4 SET EDIT=$SELECT(TIUFXNOD["Print":"PRINT NAME",TIUFXNOD["Owner":"OWNER",1:"NAME")
+5 WRITE !!,"Selecting entries for "_EDIT_" Edit"
+6 DO EN^VALM2(XQORNOD,"O")
IF '$ORDER(VALMY(0))
GOTO EDATX
+7 SET OLDLNO=0
FOR
SET OLDLNO=$ORDER(VALMY(OLDLNO))
if 'OLDLNO
QUIT
SET TIUFDA(OLDLNO)=$PIECE(^TMP("TIUF1IDX",$JOB,OLDLNO),U,2)
+8 ;if Temp=A,J delete selected entries:
IF TIUFTMPL="A"!(TIUFTMPL="J")
Begin DoDot:1
+9 SET OLDLNO=0
FOR
SET OLDLNO=$ORDER(VALMY(OLDLNO))
if 'OLDLNO
QUIT
Begin DoDot:2
+10 SET NEWLNO=$ORDER(^TMP("TIUF1IDX",$JOB,"DAF",TIUFDA(OLDLNO),0))
DO UPDATE^TIUFLLM1("A",-1,NEWLNO-1)
SET VALMCNT=VALMCNT-1
End DoDot:2
End DoDot:1
+11 SET FIELDS=$SELECT(EDIT="NAME":";.01;",EDIT="OWNER":";.05;.06;",1:";.03;")
+12 DO BASIC(EDIT)
EDATX IF $DATA(DTOUT)
SET VALMBCK="Q"
QUIT
+1 IF $GET(TIUFFULL)
SET VALMBCK="R"
DO RESET^TIUFXHLX
+2 QUIT
+3 ;
BASIC(EDIT) ; Edit one basic field.
+1 NEW LINENO,FILEDA,NODE0,CNTCHNG,NOMATCH,STATUS,EXITFLG,MSG
+2 NEW SHARED,NATL,TYPE,PFILEDA,PLINENO,BYPASS
+3 SET LINENO=0
KILL DUOUT
+4 FOR
SET LINENO=$ORDER(VALMY(LINENO))
if 'LINENO!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
Begin DoDot:1
+5 SET FILEDA=TIUFDA(LINENO)
SET NODE0=^TIU(8925.1,FILEDA,0)
SET NATL=+$PIECE(NODE0,U,13)
SET TYPE=$PIECE(NODE0,U,4)
SET STATUS=$$STATWORD^TIUFLF5($PIECE(NODE0,U,7))
SET SHARED=$PIECE(NODE0,U,10)
+6 SET NOMATCH=0
SET MSG=" Editing Entry "_LINENO
WRITE !!,MSG
+7 IF TIUFWHO'="N"
IF NATL
IF EDIT'="OWNER"
SET MSG=" Entry "_LINENO_" is National; Can't Edit"
WRITE !!,MSG,!
DO PAUSE^TIUFXHLX
GOTO AUPDATE
+8 ; W Msg, G AUPDATE if editing field other than Owner and active and not Shared component or Object, and not Natl User.
+9 ; G AUPDATE if editing field other than Owner and active and Natl user and user chooses NO.
+10 IF SHARED
IF TIUFTMPL'="A"
WRITE !,"Shared Components can be edited only through the SORT Option",!
DO PAUSE^TIUFXHLX
GOTO AUPDATE
+11 IF EDIT'="OWNER"
IF SHARED
IF '$$PERSOWNS^TIUFLF2(FILEDA,DUZ)
WRITE !,"Only the Owner can edit Shared Components",!
DO PAUSE^TIUFXHLX
GOTO AUPDATE
+12 IF EDIT'="OWNER"
IF TYPE="O"
WRITE !,"To Edit Name or Print Name of an Object, please select Detailed Display and then",!,"select Basics.",!
DO PAUSE^TIUFXHLX
GOTO AUPDATE
+13 IF EDIT'="OWNER"
IF SHARED
IF '$$CANEDIT^TIUFLF6(FILEDA)
WRITE !,"Shared Component has parent that isn't Inactive: Can't Edit",!
DO PAUSE^TIUFXHLX
GOTO AUPDATE
+14 IF 'SHARED
IF STATUS="NO/BAD"
IF TYPE'="O"
WRITE !!," Entry has No Status/Bad Status; Can't Edit",!
DO PAUSE^TIUFXHLX
GOTO AUPDATE
+15 IF 'SHARED
IF EDIT'="OWNER"
IF STATUS'="INACTIVE"
KILL DIRUT
Begin DoDot:2
+16 IF TIUFWHO'="N"
WRITE !!," Entry "_LINENO_" is not Inactive; Can't Edit",!
DO PAUSE^TIUFXHLX
QUIT
+17 ; Let Natl Developer choose to bypass safety:
NEW DIR,X,Y
Begin DoDot:3
+18 SET DIR(0)="Y"
SET (DIR("A",1),DIR("A",2),DIR("A",3))=" "
+19 SET DIR("A",4)=" Entry "_LINENO_" is Active. Do you want to bypass safety measures and edit"
+20 SET DIR("A",5)="even though this may cause errors if e.g. a document is being entered"
+21 SET DIR("A")="on this entry."
SET DIR("B")="NO"
DO ^DIR
SET BYPASS=Y
KILL DIR,X,Y
End DoDot:3
End DoDot:2
if $DATA(DTOUT)
QUIT
if TIUFWHO'="N"
GOTO AUPDATE
if $DATA(DIRUT)!(BYPASS'=1)
GOTO AUPDATE
+22 LOCK +^TIU(8925.1,FILEDA):1
IF '$TEST
WRITE !!,"Another user is editing this entry; please try later.",!
HANG 2
GOTO LOOPX
+23 SET EXITFLG=0
DO ASKFLDS^TIUFLF1(FILEDA,FIELDS,0,0,.EXITFLG)
if $DATA(DTOUT)
GOTO LOOPX
+24 if EXITFLG
GOTO AUPDATE
+25 SET NODE0=^TIU(8925.1,FILEDA,0)
SET VALMBCK="R"
+26 IF TIUFTMPL="H"
NEW INFO
SET INFO=^TMP("TIUF1IDX",$JOB,LINENO)
DO LINEUP^TIUFLLM1(.INFO,"H")
GOTO LOOPX
AUPDATE IF TIUFTMPL="A"!(TIUFTMPL="J")
Begin DoDot:2
+1 SET NODE0=^TIU(8925.1,FILEDA,0)
+2 DO AUPDATE^TIUFLA1(NODE0,FILEDA,.CNTCHNG)
if CNTCHNG=1
SET VALMCNT=VALMCNT+1
IF 'CNTCHNG
SET NOMATCH=1
+3 IF NOMATCH
SET MSG=" Edited Entry Not in current View"
WRITE !!,MSG,!
KILL MSG
DO PAUSE^TIUFXHLX
End DoDot:2
LOOPX LOCK -^TIU(8925.1,FILEDA)
End DoDot:1
+1 QUIT
+2 ;