VistA-WorldVistAEHR/r/TEXT_INTEGRATION_UTILITIES-.../TIUFA1.m

58 lines
2.9 KiB
Mathematica
Raw Permalink Normal View History

2009-11-29 13:37:14 -05:00
TIUFA1 ; SLC/MAM - LM Template A (DDEFs by Attribute) Actions Add Entry, Change View ;7/1/97 20:55
;;1.0;TEXT INTEGRATION UTILITIES;**2,5**;Jun 20, 1997
;
ADD ; LM Template A action Create, LM Template J action Create
;Requires TIUFATTR, TIUFAVAL, TIUFSTRT. See HDR^TIUFA
N DIC,DLAYGO,X,Y,FILEDA,NODE0,OPTFLDS,NEWSTAT,MSG1,MSG,TIUI,DA
N DIK,TENDA,CNTCHNG,LINENO,FIELDS,DTOUT,DIRUT,DIROUT
N TIUFY,TIUFNOD,TIUFFULL,TIUFXNOD,TIUFTMSG,TIUFTLST,NAME
S TIUFXNOD=$G(XQORNOD(0))
S VALMBCK=""
SELECT S NAME=$$SELNAME^TIUFLF2() G:$D(DIRUT) ADDX
D TYPELIST^TIUFLF7(NAME,0,0,.TIUFTMSG,.TIUFTLST) G:$D(DTOUT) ADDX
I TIUFTMPL="J",TIUFTLST'["^O^" W !!,"Please enter a different Name; file already has Object with the same name.",! D PAUSE^TIUFXHLX G SELECT
I TIUFTMPL'="J",TIUFTLST="" W !!,"Please enter a different Name; file already has entry of every type with the",!,"same name.",! D PAUSE^TIUFXHLX G SELECT
S (DIC,DLAYGO)=8925.1,DIC(0)="L",X=""""_NAME_"""" D ^DIC
I Y=-1 W !,"?? " W:TIUFTMPL="J" "Object Name must be different from all other object Names, Abbreviations,",!,"and Print Names.",! W:TIUFTMPL'="J" "Couldn't Add Entry; See IRM",! D PAUSE^TIUFXHLX G ADDX
S FILEDA=+Y
L +^TIU(8925.1,FILEDA):1 I '$T S MSG=" Another user has accessed this entry; please finish editing later" G ADDX
D STUFFLDS^TIUFLF4(FILEDA)
S FIELDS=";.04;.05;.06;.07;"
I TIUFTMPL="J" S FIELDS=";.05;.06;"
I TIUFWHO="N" S FIELDS=FIELDS_".13;"
D ASKFLDS^TIUFLF1(FILEDA,FIELDS,0,.NEWSTAT)
N TIUFCK D CHECK^TIUFLF3(FILEDA,0,1,.TIUFCK) ;No parent
; Entry is new orphan; don't worry about descendants, orphan, multiple parents, etc.
K MSG
F TIUI="T","S","A","B" D G:$D(MSG) ADDX
. I $D(TIUFCK(TIUI)) S MSG1=TIUFCK(TIUI),MSG="Entry deleted: ",DA=FILEDA,DIK="^TIU(8925.1," D ^DIK
G:$D(DTOUT) ADDX
D OWNCHEC^TIUFLF8(FILEDA)
S NODE0=$G(^TIU(8925.1,FILEDA,0))
D AUPDATE^TIUFLA1(NODE0,FILEDA,.CNTCHNG,.LINENO) S:CNTCHNG VALMCNT=VALMCNT+1
I 'CNTCHNG S MSG=" Entry added; Not in current View"
I CNTCHNG S MSG=" Entry added" I LINENO<VALMBG!(LINENO>(VALMBG+VALM("LINES")-1)) S VALMBG=LINENO
S VALMBCK="R"
ADDX ;
I $D(MSG) W !!,MSG,! W:$D(MSG1) MSG1,! H 2 H:$D(MSG1) 2
L -^TIU(8925.1,+$G(FILEDA))
I $D(DTOUT) S VALMBCK="Q" Q
I $G(TIUFFULL) S VALMBCK="R" D RESET^TIUFXHLX
Q
;
CHANGE ; Template A action Change View
N TIUFTMPA,TIUFTMPV,TIUFTMPS,TIUFXNOD,TIUFFULL,DTOUT,DIRUT,DIROUT
S VALMBCK="R",TIUFXNOD=$G(XQORNOD(0))
S TIUFTMPA=TIUFATTR,TIUFTMPV=TIUFAVAL,TIUFTMPS=TIUFSTRT
K TIUFATTR,TIUFAVAL,TIUFSTRT
; Sets TIUFATTR,TIUFAVAL,TIUFSTRT if no ^:
I TIUFTMPL="A" S X=^TMP("TIUF",$J,"SORTCM")_";ORD(101," D EN^XQOR I '$D(TIUFSTRT) S TIUFATTR=TIUFTMPA,TIUFAVAL=TIUFTMPV,TIUFSTRT=TIUFTMPS,VALMBCK="" G CHANX
I TIUFTMPL="J" D SELSTART^TIUFLA S TIUFATTR=TIUFTMPA,TIUFAVAL=TIUFTMPV I '$D(TIUFSTRT) S TIUFSTRT=TIUFTMPS,VALMBCK="" G CHANX
D INIT^TIUFA
K VALMHDR S VALMBG=1
CHANX ;
I $D(DTOUT) S VALMBCK="Q" Q
I $G(TIUFFULL) S VALMBCK="R" D RESET^TIUFXHLX
Q
;