BUSRUPD ;IHS/MSC/MGH - Authorization/Subscription Service ;22-Mar-2010 15:11;DU
;;1.0;AUTHORIZATION/SUBSCRIPTION;**1002**;APR 24, 1997;Build 5
;=================================================================
;
;
ENV ;Environment checker for USR updates
Q
PATCH(X) ;return 1 if patch X was installed, X=aaaa*nn.nn*nnnn
;copy of code from XPDUTL but modified to handle 4 digit IHS patch numbers
Q:X'?1.4UN1"*"1.2N1"."1.2N.1(1"V",1"T").2N1"*"1.4N 0
NEW NUM,I,J
S I=$O(^DIC(9.4,"C",$P(X,"*"),0)) Q:'I 0
S J=$O(^DIC(9.4,I,22,"B",$P(X,"*",2),0)),X=$P(X,"*",3) Q:'J 0
;check if patch is just a number
Q:$O(^DIC(9.4,I,22,J,"PAH","B",X,0)) 1
S NUM=$O(^DIC(9.4,I,22,J,"PAH","B",X_" SEQ"))
Q (X=+NUM)
PRE ;
N DLM,DDLM,QUIT,I,TEXT,DATA,PKGNM,VERSION,PATCH,PKGIEN,TAG,VSB,XREFREV
S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0 ; Suppress the Disable options and Move routine prompts
S DDLM=";;",DLM="|",QUIT=0
S TAG="USR"
S QUIT=0
F I=1:1 D Q:QUIT
.S TEXT=$T(@TAG+I) I TEXT="Q" S QUIT=1 Q
.S DATA=$P(TEXT,DDLM,2) I DATA="" S QUIT=1 Q
.S PKGNM=$P(DATA,DLM),VERSION=$P(DATA,DLM,2),PATCH=$P(DATA,DLM,3)
.I '$D(^DIC(9.4,"B",PKGNM)) Q
.S PKGIEN=$O(^DIC(9.4,"B",PKGNM,0)) Q:PKGIEN=""
.I '$D(^DIC(9.4,PKGIEN,22,"B",VERSION)) D
..K FDA
..S FDA(9.49,"+1,"_PKGIEN_",",.01)=VERSION
..D UPDATE^DIE(,"FDA")
..S FDA(9.49,"+1,"_PKGIEN_",",1)=$G(DT)
..S FDA(9.49,"+1,"_PKGIEN_",",2)=$G(DT)
..S FDA(9.49,"+1,"_PKGIEN_",",3)=$G(DUZ)
..D FILE^DIE(,"FDA")
.Q:PATCH=""
.S VSB=$O(^DIC(9.4,PKGIEN,22,"B",VERSION,0))
.Q:'VSB
.K FDA
.; Do not update if the patch is already in the patch history
.I $D(^DIC(9.4,PKGIEN,22,VSB,"PAH","B",PATCH)) Q
.S FDA(9.4901,"+1,"_VSB_","_PKGIEN_",",.01)=$G(PATCH)
.D UPDATE^DIE(,"FDA")
Q
;;;;FORMAT - Package name|Version|Patch|Sequence
USR ;
;;AUTHORIZATION/SUBSCRIPTION|1.0|1|
;;AUTHORIZATION/SUBSCRIPTION|1.0|2|
;;AUTHORIZATION/SUBSCRIPTION|1.0|3|
;;AUTHORIZATION/SUBSCRIPTION|1.0|4|
;;AUTHORIZATION/SUBSCRIPTION|1.0|6|
;;AUTHORIZATION/SUBSCRIPTION|1.0|7|
;;AUTHORIZATION/SUBSCRIPTION|1.0|8|
;;AUTHORIZATION/SUBSCRIPTION|1.0|9|
;;AUTHORIZATION/SUBSCRIPTION|1.0|10|
;;AUTHORIZATION/SUBSCRIPTION|1.0|11|
;;AUTHORIZATION/SUBSCRIPTION|1.0|12|
;;AUTHORIZATION/SUBSCRIPTION|1.0|13|
;;AUTHORIZATION/SUBSCRIPTION|1.0|14|
;;AUTHORIZATION/SUBSCRIPTION|1.0|15|
;;AUTHORIZATION/SUBSCRIPTION|1.0|16|
;;AUTHORIZATION/SUBSCRIPTION|1.0|17|
;;AUTHORIZATION/SUBSCRIPTION|1.0|18|
;;AUTHORIZATION/SUBSCRIPTION|1.0|20|
;;AUTHORIZATION/SUBSCRIPTION|1.0|21|
;;AUTHORIZATION/SUBSCRIPTION|1.0|22|
;;AUTHORIZATION/SUBSCRIPTION|1.0|26|
Q