source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUFLF6.m@ 1080

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1TIUFLF6 ; SLC/MAM - Library; File 8925.1 Related: ASKSTAT(FILEDA,NODE0,PFILEDA,NEWFLAG,XFLG), AUTOSTAT(FILEDA,NODE0,STAT),DESCSTAT(FILEDA,NEWSTAT) ; 03/16/2007
2 ;;1.0;TEXT INTEGRATION UTILITIES;**13,211,225**;Jun 20, 1997;Build 13
3 ;
4ASKSTAT(FILEDA,NODE0,PFILEDA,NEWFLAG,XFLG) ; User edit FILEDA Status. Does AUTOSTAT.
5 ; Requires FILEDA,NODE0
6 ; Requires PFILEDA if FILEDA has an actual/prospective parent.
7 ; Returns NEWFLAG=0 if Status unchanged, = 1^ExternalNewStatus if changed, e.g. 1^ACTIVE
8 ; Returns XFLG=1 if user ^exited or timed out, else as received.
9 N XQORM,TIUJ,NEWSTAT,DIR,X,Y,TIUFSTAT,TIUFPFDA,CONTINUE
10 N STATUS,DEFLT
11 S NEWFLAG=0
12 S DEFLT=$$STATWORD^TIUFLF5($P(NODE0,U,7))
13READST K DUOUT S:(DEFLT'="NO/BAD") STATUS=$$SELSTAT^TIUFLF5(FILEDA,PFILEDA,DEFLT) S:(DEFLT="NO/BAD") STATUS=$$SELSTAT^TIUFLF5(FILEDA,PFILEDA)
14 I $D(DUOUT)!$D(DTOUT) G ASKSX
15 I STATUS="" W " ?? Enter appropriate Status or '^' to exit",! H 2 G READST
16 S NEWSTAT=STATUS I +NEWSTAT'=$P(NODE0,U,7) S NEWFLAG="1^"_$P(NEWSTAT,U,2)
17 S NEWSTAT=$P(NEWSTAT,U,2) ;e.g. ACTIVE
18 I NEWFLAG,NEWSTAT="INACTIVE" D INACTIVE^TIUFHA3($P(NODE0,U,4),FILEDA,NODE0)
19 I 'NEWFLAG!(NEWSTAT'="INACTIVE") D AUTOSTAT(FILEDA,NODE0,NEWSTAT)
20ASKSX S:$D(DUOUT)!$D(DTOUT) XFLG=1
21 Q
22 ;
23AUTOSTAT(FILEDA,NODE0,STAT) ; Auto edit FILEDA to Status STAT; Auto edit FILEDA descendants
24 N DIE,DR,X,Y,DA
25 S DA=FILEDA
26 I STAT="INACTIVE" D
27 . S DIE=8925.1,DR=".07///^S X=STAT" D ^DIE
28 . Q:$P(NODE0,U,4)="O"
29 . ;Inactivate descendants, all the way down
30 . D DESCSTAT(FILEDA,"INACTIVE")
31 I STAT="TEST" D
32 . S DIE=8925.1,DR=".07///^S X=STAT" D ^DIE
33 . D DESCSTAT(FILEDA,"TEST")
34 I STAT="ACTIVE" D
35 . N TIUOUT
36 . I ($P(NODE0,U,4)="DOC"),(+$G(^TIU(8925.1,DA,15))'>0) D Q:+$G(TIUOUT)
37 . . W !!,$C(7),"You MUST first map ",$P(NODE0,U),!
38 . . D DIRECT^TIUMAP2(DA)
39 . . I +$G(^TIU(8925.1,DA,15))'>0 W $C(7)," Status Unchanged...",! H 2
40 . . I S TIUOUT=1,VALMBCK="R"
41 . W " Entry Activated.",! H 1
42 . S DIE=8925.1,DR=".07///^S X=STAT" D ^DIE
43 . ; I DOC, activate all descendants.
44 . I $P(NODE0,U,4)="DOC" D DESCSTAT(FILEDA,STAT)
45 . ; I CL or DC, let user activate desc by using separate option
46 . ; I O, done.
47 Q
48 ;
49DESCSTAT(FILEDA,NEWSTAT) ; Edits Status of all descendants of FILEDA
50 ;except Shared Components.
51 ; Gives them Status NEWSTAT
52 ; Requires FILEDA. Requires NEWSTAT = ACTIVE, TEST, or INACTIVE
53 ; Called with NEWSTAT="ACTIVE" for Components ONLY.
54 N TIUI,IFILEDA,INODE0,DIE,X,Y,STATUS,DA
55 S TIUI=0,DIE=8925.1
56 F S TIUI=$O(^TIU(8925.1,FILEDA,10,TIUI)) Q:'TIUI D
57 . S IFILEDA=+^TIU(8925.1,FILEDA,10,TIUI,0)
58 . S INODE0=$G(^TIU(8925.1,IFILEDA,0))
59 . I INODE0="" W !!," File Entry "_FILEDA_" has Nonexistent item "_IFILEDA_"; See IRM",! H 5 Q
60 . I $P(INODE0,U,10) Q
61 . S DA=IFILEDA,DR=".07///^S X=NEWSTAT" D ^DIE
62 . D DESCSTAT(IFILEDA,NEWSTAT)
63DESCX Q
64 ;
65CANEDIT(FILEDA) ; Function returns 1 if Shared Component can be edited, else 0
66 ; Can be edited if all parent Titles are Inactive. Ignores parents which don't exist or have no Status.
67 N PFILEDA,PSTATUS,EDITANS,PNODE0,PTYPE
68 S EDITANS=1,PFILEDA=0
69 F S PFILEDA=$O(^TIU(8925.1,"AD",FILEDA,PFILEDA)) G:'PFILEDA CANEX D G:'EDITANS!$D(DTOUT) CANEX
70 . I '$D(^TIU(8925.1,PFILEDA,0)) W " File Entry "_PFILEDA_" from AD XREF is missing from the file: See IRM" D PAUSE^TIUFXHLX Q
71 . S PNODE0=^TIU(8925.1,PFILEDA,0),PTYPE=$P(PNODE0,U,4)
72 . I PTYPE="DOC" S PSTATUS=$P(PNODE0,U,7),PSTATUS=$$STATWORD^TIUFLF5(PSTATUS) I PSTATUS="NO/BAD" W " File Entry "_PFILEDA_" has No Status/Bad Status" D PAUSE^TIUFXHLX Q
73 . I PTYPE="DOC" S:(PSTATUS="ACTIVE"!(PSTATUS="TEST")) EDITANS=0 Q
74 . I PTYPE="CO" S EDITANS=$$CANEDIT(PFILEDA)
75CANEX S:$D(DTOUT) EDITANS=0
76 Q EDITANS
77 ;
Note: See TracBrowser for help on using the repository browser.