VistA-WorldVistAEHR/r/NOIS-FSC/FSCSTUPN.m

92 lines
3.7 KiB
Mathematica

FSCSTUPN ;SLC/STAFF-NOIS Site Tracking Update - Patches Not Installed ;1/4/98 20:48
;;1.1;NOIS;;Sep 06, 1998
;
SITENOT(PATCH,CNT) ; from FSCLMIPX, FSCRPCG
N DOMAIN,PACKAGE,PATCH0,NUM,SITENAME,VERSION,VDATE
S CNT=+$G(CNT)
S PATCH0=$G(^A1AE(11005,+$G(PATCH),0)) I '$L(PATCH0) Q
S VDATE=$P(PATCH0,U,11)
I 'VDATE S CNT=1 D SETUP(.CNT," This patch has not been verified.") Q
I VDATE<2980101 S CNT=1 D Q
.D SETUP(.CNT,"This patch was released prior to implementation of tracking (1/1/98).")
.D SETUP(.CNT,"No data available.")
S PACKAGE=$P(PATCH0,U,2) I 'PACKAGE Q
S VERSION=$P(PATCH0,U,3) I 'VERSION Q
S SITENAME="" F S SITENAME=$O(^FSC("SITE","B",SITENAME)) Q:SITENAME="" D
.S NUM=0 F S NUM=$O(^FSC("SITE","B",SITENAME,NUM)) Q:NUM<1 D
..S DOMAIN=+$P($G(^FSC("SITE",NUM,0)),U,14) I 'DOMAIN Q
..I $O(^NTS(2050.2,"APD",PATCH,DOMAIN,0)) Q
..I '$$CHECK(PACKAGE,VERSION,DOMAIN) Q
..D SETUP(.CNT,SITENAME)
I 'CNT D SETUP(.CNT," Patch is installed at all sites.")
D SETUP(.CNT," ")
D SETUP(.CNT,"Note: Tracking of patch installs began 1/1/98. Prior installs are not reported.")
Q
;
ALLNOT(SITE,CNT) ; from FSCLMIPX, FSCRPCG
N DOMAIN,LINE,PACKAGE,PATCH,PATCH0,PATCHID,SUBJECT,VERSION K ^TMP("FSC PATCH",$J)
S CNT=+$G(CNT)
S DOMAIN=+$P($G(^FSC("SITE",+$G(SITE),0)),U,14) I 'DOMAIN Q
S PATCH=0 F S PATCH=$O(^NTS(2050.2,"B",PATCH)) Q:PATCH<1 D
.I $O(^NTS(2050.2,"APD",PATCH,DOMAIN,0)) Q
.S PATCH0=$G(^A1AE(11005,PATCH,0)) I '$L(PATCH0) Q
.I '$P(PATCH0,U,11) Q
.I $P(PATCH,U,8)="e" Q
.S PACKAGE=$P(PATCH0,U,2) I 'PACKAGE Q
.S VERSION=$P(PATCH0,U,3) I 'VERSION Q
.I '$$CHECK(PACKAGE,VERSION,DOMAIN) Q
.S PATCHID=$P(PATCH0,U),SUBJECT=$P(PATCH0,U,5)
.S LINE=$$SETSTR^VALM1(SUBJECT,PATCHID,15,$L(SUBJECT))
.S ^TMP("FSC PATCH",$J,PATCHID)=LINE
S PATCHID="" F S PATCHID=$O(^TMP("FSC PATCH",$J,PATCHID)) Q:PATCHID="" S LINE=^(PATCHID) D
.D SETUP(.CNT,LINE)
I 'CNT D SETUP(.CNT," All patches installed. This only applies to patches being tracked.")
D SETUP(.CNT," ")
D SETUP(.CNT,"Note: Tracking of patch installs began 1/1/98. Prior installs are not reported.")
K ^TMP("FSC PATCH",$J)
Q
;
PACKNOT(SITE,MODULE,CNT) ; from FSCLMIPX, FSCRPCG
N DOMAIN,LINE,PACKAGE,PATCH,PATCH0,PATCHID,SUBJECT,VERSION
S CNT=+$G(CNT)
S DOMAIN=+$P($G(^FSC("SITE",+$G(SITE),0)),U,14) I 'DOMAIN Q
S PACKAGE=+$P($G(^FSC("MOD",+$G(MODULE),0)),U,8) I 'PACKAGE Q
S PACKAGE=+$P(^FSC("PACK",PACKAGE,0),U,3) I 'PACKAGE Q
S VERSION=+$P($P(^FSC("MOD",MODULE,0),U),"/",2) I 'VERSION S VERSION=1
I '$$CHECK(PACKAGE,VERSION,DOMAIN) Q
S PATCH=0 F S PATCH=$O(^NTS(2050.2,"APVPD",PACKAGE,VERSION,PATCH)) Q:PATCH<1 D
.I $O(^NTS(2050.2,"APVPD",PACKAGE,VERSION,PATCH,DOMAIN,0)) Q
.S PATCH0=$G(^A1AE(11005,PATCH,0)) I '$L(PATCH0) Q
.I '$P(PATCH0,U,11) Q
.I '$P(PATCH,U,8)="e" Q
.S PATCHID=$P(PATCH0,U),SUBJECT=$P(PATCH0,U,5)
.S LINE=$$SETSTR^VALM1(SUBJECT,PATCHID,15,$L(SUBJECT))
.D SETUP(.CNT,LINE)
I 'CNT D SETUP(.CNT," All patches installed. This only applies to patches being tracked.")
D SETUP(.CNT," ")
D SETUP(.CNT,"Note: Tracking of patch installs began 1/1/98. Prior installs are not reported.")
Q
;
SETUP(CNT,LINE) ;
S CNT=CNT+1
I $D(VALMCNT) S ^TMP("FSC INSTALLS",$J,CNT,0)=LINE Q
S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=LINE
Q
;
CHECK(PACKAGE,VERSION,DOMAIN) ; $$(package, version, domain) -> 1 if installed at site, else 0
N SITEVER
I $O(^NTS(2050.2,"ADPVP",DOMAIN,PACKAGE,+VERSION,0)) Q 1
S SITEVER=+$$VERINST(PACKAGE,DOMAIN)
I SITEVER,SITEVER=+VERSION Q 1
Q 0
;
VERINST(PACKAGE,DOMAIN) ; $$(package,domain) -> current version#
N APP,SITENUM
S DOMAIN=$P($G(^DIC(4.2,+DOMAIN,0)),U)
I '$L(DOMAIN) Q ""
S SITENUM=$O(^NTS(2050,"AE",DOMAIN,0))
I 'SITENUM Q ""
S APP=+$O(^DIC(120102,"AP",PACKAGE,0))
I 'APP Q ""
Q $P($G(^NTS(2050,SITENUM,8,APP,0)),U,7)