source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUSERBLK.m@ 1704

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

initial load of FOIAVistA 6/30/08 version

File size: 6.4 KB
Line 
1XUSERBLK ;SF/RWF - Bulk user (new person) COMPUTER ACCESS ;02/26/2008
2 ;;8.0;KERNEL;**20,214,230,289,419,490**;Jul 10, 1995;Build 5
3 ; Per VHA Directive 2004-038, this routine should not be modified.
4 ; Option: XUSERBLK
5 ; This routine allows the Cloning of one person to a group of others.
6A ;
7 I $G(DUZ)'>0 W !!,"You are not a known user and can't use this option." Q
8 N DIC,X,Y,XUTMP,DA,DIR,XUTERMDT,XUSER,XUY,%ZIS,XUIOP,XMQUIET
9 K ^TMP($J)
10B1 W @IOF,!?26,"Batch Entry of New Persons"
11 W !?26,"--------------------------",!!,"Please select a person to copy from"
12 K DIC S DIC(0)="AEQZ",DIC("A")="Template PERSON: ",DIC="^VA(200," D ^DIC
13 Q:$D(DTOUT)!$D(DUOUT)
14 G B1:Y=-1
15 ; Show INFO to be copied"
16 S XUTMP=+Y,XUTMP(0)=$P(Y,U,2),DA=+Y D EN^DIQ
17 S DIR(0)="Y",DIR("A")="Is this the person whose data you want cloned" D ^DIR Q:$D(DIRUT) G B1:'Y
18 W !!,"You may enter a date, when the users that are being created/updated",!,"will no longer have access to the system."
19 S DIR(0)="DAO^DT::AEF"
20 S DIR("A")="Enter (optional) TERMINATION DATE: "
21 D ^DIR Q:$D(DTOUT)!$D(DUOUT)
22 S XUTERMDT=Y
23 K XUSER S XUSER=0
24B2 ;
25 W !!,?26,"Batch Entry of New Persons",!,?26,"--------------------------",!
26 W !,"Clone of: ",XUTMP(0) I XUTERMDT W ?49,"TERMINATION DATE: ",$$FMTE^XLFDT(XUTERMDT)
27 ;;
28B3 F S XUY=$$ADD^XUSERNEW Q:XUY<0 D ;Create new entry
29 . I '$P(XUY,U,3) D
30 . . S DIR(0)="Y",DIR("A")=$P(XUY,U,2)_" is an existing user. Do you want to include" D ^DIR I Y'=1 S XUY=-1 Q
31 . . S DIR(0)="Y",DIR("A")="Clear out KEYS, FILES, SECONDARY MENUS first" D ^DIR
32 . . S:Y=1 $P(XUY,U,4)=1
33 . . Q
34 . I XUY>0 D
35 . . S DIR(0)="Y",DIR("A")="Do You Want To Clone PERSON CLASS" D ^DIR
36 . . S:Y=1 $P(XUY,U,5)=1
37 . S:XUY>0 XUSER=XUSER+1,XUSER(XUSER)=XUY W !!,"Next!"
38 . Q
39B4 ;
40 Q:XUSER'>0
41 I XUTERMDT D
42 . N XUZT
43 . S XUZT("ZTDTH")=XUTERMDT
44 . W !!,"Queueing automatic deactivation for ",$$FMTE^XLFDT(XUTERMDT)
45 . S X=$$NODEV^XUTMDEVQ("CHECK^XUSTERM1",,,.XUZT,1)
46 W !!,"Where do you want to print the COMPUTER ACCOUNT NOTIFICATION LETTERS?"
47 S XMQUIET=1
48 S %ZIS="NMQ" D ^%ZIS Q:POP ; "N" means don't open device
49 K XMQUIET
50 S XUIOP=ION_";"_IOST_";"_IOM_";"_IOSL
51 D HOME^%ZIS
52 ;I ION["P-MESSAGE-HFS" G START
53 I '$D(IO("Q")) G CLONE
54START ;
55 N XUZT
56 S XUZT("ZTDTH")=$H
57 S X=$$NODEV^XUTMDEVQ("CLONE^XUSERBLK",,"XUIOP;XUTMP;XUTERMDT;XUSER;XUSER(",.XUZT,1)
58 Q
59 ;;
60CLONE ;;Do work
61 N XUTEXT,XU1,%,DA,XUNEW,XUPURGE
62 S XUTEXT=$O(^DIC(9.2,"B",$$GET^XUPARAM("XUSER COMPUTER ACCOUNT","N"),0))
63 F XU1=1:1:XUSER S %=XUSER(XU1),DA=+%,XUNEW=$P(%,U,3),XUPURGE=$P(%,U,4) D C2,UPDATE("ORD",DA)
64 K ^TMP($J)
65 Q
66C2 ;
67 N XUU,XUU2,XFDA,XUH,XUH2,XIEN,XERR,Y,XMZ,XMM,XMDT
68 I '$D(ZTQUEUED) W !!?8,$S(XUNEW:"CREATING A NEW ACCOUNT FOR '"_$P(XUSER(XU1),U,2)_"'",1:"CONVERTING "_$P(XUSER(XU1),U,2)_"'S ACCOUNT OVER"),!!,"One moment please..."
69 D BLDFDA
70 I $P(^VA(200,DA,0),U,3)']"" S XUNEW=1 ;if no access code treat as new
71 I $P($G(^VA(200,DA,.1)),U,2)']"" S XUNEW=1 ;If no verify code treat as new
72 S (XUU,XUU2)="unchanged",$P(^VA(200,DA,0),U,11)=XUTERMDT
73 I XUNEW D ACODE S @XFDA@(200,DA_",",2)=XUH D VCODE S @XFDA@(200,DA_",",11)=XUH2
74 D UPDATE^DIE("",XFDA,XIEN,"XERR") K @XFDA
75 I XUNEW,XUTEXT>0 D LET(DA,XUTEXT)
76 I $D(^XMB(3.7,DA,0))[0 S Y=DA K XMZ D NEW^XM K XMDT,XMM,XMZ
77 Q
78 ;
79BLDFDA ;Build the FDA
80 N X2,X3,X4,X5,X6,X7,XUNODE,XU
81 S XFDA="^TMP($J,""XFDA"")",XIEN="^TMP($J,""XIEN"")" K ^TMP($J)
82 ;Move piece on nodes from list, Build XU only once
83 F X2=1:1 S XUNODE=$P($T(DATA+X2),";;",2) Q:XUNODE="" D
84 . F X3=1:1 S X7=$P(XUNODE,U,X3) Q:X7="" S X4=$$GETDD(200,X7),X5=$P(X4,";"),X6=$P(X4,";",2) D
85 . . I '$D(XU(2,X5)) S XU(2,X5)=$G(^VA(200,XUTMP,X5))
86 . . S:$P(XU(2,X5),U,X6)]"" @XFDA@(200,DA_",",X7)=$P(XU(2,X5),U,X6)
87 . . Q
88 . Q
89 D SUBFILE
90 Q
91 ;
92GETDD(FI,FE) ;Return node;piece for a field
93 Q $P($G(^DD(FI,FE,0)),U,4)
94 ;
95DATA ;;field#
96 ;;3^8^15^29^28
97 ;;200.04^200.05^200.06^200.09^200.1^201^
98 ;;41^41.1^41.2
99 ;;101.01^101.02
100 ;;9.21^9.22
101 ;;
102 ;
103ACODE ;
104 N Z
105 F Z=0:0 S XUU=$$AC^XUS4(),XUH=$$EN^XUSHSH(XUU) Q:'($D(^VA(200,"AOLD",XUH))!$D(^VA(200,"A",XUH)))
106 Q
107 ;
108VCODE ;
109 S XUU2=$$VC^XUS4(),XUH2=$$EN^XUSHSH(XUU2)
110 Q
111 ;
112SUBFILE ;Move subfiles: Subscript, Subfile#, DINUM, Fields
113 N XCNT S XCNT=0
114KEY D MULTI(51,200.051,1,".01,3")
115PATH ;D MULTI(19.8,".01")
116FOF D MULTI("FOF",200.032,1,".01,1,2,3,4,5,6")
117DIV D MULTI(2,200.02,1,".01")
118SEC D MULTI(203,200.03,0,".01,2")
119TAB D MULTI("ORD",200.010113,0,".01,.02,.03")
120PSCLSS I $P($G(XUSER(XU1)),U,5)=1 D PRSNCL(DA)
121 Q
122 ;
123MULTI(XSS,XSF,XDN,XDD) ;Build new data
124 I XUPURGE D CLEAR(DA,XSS)
125 Q:'$D(^VA(200,XUTMP,XSS,0))
126 ;S X=^(0),Y=$S($D(^VA(200,DA,X2,0)):^(0),1:"")
127 F X1=0:0 S X1=$O(^VA(200,XUTMP,XSS,X1)) Q:X1'>0 S X=^(X1,0) D
128 . F X2=1:1 S X3=$P(XDD,",",X2) Q:X3="" D
129 . . I X3'=.01 S @XFDA@(XSF,"?+"_XCNT_","_DA_",",X3)=$$VAL(X,X3,XSF) Q
130 . . S XCNT=XCNT+1,@XFDA@(XSF,"?+"_XCNT_","_DA_",",.01)=$P(X,U,1)
131 . . S:XDN @XIEN@(XCNT)=X1
132 . . Q
133 . Q
134 Q
135 ;
136VAL(V,FE,FI) ;Get value
137 N % S %=$$GETDD(FI,FE),%=$P(%,";",2) Q $P(V,"^",%)
138 ;
139LET(DA,XUTEXT) ;Write access letter
140 N DIWF,FR,TO,BY,IOP
141 S DIWF="^DIC(9.2,"_XUTEXT_",1,",DIWF(1)=200,FR=DA,TO=DA,BY="NUMBER",IOP=XUIOP D EN2^DIWF
142 Q
143 ;
144CLEAR(X4,X2) ;Clear subfile first, IEN, Subscript
145 Q:$D(^VA(200,X4,X2,0))[0 N C,XUFN,XDEL,XMSG
146 S C=",",XDEL=$NA(^TMP($J,"XUBLK2")),XUFN=+$P(^VA(200,X4,X2,0),"^",2)
147 F X1=0:0 S X1=$O(^VA(200,X4,X2,X1)) Q:X1'>0 D
148 . I X2=51 S %=$$DEL^XQKEY(X4,X1) Q ;Special case for KEYS
149 . S @XDEL@(XUFN,X1_C_X4_C,.01)="@"
150 . Q
151 I $D(@XDEL)>1 D FILE^DIE("",XDEL,"XMSG") ;I $D(XMSG) ZW XMSG
152 Q
153 ;
154UPDATE(XX,USRIEN) ;Update effective date
155 N PC,PC1
156 S PC=$O(^VA(200,USRIEN,XX,"A"),-1) Q:PC'>0
157 S PC=0 F S PC=$O(^VA(200,USRIEN,XX,PC)) Q:PC'>0 D
158 .S PC1=$P($G(^VA(200,USRIEN,XX,PC,0)),"^",3)
159 .I (PC1="")!(PC1'<DT) D DOPD
160 Q
161 ;
162DOPD ;
163 L +^VA(200,DA,XX,PC,0):20 I '$T D Q
164 .W !,"===> The user is locked. Please try this option again."
165 S $P(^VA(200,USRIEN,XX,PC,0),"^",2)=DT
166 L -^VA(200,USRIEN,XX,PC,0)
167 Q
168 ;
169PRSNCL(USERIEN) ;
170 N XUDATA,XUPSC,XUEFDA,XUEXDA,ZZ
171 S XUDATA=$O(^VA(200,XUTMP,"USC1","A"),-1) Q:XUDATA'>0
172 S XUDATA=$G(^VA(200,XUTMP,"USC1",XUDATA,0)) Q:XUDATA=""
173 S XUPSC=$P(XUDATA,"^")
174 S XUEFDA=$P(XUDATA,"^",2) I XUEFDA'>DT S XUEFDA=DT
175 S XUEXDA=$P(XUDATA,"^",3)
176 I XUEXDA<DT,XUEXDA'="" Q
177 N XULAST,XULDATA
178 S XULAST=$O(^VA(200,USERIEN,"USC1","A"),-1)
179 S ZZ(1,200.05,"+2,"_USERIEN_",",.01)=XUPSC
180 S ZZ(1,200.05,"+2,"_USERIEN_",",2)=XUEFDA
181 S ZZ(1,200.05,"+2,"_USERIEN_",",3)=XUEXDA
182 D UPDATE^DIE("","ZZ(1)")
183 Q:XULAST'>0
184 S XULDATA=$G(^VA(200,USERIEN,"USC1",XULAST,0))
185 S XULDATA=$P(XULDATA,"^",3)
186 Q:XULDATA'>DT
187 S $P(^VA(200,USERIEN,"USC1",XULAST,0),"^",3)=DT
188 Q
Note: See TracBrowser for help on using the repository browser.