source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUFD3.m@ 1078

Last change on this file since 1078 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1TIUFD3 ; SLC/MAM - LM Template D Actions Edit Items, Edit Boilerplate Text ;4/17/97 11:02
2 ;;1.0;TEXT INTEGRATION UTILITIES;**17**;Jun 20, 1997
3 ;
4EDITEMS ; Templates H, C, A, D Action Edit Items. Calls LM Template TIUFT.
5 ; Requires TIUFTMPL.
6 ; Requires TIUFWHO, set in Options TIUF/A/C/H EDIT/SORT/CREATE DDEFS CLIN/MGR/NATL.
7 ; Sets TIUFACTT for Subtemplate T. Sets TIUFSTMP = T.
8 I $G(TIUFSTMP)="D" G EDITEMS1
9 N TIUFINFO,TIUFNOD0,TIUFVCN1,MISSITEM,TIUFXNOD,DTOUT,DIRUT,DIROUT
10 S VALMBCK="",TIUFVCN1=VALMCNT,TIUFXNOD=$G(XQORNOD(0))
11 I TIUFXNOD'["=" W !!," You may edit the Items of ONE Entry. Please select an Entry from the List.",!!
12 D EN^VALM2(TIUFXNOD,"SO") Q:'$O(VALMY(0)) S TIUFINFO=$G(^TMP("TIUF1IDX",$J,$O(VALMY(0)))) I 'TIUFINFO W !!," Missing List Manager Data; See IRM",! D PAUSE^TIUFXHLX S VALMBCK="Q" G EDITX
13 S FILEDA=$P(TIUFINFO,U,2),MISSITEM=$$MISSITEM^TIUFLF4(FILEDA) I MISSITEM W !!," Can't Edit Items: File Entry "_FILEDA_" Has Nonexistent Item "_MISSITEM_" ; See IRM.",! D PAUSE^TIUFXHLX S VALMBCK="Q" G EDITX
14 D PARSE^TIUFLLM(.TIUFINFO)
15 D NODE0ARR^TIUFLF(TIUFINFO("FILEDA"),.TIUFNOD0) G:$D(DTOUT) EDITX
16EDITEMS1 ; Entry point called by Edit Items of Template D.
17 ; Requires CURRENT array TIUFINFO, CURRENT variable TIUFVCN1
18 ;as set in EDVIEW^TIUFHA, updated (if Template A has changed)
19 ;in AUPDATE^TIUFLA1, or (if Template H has changed) in UPDATE^TIUFLLM1.
20 ;WARNING: +TIUFINFO may = 0 if Template A has changed!
21 ; Requires array TIUFNOD0; Updates TIUFNOD0 upon return from Template T.
22 ; If called from D, requires TIUFILIN as set in DSITEMS^TIUFD.
23 ; If called from D, requires TIUFSTMP="D"
24 N SUBTEMPL
25 S SUBTEMPL=$G(TIUFSTMP)
26 S VALMBCK=""
27 N FILEDA,TYPE,STATUS,MSG,SHARED,USROWNS
28 S FILEDA=TIUFINFO("FILEDA"),TYPE=$P(TIUFNOD0,U,4),SHARED=$P(TIUFNOD0,U,10)
29 S USROWNS=$$PERSOWNS^TIUFLF2(FILEDA,DUZ)
30 I TIUFWHO="C",'$$HASITEMS^TIUFLF1(FILEDA) D I $D(MSG) G EDITX
31 . I USROWNS Q:TYPE="DOC" Q:TYPE="CO"&'SHARED
32 . S MSG=" Entry has no Items",VALMBCK=""
33 I TYPE="O" S MSG=" Objects do not have Items",VALMBCK="" G EDITX
34 N TIUREC,TIUFVCN3,TIUFBG3,TIUFSTMP,TIUFACTT,TIUFIXED,EXPAND
35 S TIUFSTMP="T" ;Items
36 S TIUFACTT=$S("NM"[TIUFWHO:"A",TIUFWHO="C":"E",1:"V") ;Add, Edit, View
37 S STATUS=$$STATWORD^TIUFLF5($P(TIUFNOD0,U,7)) ; e.g. INACTIVE
38 D
39 . I TYPE="" S TIUFACTT="V",MSG=" Entry has no Type; View Only" Q
40 . I SHARED,TIUFTMPL'="A" S TIUFACTT="V",MSG=" Shared Components can be edited only through the SORT Option: View Only." Q
41 . I 'SHARED,TYPE="DOC"!(TYPE="CO"),STATUS'="INACTIVE" S TIUFACTT="V",MSG=" Can't edit Items of a Title/Component unless entry is Inactive; View Only." Q
42 . I SHARED,'$$CANEDIT^TIUFLF6(FILEDA) S TIUFACTT="V",MSG=" Shared Component with parent that isn't Inactive; View Only." Q
43 . I USROWNS="" S TIUFACTT="V",MSG=" Entry has no Owner; View Only" Q
44 . I USROWNS=0,TIUFWHO="C" S TIUFACTT="V",MSG=" Non-Owner; View Only" Q
45 . I USROWNS=0,TIUFWHO'="C",SHARED S TIUFACTT="V",MSG=" Only the Owner can edit a Shared Component; View Only"
46 K DIRUT I $D(MSG) W !!,MSG,! D PAUSE^TIUFXHLX K MSG I $D(DIRUT) Q
47 ; If came from Template H rather than A AND If Edited Items directly from H rather than thru Edit/View (D), AND If H entry was expanded, then collapse entry (reexpand to items only when return):
48 I TIUFTMPL="H",SUBTEMPL'="D" S EXPAND=TIUFINFO("XPDLCNT") I EXPAND D COLLAPSE^TIUFH1(.TIUFINFO) S VALMCNT=VALMCNT-EXPAND
49 S TIUFVCN3=VALMCNT,TIUFBG3=VALMBG,TIUFIXED=$G(VALM("FIXED"))
50 I TIUFACTT="A" D
51 . I "NM"[TIUFWHO D EN^VALM("TIUFT ITEMS ADD/EDIT/VIEW MGR")
52 D:TIUFACTT="E" EN^VALM("TIUFT ITEMS EDIT/VIEW CLIN")
53 D:TIUFACTT="V" EN^VALM("TIUFT ITEMS VIEW MGR/CLIN")
54 S VALMCNT=TIUFVCN3,VALMBG=TIUFBG3
55 D NODE0ARR^TIUFLF(FILEDA,.TIUFNOD0) G:$D(DTOUT) EDITX
56 ; If came from Template H rather than A AND If Edited Items directly from H rather than thru Edit/View (D), then update + for H and If H entry was expanded, reexpand to items only:
57 I TIUFTMPL="H",SUBTEMPL'="D" D
58 . ;Since Template is H, then need +. If 'Expand, just update +:
59 . I 'EXPAND S TIUREC=^TMP("TIUF1",$J,+TIUFINFO,0),TIUREC=$$PLUSUP^TIUFLLM(.TIUFINFO,TIUREC),^TMP("TIUF1",$J,+TIUFINFO,0)=TIUREC
60 . ;If Expand, that will automatically update + for template H:
61 . I EXPAND D EXPAND1^TIUFH1(.TIUFINFO) S VALMCNT=VALMCNT+$P(TIUFINFO,U,3)
62 ; Edit Items affects parentage: if came from Template A and sort by parentage, redo all of A:
63 I TIUFTMPL="A" D:$E(TIUFATTR)="P" INIT^TIUFA G:$D(DTOUT) EDITX
64 ; If not sort by parentage, don't update A here: Template A has been updated with each change to Template T.
65 I SUBTEMPL="D" D DSITEMS^TIUFD(.TIUFILIN) S VALMCNT=TIUFILIN ;Update Items to end on Template D.
66 S VALMBCK="R"
67EDITX ;
68 I $D(MSG) W !!,MSG,! H 2
69 I $D(DTOUT) S VALMBCK="Q"
70 Q
71 ;
72EDBOILTX ;Templates D, X Action Edit Boilerplate Text
73 ; Requires CURRENT arrays TIUFINFO, TIUFNOD0.
74 ; Requires TIUFBLIN as set in DSBOILTX^TIUFD.
75 N FILEDA,LINENO,CNTCHNG,TIUFXNOD,MSG,STATUS,DTOUT,DIRUT,DIROUT
76 S FILEDA=TIUFINFO("FILEDA")
77 S VALMBCK="R",TIUFXNOD=$G(XQORNOD(0))
78 S STATUS=$$STATWORD^TIUFLF5($P(^TIU(8925.1,FILEDA,0),U,7))
79 I STATUS'="INACTIVE" W !!,"Entry is not Inactive: Can't edit Boilerplate Text" D PAUSE^TIUFXHLX S VALMBCK="" G EDBOX
80 I $P(TIUFNOD0,U,10) D G:$D(MSG) EDBOX
81 . I '$$PERSOWNS^TIUFLF2(FILEDA,DUZ) S MSG=" Shared Component: Only Owner can Edit Boilerplate Text"
82 . I '$$CANEDIT^TIUFLF6(FILEDA) S MSG=" Shared Component with parent that isn't Inactive: Can't Edit Boilerplate Text"
83 . I $D(MSG) W !!,MSG D PAUSE^TIUFXHLX S VALMBCK=""
84 I TIUFSTMP="X" L +^TIU(8925.1,FILEDA):1 I '$T W !!," Another user is editing this entry.",! H 2 G EDBOX
85 D EDBOIL^TIUFLD1(FILEDA,TIUFNOD0) G:$D(DTOUT) EDBOX
86 D DEDBOIL^TIUFLD1(FILEDA) G:$D(DTOUT) EDBOX
87 D NODE0ARR^TIUFLF(FILEDA,.TIUFNOD0) G:$D(DTOUT) EDBOX
88 ; Update template D or X:
89 S LINENO=TIUFBLIN D DSBOILTX^TIUFD(.LINENO) G:$D(DTOUT) EDBOX S VALMCNT=LINENO
90 I TIUFTMPL="A" D AUPDATE^TIUFLA1(TIUFNOD0,FILEDA,.CNTCHNG) S:CNTCHNG TIUFVCN1=TIUFVCN1-1 ;doesn't match.
91 I "HC"[TIUFTMPL D LINEUP^TIUFLLM1(.TIUFINFO,TIUFTMPL)
92EDBOX ;
93 I TIUFSTMP="X" L -^TIU(8925.1,+$G(FILEDA))
94 I $D(DTOUT) S VALMBCK="Q"
95 Q
96 ;
Note: See TracBrowser for help on using the repository browser.