- MAGGTU42 ;WOIFO/SG/NST - WORKSTATION-CLIENT VERSION REPORTS ; 30 Apr 2010 11:07 AM
- ;;3.0;IMAGING;**93,94**;Mar 19, 2002;Build 1744;May 26, 2010
- ;; Per VHA Directive 2004-038, this routine should not be modified.
- ;; +---------------------------------------------------------------+
- ;; | Property of the US Government. |
- ;; | No permission to copy or redistribute this software is given. |
- ;; | Use of unreleased versions of this software requires the user |
- ;; | to execute a written test agreement with the VistA Imaging |
- ;; | Development Office of the Department of Veterans Affairs, |
- ;; | telephone (301) 734-0100. |
- ;; | The Food and Drug Administration classifies this software as |
- ;; | a medical device. As such, it may not be changed in any way. |
- ;; | Modifications to this software may result in an adulterated |
- ;; | medical device under 21CFR820, the use of which is considered |
- ;; | to be a violation of US Federal Statutes. |
- ;; +---------------------------------------------------------------+
- ;;
- Q
- ;
- ;+++++ PRINTS THE ERROR MESSAGE
- ;
- ; ERR Error descriptor (see $$ERROR^MAGUERR)
- ;
- ERROR(ERR) ;
- Q:$G(ERR)'<0
- W !!,"ERROR: "_$P(ERR,U,2)
- W !,"Location: "_$TR($P(ERR,U,3),"~","^")
- Q
- ;
- ;+++++ PRINTS THE REPORT TABLE FOR THE XREF SUBTREE
- ;
- ; NODE Closed reference (name) of the xref subtree
- ;
- ; IQS Position of the sequential number in a closed
- ; reference of a cross-reference entry.
- ;
- ; Input Variables
- ; ===============
- ; MAGRAW, MAGSORT
- ;
- PRINT(NODE,IQS) ;
- N BUF,FLT,FLTL,I,PI,PREVCL,PREVWSNAME,RC,SEQN,TMP
- S (PI,FLT)=NODE,FLTL=$L(FLT)-1,FLT=$E(FLT,1,FLTL)
- ;---
- S (PREVCL,PREVWSNAME)="",RC=0
- F S PI=$Q(@PI) Q:$E(PI,1,FLTL)'=FLT D Q:RC<0
- . S SEQN=+$QS(PI,IQS),BUF=$G(@MAGRAW@(SEQN)) Q:BUF=""
- . ;--- Check if a new page should be started
- . S RC=$$PAGE^MAGUTL05(1) Q:RC<0
- . D:RC PRTBLH
- . ;--- Do not repeat the workstation name for its subsequent
- . ;--- clients unless this is the beginning of a new page.
- . D:MAGSORT="W"
- . . I $P(BUF,U,5)=PREVWSNAME S:'RC $P(BUF,U,5)=""
- . . E S PREVWSNAME=$P(BUF,U,5)
- . . Q
- . ;--- Do not repeat the client name and version for subsequent
- . ;--- workstations unless this is the beginning of a new page.
- . D:MAGSORT="V"
- . . I $P(BUF,U,2,3)=PREVCL S:'RC $P(BUF,U,2,3)=U
- . . E S PREVCL=$P(BUF,U,2,3)
- . . Q
- . ;--- Print the report line
- . D PRINT1(BUF)
- . Q
- ;---
- Q $S(RC<0:RC,1:0)
- ;
- ;+++++ PRINTS THE LINE OF THE REPORT
- ;
- ; BUF Column values in the same format as those
- ; returned by the $$WSCVCHCK^MAGGTU42.
- ;
- ; If the value of this parameter does not contain
- ; the '^' delimiter, then the first character is
- ; used to print a separator line.
- ;
- ; [BUF1] Headers for additional columns (not loaded by the
- ; $$WSCVCHCK^MAGGTU42).
- ;
- ; Input Variables
- ; ===============
- ; MAGRAW, MAGSORT
- ;
- PRINT1(BUF,BUF1) ;
- N FLDW,SP S SP=" "
- ;=== Load additional data from IMAGING WINDOWS WORKSTATIONS file
- I BUF>0 D
- . N I,IENS,MAGBUF,MAGMSG S IENS=+BUF_","
- . D GETS^DIQ(2006.81,IENS,"2;10.5","EI","MAGBUF","MAGMSG")
- . S $P(BUF1,U,1)=$G(MAGBUF(2006.81,IENS,2,"I"))
- . S $P(BUF1,U,2)=$G(MAGBUF(2006.81,IENS,10.5,"I"))
- . ;--- Convert dates to external format
- . F I=7 S TMP=$P(BUF,U,I) D:TMP>0
- . . S $P(BUF,U,I)=$$FMTE^XLFDT(TMP,"2DZ")
- . . Q
- . F I=1 S TMP=$P(BUF1,U,I) D:TMP>0
- . . S $P(BUF1,U,I)=$$FMTE^XLFDT(TMP,"2DZ")
- . . Q
- . Q
- E S:BUF'[U SP=$E(BUF,1),(BUF,BUF1)=""
- ;
- ;=== Print the line
- I MAGSORT="W" D Q
- . W !,$$LJ^XLFSTR($P(BUF,U,5),25,SP) ; Workstation Name
- . W " "_$$LJ^XLFSTR($P(BUF,U,2),10,SP) ; Client Application
- . W " "_$$LJ^XLFSTR($P(BUF,U,3),14,SP) ; Client Version
- . W " "_$$CJ^XLFSTR($P(BUF,U,7),8,SP) ; Client Date
- . W " "_$$CJ^XLFSTR($P(BUF1,U,1),8,SP) ; Last Logon
- . W " "_$$CJ^XLFSTR($P(BUF1,U,2),4,SP) ; Session Type
- . Q
- ;---
- W !,$$LJ^XLFSTR($P(BUF,U,2),10,SP) ; Client Application
- W " "_$$LJ^XLFSTR($P(BUF,U,3),14,SP) ; Client Version
- W " "_$$LJ^XLFSTR($P(BUF,U,5),25,SP) ; Workstation Name
- W " "_$$CJ^XLFSTR($P(BUF,U,7),8,SP) ; Client Date
- W " "_$$CJ^XLFSTR($P(BUF1,U,1),8,SP) ; Last Logon
- W " "_$$CJ^XLFSTR($P(BUF1,U,2),4,SP) ; Session Type
- Q
- ;
- ;+++++ PRINTS THE TABLE HEADER
- ;
- ; Input Variables
- ; ===============
- ; MAGPAGE
- ;
- ; Output Variables
- ; ================
- ; MAGPAGE
- ;
- PRTBLH ;
- N TMP
- S MAGPAGE=MAGPAGE+1
- W:MAGPAGE>1 !,$$RJ^XLFSTR("Page "_MAGPAGE,IOM-1)
- ;--- 1st line of the table headers
- S TMP="^^^^^^Client"
- D PRINT1(TMP,"Last^")
- ;--- 2nd line of the table headers
- S TMP="^Client^Client Version^^Workstation Name^^Date"
- D PRINT1(TMP,"Logon^Type")
- ;--- Separator
- D PRINT1("-")
- Q
- ;
- ;##### CHECKS VERSIONS OF CLIENTS THAT RAN ON THE WORKSTATIONS
- ;
- ; MAG8DST Closed reference (name) of a parent node where
- ; the list of workstations is returned to.
- ;
- ; @MAG8DST@(
- ;
- ; 0) Result descriptor
- ; ^01: Number of fields in the data record
- ;
- ; Seq#) Workstation-Client data
- ; ^01: Workstation IEN (file #2006.81)
- ; ^02: Client application name (see the
- ; $$CLADESC^MAGGTU41 for details)
- ; ^03: Client version (from the last run)
- ; ^04: Version check code returned by
- ; the $$CHKVER1^MAGGTU41
- ; ^05: Workstation name (value of the .01 field)
- ; ^06: External value of the PLACE field (.04)
- ; ^07: Client application date/time (internal)
- ;
- ; "CPW", Number of subscripts in the Client-Place-Workstation
- ; index (see the "C" flag below).
- ; ClientName,PlaceName,WSName,Seq#)=""
- ;
- ; "PCVW", Number of subscripts in the Place-Client-Version-
- ; Patch-Build-Workstation ("PCVW") index in the result
- ; array (see the "V" flag below).
- ; PlaceName,ClientName,Version,Patch,Build,WSName,Seq#)=""
- ;
- ; "PWC", Number of subscripts in the Place-Workstation-Client
- ; index (see the "W" flag below).
- ; PlaceName,WSName,ClientName,Seq#)=""
- ;
- ; "TOTALS" Count total workstations processed and how many have to updated
- ; ^01: Total workstations processed
- ; ^02: Total workstations need to be updated
- ;
- ; [FLAGS] Flags that control the execution (can be combined):
- ;
- ; C Create the Client-Place-Workstation ("CPW")
- ; index in the result array.
- ;
- ; V Create the Place-Client-Version-Patch-Build-
- ; Workstation ("PCVW") index in the result array.
- ;
- ; W Create the Place-Workstation-Client ("PWC")
- ; index in the result array.
- ;
- ; [CVRCTRSH] Threshold number for the version check code (0-4).
- ; If the version check code is not less than the
- ; threshold, then the workstation-client pair is
- ; added to the result list.
- ;
- ; If this parameter is not defined or empty, then
- ; the value of 3 is assumed (see $$CHKVER1^MAGGTU41
- ; for details).
- ;
- ; [CLALST] List of client names (see the $$CLADESC^MAGGTU41
- ; for details)) separated by commas.
- ;
- ; By default ($G(CLALST)=""), all supported clients
- ; are checked.
- ;
- ; MAGLLGDT Workstation Last Login date
- ;
- ; MAGWNMB Workstation name contains
- ;
- ; MAGALLW Include all workstations in the report (0/1)
- ;
- ;
- ; Return Values
- ; =============
- ; <0 Error descriptor (see $$ERROR^MAGUERR)
- ; 0 Ok
- ;
- WSCVCHCK(MAG8DST,FLAGS,CVRCTRSH,CLALST,MAGLLGDT,MAGWNMB,MAGALLW) ;
- N MAGVCD ; Version control data
- ;
- N CLNAME,CLVER,CVRC,FLDLST,I,IENS,MAG8BUF,MAG8I
- N MAGMSG,N,PLACE,TMP,WSIEN,WSNAME
- N FUPDWS ; Should I update the workstation
- N FRPTWS ; Workstation has at least one version check
- ;
- ;=== Validate parameters and initialize variables
- Q:$G(MAG8DST)?." " $$ERROR^MAGUERR(-8,,"MAG8DST")
- K @MAG8DST S MAG8I=0
- ;--- Client name(s)
- S CLALST=$TR($G(CLALST)," ")
- S:CLALST="" CLALST=$$CLADESC^MAGGTU41()
- ;--- Version check threshold
- I $G(CVRCTRSH)="" S CVRCTRSH=3
- E D Q:TMP $$IPVE^MAGUERR("CVRCTRSH")
- . S TMP=$S(+CVRCTRSH'=CVRCTRSH:1,CVRCTRSH<0:1,CVRCTRSH>4:1,1:0)
- . Q
- ;--- Flags
- S FLAGS=$G(FLAGS)
- ;
- ;=== Client applications and version field numbers
- S FLDLST="",N=$L(CLALST,",")
- F I=1:1:N S CLNAME=$P(CLALST,",",I) D
- . S MAG8BUF=$$CLADESC^MAGGTU41(CLNAME) Q:MAG8BUF<0
- . ;--- Version field number
- . S TMP=+$P(MAG8BUF,U,2)
- . S:TMP>0 $P(FLDLST(CLNAME),U,1)=TMP,FLDLST=FLDLST_";"_TMP
- . ;--- Date/time field number
- . S TMP=+$P(MAG8BUF,U,3)
- . S:TMP>0 $P(FLDLST(CLNAME),U,2)=TMP,FLDLST=FLDLST_";"_TMP
- . Q
- ;---
- Q:FLDLST="" $$ERROR^MAGUERR(-26,,"FLDLST")
- S FLDLST=".01;.04;2"_FLDLST
- ;
- S WSIEN=0
- F S WSIEN=$O(^MAG(2006.81,WSIEN)) Q:WSIEN'>0 D
- . K MAG8BUF,MAGMSG
- . ;=== Get the workstation data
- . S IENS=WSIEN_","
- . D GETS^DIQ(2006.81,IENS,FLDLST,"EI","MAG8BUF","MAGMSG")
- . I MAGLLGDT>$G(MAG8BUF(2006.81,IENS,2,"I")) Q ; Last login date is older than requested
- . S WSNAME=$G(MAG8BUF(2006.81,IENS,.01,"E")) ; NAME
- . S:WSNAME="" WSNAME="#"_WSIEN ; Just in case ;-)
- . I '(WSNAME[MAGWNMB) Q ; Skip. Machine name does not contain MAGWNMB
- . S PLACE=$G(MAG8BUF(2006.81,IENS,.04,"E")) ; PLACE
- . S:PLACE="" PLACE=" "
- . ;
- . ;=== Check the clients
- . S CLNAME=""
- . S FRPTWS=0
- . F S CLNAME=$O(FLDLST(CLNAME)) Q:CLNAME="" D
- . . S CLVER=$G(MAG8BUF(2006.81,IENS,+FLDLST(CLNAME),"E")) Q:CLVER=""
- . . ;--- Check the version
- . . S CVRC=$$CHKVER1^MAGGTU41(.MAGVCD,CLNAME,.CLVER)
- . . Q:CVRC<0 ; Skip values with errors
- . . S FRPTWS=1 ; at least one client version is checked
- . . S FUPDWS=1
- . . I CVRC<CVRCTRSH Q:'MAGALLW S FUPDWS=0,CLVER="*"_CLVER ; Skip values below threshold or add them we report all workstations
- . . ;--- Store the result
- . . S MAG8BUF=WSIEN_U_CLNAME_U_CLVER_U_CVRC_U_WSNAME_U_PLACE
- . . S TMP=+$P(FLDLST(CLNAME),U,2)
- . . S:TMP $P(MAG8BUF,U,7)=$G(MAG8BUF(2006.81,IENS,TMP,"I"))
- . . S MAG8I=MAG8I+1,@MAG8DST@(MAG8I)=MAG8BUF
- . . ;--- Create indexes
- . . S:FLAGS["C" @MAG8DST@("CPW",CLNAME,PLACE,WSNAME,MAG8I)=""
- . . D:FLAGS["V"
- . . . S TMP=$NA(@MAG8DST@("PCVW",PLACE,CLNAME,+$P(CLVER,".",1,2)))
- . . . S @TMP@(+$P(CLVER,".",3),+$P(CLVER,".",4),WSNAME,MAG8I)=""
- . . . Q
- . . S:FLAGS["W" @MAG8DST@("PWC",PLACE,WSNAME,CLNAME,MAG8I)=""
- . . I FUPDWS,'$D(@MAG8DST@("TOTALSU",WSNAME)) D
- . . . S @MAG8DST@("TOTALSU",WSNAME)=""
- . . . S $P(@MAG8DST@("TOTALS"),U,2)=$P($G(@MAG8DST@("TOTALS")),U,2)+1
- . . . Q
- . . Q
- . I FRPTWS,'$D(@MAG8DST@("TOTALS",WSNAME)) D
- . . S @MAG8DST@("TOTALS",WSNAME)=""
- . . S $P(@MAG8DST@("TOTALS"),U)=$P($G(@MAG8DST@("TOTALS")),U)+1
- . . Q
- . Q
- ;
- ;=== Store the result characteristics
- D:$D(@MAG8DST)>0
- . ;--- Numbers of subscripts in the indexes
- . S:FLAGS["C" @MAG8DST@("CPW")=7
- . S:FLAGS["V" @MAG8DST@("PCVW")=10
- . S:FLAGS["W" @MAG8DST@("PWC")=7
- . ;--- Number of fields in the data record
- . S @MAG8DST@(0)=7
- . Q
- ;===
- Q 0
- ;
- ;***** PRINTS THE WORKSTATION-CLIENT VERSION CHECK REPORT
- ;
- ; Input Variables
- ; ===============
- ; MAGSORT ; Sort mode for the report
- ; MAGLLGDT ; Workstation Last Login date
- ; MAGWNMB ; Workstation name contains
- ;
- ;
- ; Notes
- ; =====
- ;
- ; The ^TMP("MAGGTU42",$J) global node is used by this entry point to
- ; store the raw report data.
- ;
- WSCVCRPT ;
- N MAGPAGE ; Current page number
- N MAGRAW ; Closed reference (name) of the raw report data
- ;
- N RC
- N PRINTHDR ; If the header is printed already
- S MAGRAW=$NA(^TMP("MAGGTU42",$J))
- S (MAGPAGE,RC)=0
- ;
- D
- . N BUF,FLAGS,IQS,PLACE,XREF
- . S FLAGS=$S($G(MAGSORT)'="":MAGSORT,1:"V")
- . S MAGLLGDT=$S($G(MAGLLGDT)="":$P($$FMADD^XLFDT($$NOW^XLFDT,-30),"."),1:MAGLLGDT)
- . S MAGWNMB=$G(MAGWNMB)
- . S MAGALLW=$S($G(MAGALLW)="":"N",1:MAGALLW)
- . S XREF=$S(FLAGS="V":"PCVW",FLAGS="W":"PWC",1:"")
- . I XREF="" S RC=$$IPVE^MAGUERR("MAGSORT") Q
- . ;
- . ;=== Compile the list of workstations and clients
- . S RC=$$WSCVCHCK(MAGRAW,FLAGS,"","",MAGLLGDT,MAGWNMB,MAGALLW) Q:RC<0
- . S IQS=+$G(@MAGRAW@(XREF))
- . I IQS<0 S RC=$$ERROR^MAGUERR(-26,,$NA(@MAGRAW@(XREF))) Q
- . ;
- . ;=== Print the report for each site
- . S PRINTHDR=1 ; will print report header if there is no data to print
- . S PLACE="",$Y=0
- . F S PLACE=$O(@MAGRAW@(XREF,PLACE)) Q:PLACE="" D Q:RC<0
- . . W:$E(IOST,1,2)="C-" @IOF
- . . ;--- Print the header
- . . S PRINTHDR=0
- . . D PRTRHDR(MAGALLW,MAGLLGDT,MAGWNMB,IOM)
- . . W !,$$CJ^XLFSTR(PLACE,IOM),!
- . . D PRTBLH
- . . ;--- Print the table
- . . S RC=$$PRINT($NA(@MAGRAW@(XREF,PLACE)),IQS) Q:RC<0
- . . ;--- Force the new page after the end of each section
- . . S RC=$$PAGE^MAGUTL05(1,1) Q:RC<0
- . . Q
- . D:PRINTHDR PRTRHDR(MAGALLW,MAGLLGDT,MAGWNMB,IOM)
- . S BUF="Workstation(s) found: "_$P(@MAGRAW@("TOTALS"),U)
- . W !!,$$LJ^XLFSTR(BUF,IOM)
- . S BUF="Workstation(s) to be updated: "_+$P(@MAGRAW@("TOTALS"),U,2)
- . W !,$$LJ^XLFSTR(BUF,IOM)
- . Q
- ;
- ;=== Error handling and cleanup
- D ERROR(RC):RC<-2,^%ZISC
- S:$D(ZTQUEUED) ZTREQ="@"
- K @MAGRAW
- Q
- ;
- PRTRHDR(MAGALLW,MAGLLGDT,MAGWNMB,IOM) ;--- Print report the header
- N BUF
- S BUF=$S(MAGALLW:"LIST OF ALL WORKSTATIONS AND CLIENTS",1:"LIST OF WORKSTATIONS AND CLIENTS THAT HAVE TO BE UPDATED")
- W !,$$CJ^XLFSTR(BUF,IOM)
- S BUF="LAST LOGIN DATE: "_$$FMTE^XLFDT(MAGLLGDT)
- S BUF=BUF_$S(MAGWNMB'="":" WS NAME CONTAINS: "_MAGWNMB,1:"")
- W !,$$CJ^XLFSTR(BUF,IOM)
- W !,$$CJ^XLFSTR($$REPEAT^XLFSTR("=",$L(BUF)),IOM)
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTU42 14209 printed Mar 13, 2025@21:08:19 Page 2
- MAGGTU42 ;WOIFO/SG/NST - WORKSTATION-CLIENT VERSION REPORTS ; 30 Apr 2010 11:07 AM
- +1 ;;3.0;IMAGING;**93,94**;Mar 19, 2002;Build 1744;May 26, 2010
- +2 ;; Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;; +---------------------------------------------------------------+
- +4 ;; | Property of the US Government. |
- +5 ;; | No permission to copy or redistribute this software is given. |
- +6 ;; | Use of unreleased versions of this software requires the user |
- +7 ;; | to execute a written test agreement with the VistA Imaging |
- +8 ;; | Development Office of the Department of Veterans Affairs, |
- +9 ;; | telephone (301) 734-0100. |
- +10 ;; | The Food and Drug Administration classifies this software as |
- +11 ;; | a medical device. As such, it may not be changed in any way. |
- +12 ;; | Modifications to this software may result in an adulterated |
- +13 ;; | medical device under 21CFR820, the use of which is considered |
- +14 ;; | to be a violation of US Federal Statutes. |
- +15 ;; +---------------------------------------------------------------+
- +16 ;;
- +17 QUIT
- +18 ;
- +19 ;+++++ PRINTS THE ERROR MESSAGE
- +20 ;
- +21 ; ERR Error descriptor (see $$ERROR^MAGUERR)
- +22 ;
- ERROR(ERR) ;
- +1 if $GET(ERR)'<0
- QUIT
- +2 WRITE !!,"ERROR: "_$PIECE(ERR,U,2)
- +3 WRITE !,"Location: "_$TRANSLATE($PIECE(ERR,U,3),"~","^")
- +4 QUIT
- +5 ;
- +6 ;+++++ PRINTS THE REPORT TABLE FOR THE XREF SUBTREE
- +7 ;
- +8 ; NODE Closed reference (name) of the xref subtree
- +9 ;
- +10 ; IQS Position of the sequential number in a closed
- +11 ; reference of a cross-reference entry.
- +12 ;
- +13 ; Input Variables
- +14 ; ===============
- +15 ; MAGRAW, MAGSORT
- +16 ;
- PRINT(NODE,IQS) ;
- +1 NEW BUF,FLT,FLTL,I,PI,PREVCL,PREVWSNAME,RC,SEQN,TMP
- +2 SET (PI,FLT)=NODE
- SET FLTL=$LENGTH(FLT)-1
- SET FLT=$EXTRACT(FLT,1,FLTL)
- +3 ;---
- +4 SET (PREVCL,PREVWSNAME)=""
- SET RC=0
- +5 FOR
- SET PI=$QUERY(@PI)
- if $EXTRACT(PI,1,FLTL)'=FLT
- QUIT
- Begin DoDot:1
- +6 SET SEQN=+$QSUBSCRIPT(PI,IQS)
- SET BUF=$GET(@MAGRAW@(SEQN))
- if BUF=""
- QUIT
- +7 ;--- Check if a new page should be started
- +8 SET RC=$$PAGE^MAGUTL05(1)
- if RC<0
- QUIT
- +9 if RC
- DO PRTBLH
- +10 ;--- Do not repeat the workstation name for its subsequent
- +11 ;--- clients unless this is the beginning of a new page.
- +12 if MAGSORT="W"
- Begin DoDot:2
- +13 IF $PIECE(BUF,U,5)=PREVWSNAME
- if 'RC
- SET $PIECE(BUF,U,5)=""
- +14 IF '$TEST
- SET PREVWSNAME=$PIECE(BUF,U,5)
- +15 QUIT
- End DoDot:2
- +16 ;--- Do not repeat the client name and version for subsequent
- +17 ;--- workstations unless this is the beginning of a new page.
- +18 if MAGSORT="V"
- Begin DoDot:2
- +19 IF $PIECE(BUF,U,2,3)=PREVCL
- if 'RC
- SET $PIECE(BUF,U,2,3)=U
- +20 IF '$TEST
- SET PREVCL=$PIECE(BUF,U,2,3)
- +21 QUIT
- End DoDot:2
- +22 ;--- Print the report line
- +23 DO PRINT1(BUF)
- +24 QUIT
- End DoDot:1
- if RC<0
- QUIT
- +25 ;---
- +26 QUIT $SELECT(RC<0:RC,1:0)
- +27 ;
- +28 ;+++++ PRINTS THE LINE OF THE REPORT
- +29 ;
- +30 ; BUF Column values in the same format as those
- +31 ; returned by the $$WSCVCHCK^MAGGTU42.
- +32 ;
- +33 ; If the value of this parameter does not contain
- +34 ; the '^' delimiter, then the first character is
- +35 ; used to print a separator line.
- +36 ;
- +37 ; [BUF1] Headers for additional columns (not loaded by the
- +38 ; $$WSCVCHCK^MAGGTU42).
- +39 ;
- +40 ; Input Variables
- +41 ; ===============
- +42 ; MAGRAW, MAGSORT
- +43 ;
- PRINT1(BUF,BUF1) ;
- +1 NEW FLDW,SP
- SET SP=" "
- +2 ;=== Load additional data from IMAGING WINDOWS WORKSTATIONS file
- +3 IF BUF>0
- Begin DoDot:1
- +4 NEW I,IENS,MAGBUF,MAGMSG
- SET IENS=+BUF_","
- +5 DO GETS^DIQ(2006.81,IENS,"2;10.5","EI","MAGBUF","MAGMSG")
- +6 SET $PIECE(BUF1,U,1)=$GET(MAGBUF(2006.81,IENS,2,"I"))
- +7 SET $PIECE(BUF1,U,2)=$GET(MAGBUF(2006.81,IENS,10.5,"I"))
- +8 ;--- Convert dates to external format
- +9 FOR I=7
- SET TMP=$PIECE(BUF,U,I)
- if TMP>0
- Begin DoDot:2
- +10 SET $PIECE(BUF,U,I)=$$FMTE^XLFDT(TMP,"2DZ")
- +11 QUIT
- End DoDot:2
- +12 FOR I=1
- SET TMP=$PIECE(BUF1,U,I)
- if TMP>0
- Begin DoDot:2
- +13 SET $PIECE(BUF1,U,I)=$$FMTE^XLFDT(TMP,"2DZ")
- +14 QUIT
- End DoDot:2
- +15 QUIT
- End DoDot:1
- +16 IF '$TEST
- if BUF'[U
- SET SP=$EXTRACT(BUF,1)
- SET (BUF,BUF1)=""
- +17 ;
- +18 ;=== Print the line
- +19 IF MAGSORT="W"
- Begin DoDot:1
- +20 ; Workstation Name
- WRITE !,$$LJ^XLFSTR($PIECE(BUF,U,5),25,SP)
- +21 ; Client Application
- WRITE " "_$$LJ^XLFSTR($PIECE(BUF,U,2),10,SP)
- +22 ; Client Version
- WRITE " "_$$LJ^XLFSTR($PIECE(BUF,U,3),14,SP)
- +23 ; Client Date
- WRITE " "_$$CJ^XLFSTR($PIECE(BUF,U,7),8,SP)
- +24 ; Last Logon
- WRITE " "_$$CJ^XLFSTR($PIECE(BUF1,U,1),8,SP)
- +25 ; Session Type
- WRITE " "_$$CJ^XLFSTR($PIECE(BUF1,U,2),4,SP)
- +26 QUIT
- End DoDot:1
- QUIT
- +27 ;---
- +28 ; Client Application
- WRITE !,$$LJ^XLFSTR($PIECE(BUF,U,2),10,SP)
- +29 ; Client Version
- WRITE " "_$$LJ^XLFSTR($PIECE(BUF,U,3),14,SP)
- +30 ; Workstation Name
- WRITE " "_$$LJ^XLFSTR($PIECE(BUF,U,5),25,SP)
- +31 ; Client Date
- WRITE " "_$$CJ^XLFSTR($PIECE(BUF,U,7),8,SP)
- +32 ; Last Logon
- WRITE " "_$$CJ^XLFSTR($PIECE(BUF1,U,1),8,SP)
- +33 ; Session Type
- WRITE " "_$$CJ^XLFSTR($PIECE(BUF1,U,2),4,SP)
- +34 QUIT
- +35 ;
- +36 ;+++++ PRINTS THE TABLE HEADER
- +37 ;
- +38 ; Input Variables
- +39 ; ===============
- +40 ; MAGPAGE
- +41 ;
- +42 ; Output Variables
- +43 ; ================
- +44 ; MAGPAGE
- +45 ;
- PRTBLH ;
- +1 NEW TMP
- +2 SET MAGPAGE=MAGPAGE+1
- +3 if MAGPAGE>1
- WRITE !,$$RJ^XLFSTR("Page "_MAGPAGE,IOM-1)
- +4 ;--- 1st line of the table headers
- +5 SET TMP="^^^^^^Client"
- +6 DO PRINT1(TMP,"Last^")
- +7 ;--- 2nd line of the table headers
- +8 SET TMP="^Client^Client Version^^Workstation Name^^Date"
- +9 DO PRINT1(TMP,"Logon^Type")
- +10 ;--- Separator
- +11 DO PRINT1("-")
- +12 QUIT
- +13 ;
- +14 ;##### CHECKS VERSIONS OF CLIENTS THAT RAN ON THE WORKSTATIONS
- +15 ;
- +16 ; MAG8DST Closed reference (name) of a parent node where
- +17 ; the list of workstations is returned to.
- +18 ;
- +19 ; @MAG8DST@(
- +20 ;
- +21 ; 0) Result descriptor
- +22 ; ^01: Number of fields in the data record
- +23 ;
- +24 ; Seq#) Workstation-Client data
- +25 ; ^01: Workstation IEN (file #2006.81)
- +26 ; ^02: Client application name (see the
- +27 ; $$CLADESC^MAGGTU41 for details)
- +28 ; ^03: Client version (from the last run)
- +29 ; ^04: Version check code returned by
- +30 ; the $$CHKVER1^MAGGTU41
- +31 ; ^05: Workstation name (value of the .01 field)
- +32 ; ^06: External value of the PLACE field (.04)
- +33 ; ^07: Client application date/time (internal)
- +34 ;
- +35 ; "CPW", Number of subscripts in the Client-Place-Workstation
- +36 ; index (see the "C" flag below).
- +37 ; ClientName,PlaceName,WSName,Seq#)=""
- +38 ;
- +39 ; "PCVW", Number of subscripts in the Place-Client-Version-
- +40 ; Patch-Build-Workstation ("PCVW") index in the result
- +41 ; array (see the "V" flag below).
- +42 ; PlaceName,ClientName,Version,Patch,Build,WSName,Seq#)=""
- +43 ;
- +44 ; "PWC", Number of subscripts in the Place-Workstation-Client
- +45 ; index (see the "W" flag below).
- +46 ; PlaceName,WSName,ClientName,Seq#)=""
- +47 ;
- +48 ; "TOTALS" Count total workstations processed and how many have to updated
- +49 ; ^01: Total workstations processed
- +50 ; ^02: Total workstations need to be updated
- +51 ;
- +52 ; [FLAGS] Flags that control the execution (can be combined):
- +53 ;
- +54 ; C Create the Client-Place-Workstation ("CPW")
- +55 ; index in the result array.
- +56 ;
- +57 ; V Create the Place-Client-Version-Patch-Build-
- +58 ; Workstation ("PCVW") index in the result array.
- +59 ;
- +60 ; W Create the Place-Workstation-Client ("PWC")
- +61 ; index in the result array.
- +62 ;
- +63 ; [CVRCTRSH] Threshold number for the version check code (0-4).
- +64 ; If the version check code is not less than the
- +65 ; threshold, then the workstation-client pair is
- +66 ; added to the result list.
- +67 ;
- +68 ; If this parameter is not defined or empty, then
- +69 ; the value of 3 is assumed (see $$CHKVER1^MAGGTU41
- +70 ; for details).
- +71 ;
- +72 ; [CLALST] List of client names (see the $$CLADESC^MAGGTU41
- +73 ; for details)) separated by commas.
- +74 ;
- +75 ; By default ($G(CLALST)=""), all supported clients
- +76 ; are checked.
- +77 ;
- +78 ; MAGLLGDT Workstation Last Login date
- +79 ;
- +80 ; MAGWNMB Workstation name contains
- +81 ;
- +82 ; MAGALLW Include all workstations in the report (0/1)
- +83 ;
- +84 ;
- +85 ; Return Values
- +86 ; =============
- +87 ; <0 Error descriptor (see $$ERROR^MAGUERR)
- +88 ; 0 Ok
- +89 ;
- WSCVCHCK(MAG8DST,FLAGS,CVRCTRSH,CLALST,MAGLLGDT,MAGWNMB,MAGALLW) ;
- +1 ; Version control data
- NEW MAGVCD
- +2 ;
- +3 NEW CLNAME,CLVER,CVRC,FLDLST,I,IENS,MAG8BUF,MAG8I
- +4 NEW MAGMSG,N,PLACE,TMP,WSIEN,WSNAME
- +5 ; Should I update the workstation
- NEW FUPDWS
- +6 ; Workstation has at least one version check
- NEW FRPTWS
- +7 ;
- +8 ;=== Validate parameters and initialize variables
- +9 if $GET(MAG8DST)?." "
- QUIT $$ERROR^MAGUERR(-8,,"MAG8DST")
- +10 KILL @MAG8DST
- SET MAG8I=0
- +11 ;--- Client name(s)
- +12 SET CLALST=$TRANSLATE($GET(CLALST)," ")
- +13 if CLALST=""
- SET CLALST=$$CLADESC^MAGGTU41()
- +14 ;--- Version check threshold
- +15 IF $GET(CVRCTRSH)=""
- SET CVRCTRSH=3
- +16 IF '$TEST
- Begin DoDot:1
- +17 SET TMP=$SELECT(+CVRCTRSH'=CVRCTRSH:1,CVRCTRSH<0:1,CVRCTRSH>4:1,1:0)
- +18 QUIT
- End DoDot:1
- if TMP
- QUIT $$IPVE^MAGUERR("CVRCTRSH")
- +19 ;--- Flags
- +20 SET FLAGS=$GET(FLAGS)
- +21 ;
- +22 ;=== Client applications and version field numbers
- +23 SET FLDLST=""
- SET N=$LENGTH(CLALST,",")
- +24 FOR I=1:1:N
- SET CLNAME=$PIECE(CLALST,",",I)
- Begin DoDot:1
- +25 SET MAG8BUF=$$CLADESC^MAGGTU41(CLNAME)
- if MAG8BUF<0
- QUIT
- +26 ;--- Version field number
- +27 SET TMP=+$PIECE(MAG8BUF,U,2)
- +28 if TMP>0
- SET $PIECE(FLDLST(CLNAME),U,1)=TMP
- SET FLDLST=FLDLST_";"_TMP
- +29 ;--- Date/time field number
- +30 SET TMP=+$PIECE(MAG8BUF,U,3)
- +31 if TMP>0
- SET $PIECE(FLDLST(CLNAME),U,2)=TMP
- SET FLDLST=FLDLST_";"_TMP
- +32 QUIT
- End DoDot:1
- +33 ;---
- +34 if FLDLST=""
- QUIT $$ERROR^MAGUERR(-26,,"FLDLST")
- +35 SET FLDLST=".01;.04;2"_FLDLST
- +36 ;
- +37 SET WSIEN=0
- +38 FOR
- SET WSIEN=$ORDER(^MAG(2006.81,WSIEN))
- if WSIEN'>0
- QUIT
- Begin DoDot:1
- +39 KILL MAG8BUF,MAGMSG
- +40 ;=== Get the workstation data
- +41 SET IENS=WSIEN_","
- +42 DO GETS^DIQ(2006.81,IENS,FLDLST,"EI","MAG8BUF","MAGMSG")
- +43 ; Last login date is older than requested
- IF MAGLLGDT>$GET(MAG8BUF(2006.81,IENS,2,"I"))
- QUIT
- +44 ; NAME
- SET WSNAME=$GET(MAG8BUF(2006.81,IENS,.01,"E"))
- +45 ; Just in case ;-)
- if WSNAME=""
- SET WSNAME="#"_WSIEN
- +46 ; Skip. Machine name does not contain MAGWNMB
- IF '(WSNAME[MAGWNMB)
- QUIT
- +47 ; PLACE
- SET PLACE=$GET(MAG8BUF(2006.81,IENS,.04,"E"))
- +48 if PLACE=""
- SET PLACE=" "
- +49 ;
- +50 ;=== Check the clients
- +51 SET CLNAME=""
- +52 SET FRPTWS=0
- +53 FOR
- SET CLNAME=$ORDER(FLDLST(CLNAME))
- if CLNAME=""
- QUIT
- Begin DoDot:2
- +54 SET CLVER=$GET(MAG8BUF(2006.81,IENS,+FLDLST(CLNAME),"E"))
- if CLVER=""
- QUIT
- +55 ;--- Check the version
- +56 SET CVRC=$$CHKVER1^MAGGTU41(.MAGVCD,CLNAME,.CLVER)
- +57 ; Skip values with errors
- if CVRC<0
- QUIT
- +58 ; at least one client version is checked
- SET FRPTWS=1
- +59 SET FUPDWS=1
- +60 ; Skip values below threshold or add them we report all workstations
- IF CVRC<CVRCTRSH
- if 'MAGALLW
- QUIT
- SET FUPDWS=0
- SET CLVER="*"_CLVER
- +61 ;--- Store the result
- +62 SET MAG8BUF=WSIEN_U_CLNAME_U_CLVER_U_CVRC_U_WSNAME_U_PLACE
- +63 SET TMP=+$PIECE(FLDLST(CLNAME),U,2)
- +64 if TMP
- SET $PIECE(MAG8BUF,U,7)=$GET(MAG8BUF(2006.81,IENS,TMP,"I"))
- +65 SET MAG8I=MAG8I+1
- SET @MAG8DST@(MAG8I)=MAG8BUF
- +66 ;--- Create indexes
- +67 if FLAGS["C"
- SET @MAG8DST@("CPW",CLNAME,PLACE,WSNAME,MAG8I)=""
- +68 if FLAGS["V"
- Begin DoDot:3
- +69 SET TMP=$NAME(@MAG8DST@("PCVW",PLACE,CLNAME,+$PIECE(CLVER,".",1,2)))
- +70 SET @TMP@(+$PIECE(CLVER,".",3),+$PIECE(CLVER,".",4),WSNAME,MAG8I)=""
- +71 QUIT
- End DoDot:3
- +72 if FLAGS["W"
- SET @MAG8DST@("PWC",PLACE,WSNAME,CLNAME,MAG8I)=""
- +73 IF FUPDWS
- IF '$DATA(@MAG8DST@("TOTALSU",WSNAME))
- Begin DoDot:3
- +74 SET @MAG8DST@("TOTALSU",WSNAME)=""
- +75 SET $PIECE(@MAG8DST@("TOTALS"),U,2)=$PIECE($GET(@MAG8DST@("TOTALS")),U,2)+1
- +76 QUIT
- End DoDot:3
- +77 QUIT
- End DoDot:2
- +78 IF FRPTWS
- IF '$DATA(@MAG8DST@("TOTALS",WSNAME))
- Begin DoDot:2
- +79 SET @MAG8DST@("TOTALS",WSNAME)=""
- +80 SET $PIECE(@MAG8DST@("TOTALS"),U)=$PIECE($GET(@MAG8DST@("TOTALS")),U)+1
- +81 QUIT
- End DoDot:2
- +82 QUIT
- End DoDot:1
- +83 ;
- +84 ;=== Store the result characteristics
- +85 if $DATA(@MAG8DST)>0
- Begin DoDot:1
- +86 ;--- Numbers of subscripts in the indexes
- +87 if FLAGS["C"
- SET @MAG8DST@("CPW")=7
- +88 if FLAGS["V"
- SET @MAG8DST@("PCVW")=10
- +89 if FLAGS["W"
- SET @MAG8DST@("PWC")=7
- +90 ;--- Number of fields in the data record
- +91 SET @MAG8DST@(0)=7
- +92 QUIT
- End DoDot:1
- +93 ;===
- +94 QUIT 0
- +95 ;
- +96 ;***** PRINTS THE WORKSTATION-CLIENT VERSION CHECK REPORT
- +97 ;
- +98 ; Input Variables
- +99 ; ===============
- +100 ; MAGSORT ; Sort mode for the report
- +101 ; MAGLLGDT ; Workstation Last Login date
- +102 ; MAGWNMB ; Workstation name contains
- +103 ;
- +104 ;
- +105 ; Notes
- +106 ; =====
- +107 ;
- +108 ; The ^TMP("MAGGTU42",$J) global node is used by this entry point to
- +109 ; store the raw report data.
- +110 ;
- WSCVCRPT ;
- +1 ; Current page number
- NEW MAGPAGE
- +2 ; Closed reference (name) of the raw report data
- NEW MAGRAW
- +3 ;
- +4 NEW RC
- +5 ; If the header is printed already
- NEW PRINTHDR
- +6 SET MAGRAW=$NAME(^TMP("MAGGTU42",$JOB))
- +7 SET (MAGPAGE,RC)=0
- +8 ;
- +9 Begin DoDot:1
- +10 NEW BUF,FLAGS,IQS,PLACE,XREF
- +11 SET FLAGS=$SELECT($GET(MAGSORT)'="":MAGSORT,1:"V")
- +12 SET MAGLLGDT=$SELECT($GET(MAGLLGDT)="":$PIECE($$FMADD^XLFDT($$NOW^XLFDT,-30),"."),1:MAGLLGDT)
- +13 SET MAGWNMB=$GET(MAGWNMB)
- +14 SET MAGALLW=$SELECT($GET(MAGALLW)="":"N",1:MAGALLW)
- +15 SET XREF=$SELECT(FLAGS="V":"PCVW",FLAGS="W":"PWC",1:"")
- +16 IF XREF=""
- SET RC=$$IPVE^MAGUERR("MAGSORT")
- QUIT
- +17 ;
- +18 ;=== Compile the list of workstations and clients
- +19 SET RC=$$WSCVCHCK(MAGRAW,FLAGS,"","",MAGLLGDT,MAGWNMB,MAGALLW)
- if RC<0
- QUIT
- +20 SET IQS=+$GET(@MAGRAW@(XREF))
- +21 IF IQS<0
- SET RC=$$ERROR^MAGUERR(-26,,$NAME(@MAGRAW@(XREF)))
- QUIT
- +22 ;
- +23 ;=== Print the report for each site
- +24 ; will print report header if there is no data to print
- SET PRINTHDR=1
- +25 SET PLACE=""
- SET $Y=0
- +26 FOR
- SET PLACE=$ORDER(@MAGRAW@(XREF,PLACE))
- if PLACE=""
- QUIT
- Begin DoDot:2
- +27 if $EXTRACT(IOST,1,2)="C-"
- WRITE @IOF
- +28 ;--- Print the header
- +29 SET PRINTHDR=0
- +30 DO PRTRHDR(MAGALLW,MAGLLGDT,MAGWNMB,IOM)
- +31 WRITE !,$$CJ^XLFSTR(PLACE,IOM),!
- +32 DO PRTBLH
- +33 ;--- Print the table
- +34 SET RC=$$PRINT($NAME(@MAGRAW@(XREF,PLACE)),IQS)
- if RC<0
- QUIT
- +35 ;--- Force the new page after the end of each section
- +36 SET RC=$$PAGE^MAGUTL05(1,1)
- if RC<0
- QUIT
- +37 QUIT
- End DoDot:2
- if RC<0
- QUIT
- +38 if PRINTHDR
- DO PRTRHDR(MAGALLW,MAGLLGDT,MAGWNMB,IOM)
- +39 SET BUF="Workstation(s) found: "_$PIECE(@MAGRAW@("TOTALS"),U)
- +40 WRITE !!,$$LJ^XLFSTR(BUF,IOM)
- +41 SET BUF="Workstation(s) to be updated: "_+$PIECE(@MAGRAW@("TOTALS"),U,2)
- +42 WRITE !,$$LJ^XLFSTR(BUF,IOM)
- +43 QUIT
- End DoDot:1
- +44 ;
- +45 ;=== Error handling and cleanup
- +46 if RC<-2
- DO ERROR(RC)
- DO ^%ZISC
- +47 if $DATA(ZTQUEUED)
- SET ZTREQ="@"
- +48 KILL @MAGRAW
- +49 QUIT
- +50 ;
- PRTRHDR(MAGALLW,MAGLLGDT,MAGWNMB,IOM) ;--- Print report the header
- +1 NEW BUF
- +2 SET BUF=$SELECT(MAGALLW:"LIST OF ALL WORKSTATIONS AND CLIENTS",1:"LIST OF WORKSTATIONS AND CLIENTS THAT HAVE TO BE UPDATED")
- +3 WRITE !,$$CJ^XLFSTR(BUF,IOM)
- +4 SET BUF="LAST LOGIN DATE: "_$$FMTE^XLFDT(MAGLLGDT)
- +5 SET BUF=BUF_$SELECT(MAGWNMB'="":" WS NAME CONTAINS: "_MAGWNMB,1:"")
- +6 WRITE !,$$CJ^XLFSTR(BUF,IOM)
- +7 WRITE !,$$CJ^XLFSTR($$REPEAT^XLFSTR("=",$LENGTH(BUF)),IOM)
- +8 QUIT