MAGIP278 ;WOIFO/DAC - Install code for MAG*3.0*278 ; Oct 06, 2021@13:54:20
 ;;3.0;IMAGING;**278**;Mar 19, 2002;Build 138
 ;; Per VA Directive 6402, 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.                     |
 ;; +---------------------------------------------------------------+
 ;;
 ; There are no environment checks here but the MAGIP278 has to be
 ; referenced by the "Environment Check Routine" field of the KIDS
 ; build so that entry points of the routine are available to the
 ; KIDS during all installation phases.
 Q
 ;
 ;+++++ INSTALLATION ERROR HANDLING
ERROR ; Error handling
 S:$D(XPDNM) XPDABORT=1
 ;--- Display the messages and store them to the INSTALL file
 D DUMP^MAGUERR1(),ABTMSG^MAGKIDS()
 Q
 ;
 ;***** POST-INSTALL CODE
POS ; Post-Install
 ;
 D QUE
 ;
 D ATTACH
 D SYN
 Q
 ;
QUE ; Que post install
 N NAMSP,PATCH,JOBN,ZTSK,ZTRTN,ZTIO,ZTDTH,ZTDESC,Y,ZTQUEUED,ZTREQ,ZTSAVE,CNT,PSJCNT,SBJM,RESTART,SMSG
 S NAMSP="MAGVCLN"
 S JOBN="MAG*3.0*278 Post Install"
 S PATCH="MAG*3.0*278"
 S Y=$$NOW^XLFDT S ZTDTH=$$FMTH^XLFDT(Y)
 ;
 S ZTRTN="QUE^"_NAMSP,ZTIO=""
 S (SBJM,ZTDESC)="Background job for "_JOBN
 S ZTSAVE("JOBN")="",ZTSAVE("ZTDTH")="",ZTSAVE("DUZ")="",ZTSAVE("SBJM")=""
 D ^%ZTLOAD
 D:$D(ZTSK)
 . N POSTEXT
 . S POSTEXT(1)="A MailMan message will be sent to the installer and the"
 . S POSTEXT(2)="MAG SERVER mail group upon Post Install Completion"
 . S POSTEXT(3)="*** Task #"_ZTSK_" Queued! ***"
 . D MES^XPDUTL(.POSTEXT)
 . S ZTSAVE("ZTSK")=""
 ;
 ;--- Send the notification e-mail
 D BMES^XPDUTL("Post Install Mail Message: "_$$FMTE^XLFDT($$NOW^XLFDT))
 D INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
 K XPDQUES
 Q
 ;
 ;
ATTACH ; Attach options to PSO EPCS UTILITY menu
 N MENU,OPTION,CHECK,SYN
 S MENU="MAGV HDIG MENU"
 F OPTION="MAGV SEARCH PROBLEMS","MAGV RESOLVE PROBLEMS"  D
 . S SYN=$S(OPTION["SEARCH":"SRPR",1:"VRPR")
 . S CHECK=$$ADD^XPDMENU(MENU,OPTION,SYN)
 . D BMES^XPDUTL(">>> "_OPTION_" Option"_$S('CHECK:" NOT added to "_MENU,1:" added to "_MENU)_" <<<")
 Q
 ;
SYN ; Add Synonyms to Menu
 N MENUIEN
 S MENUIEN=$$FIND1^DIC(19,,"BX","MAGV HDIG MENU")
 I MENUIEN D
 . N IENS,MAGERR,ITEMIEN,FDA
 . S ITEMIEN=$$FIND1^DIC(19.01,","_MENUIEN_",",,"MAGV SEARCH PROBLEMS")
 . Q:'ITEMIEN
 . S IENS=ITEMIEN_","_MENUIEN_","
 . S FDA(19.01,IENS,2)="SRPR"
 . D FILE^DIE(,"FDA","MAGERR")
 . ;
 . K IENS,MAGERR,ITEMIEN
 . S ITEMIEN=$$FIND1^DIC(19.01,","_MENUIEN_",",,"MAGV RESOLVE PROBLEMS")
 . Q:'ITEMIEN
 . S IENS=ITEMIEN_","_MENUIEN_","
 . S FDA(19.01,IENS,2)="VRPR"
 . D FILE^DIE(,"FDA","MAGERR")
 ;
 Q
 ;
 ;***** PRE-INSTALL CODE
PRE ; Pre-Install
 N DIU,MAGFLD,MAGERR,MAGOPTID,MAGOPTDE,DA
 S MAGOPTID=$$FIND1^DIC(19,,"X","MAGV IDENTIFY DUPLICATES")
 S MAGOPTDE=$$FIND1^DIC(19,,"X","MAGV DELETE DUPLICATES")
 ; Delete Obsolete Options if they exist
 I MAGOPTID D
 . N MAGVRMI,DIK
 . S MAGVRMI=$$DELETE^XPDMENU("MAGV HDIG MENU","MAGV IDENTIFY DUPLICATES")
 . I MAGVRMI S DIK="^DIC(19,",DA=+$G(MAGOPTID) D ^DIK
 I MAGOPTDE D
 . N MAGVRMD,DIK
 . S MAGVRMD=$$DELETE^XPDMENU("MAGV HDIG MENU","MAGV DELETE DUPLICATES")
 . I MAGVRMD S DIK="^DIC(19,",DA=+$G(MAGOPTID) D ^DIK
 D FIELD^DID(2005.67,.01,,"LABEL","MAGFLD","MAGERR")
 ; If old DD exists, remove it
 I $G(MAGFLD("LABEL"))="DUPLICATE IEN" D
 . S DIU(0)="D",DIU="^MAGV(2005.67," D EN^DIU2
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGIP278   4196     printed  Sep 23, 2025@19:41:41                                                                                                                                                                                                    Page 2
MAGIP278  ;WOIFO/DAC - Install code for MAG*3.0*278 ; Oct 06, 2021@13:54:20
 +1       ;;3.0;IMAGING;**278**;Mar 19, 2002;Build 138
 +2       ;; Per VA Directive 6402, 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      ; There are no environment checks here but the MAGIP278 has to be
 +18      ; referenced by the "Environment Check Routine" field of the KIDS
 +19      ; build so that entry points of the routine are available to the
 +20      ; KIDS during all installation phases.
 +21       QUIT 
 +22      ;
 +23      ;+++++ INSTALLATION ERROR HANDLING
ERROR     ; Error handling
 +1        if $DATA(XPDNM)
               SET XPDABORT=1
 +2       ;--- Display the messages and store them to the INSTALL file
 +3        DO DUMP^MAGUERR1()
           DO ABTMSG^MAGKIDS()
 +4        QUIT 
 +5       ;
 +6       ;***** POST-INSTALL CODE
POS       ; Post-Install
 +1       ;
 +2        DO QUE
 +3       ;
 +4        DO ATTACH
 +5        DO SYN
 +6        QUIT 
 +7       ;
QUE       ; Que post install
 +1        NEW NAMSP,PATCH,JOBN,ZTSK,ZTRTN,ZTIO,ZTDTH,ZTDESC,Y,ZTQUEUED,ZTREQ,ZTSAVE,CNT,PSJCNT,SBJM,RESTART,SMSG
 +2        SET NAMSP="MAGVCLN"
 +3        SET JOBN="MAG*3.0*278 Post Install"
 +4        SET PATCH="MAG*3.0*278"
 +5        SET Y=$$NOW^XLFDT
           SET ZTDTH=$$FMTH^XLFDT(Y)
 +6       ;
 +7        SET ZTRTN="QUE^"_NAMSP
           SET ZTIO=""
 +8        SET (SBJM,ZTDESC)="Background job for "_JOBN
 +9        SET ZTSAVE("JOBN")=""
           SET ZTSAVE("ZTDTH")=""
           SET ZTSAVE("DUZ")=""
           SET ZTSAVE("SBJM")=""
 +10       DO ^%ZTLOAD
 +11       if $DATA(ZTSK)
               Begin DoDot:1
 +12               NEW POSTEXT
 +13               SET POSTEXT(1)="A MailMan message will be sent to the installer and the"
 +14               SET POSTEXT(2)="MAG SERVER mail group upon Post Install Completion"
 +15               SET POSTEXT(3)="*** Task #"_ZTSK_" Queued! ***"
 +16               DO MES^XPDUTL(.POSTEXT)
 +17               SET ZTSAVE("ZTSK")=""
               End DoDot:1
 +18      ;
 +19      ;--- Send the notification e-mail
 +20       DO BMES^XPDUTL("Post Install Mail Message: "_$$FMTE^XLFDT($$NOW^XLFDT))
 +21       DO INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
 +22       KILL XPDQUES
 +23       QUIT 
 +24      ;
 +25      ;
ATTACH    ; Attach options to PSO EPCS UTILITY menu
 +1        NEW MENU,OPTION,CHECK,SYN
 +2        SET MENU="MAGV HDIG MENU"
 +3        FOR OPTION="MAGV SEARCH PROBLEMS","MAGV RESOLVE PROBLEMS"
               Begin DoDot:1
 +4                SET SYN=$SELECT(OPTION["SEARCH":"SRPR",1:"VRPR")
 +5                SET CHECK=$$ADD^XPDMENU(MENU,OPTION,SYN)
 +6                DO BMES^XPDUTL(">>> "_OPTION_" Option"_$SELECT('CHECK:" NOT added to "_MENU,1:" added to "_MENU)_" <<<")
               End DoDot:1
 +7        QUIT 
 +8       ;
SYN       ; Add Synonyms to Menu
 +1        NEW MENUIEN
 +2        SET MENUIEN=$$FIND1^DIC(19,,"BX","MAGV HDIG MENU")
 +3        IF MENUIEN
               Begin DoDot:1
 +4                NEW IENS,MAGERR,ITEMIEN,FDA
 +5                SET ITEMIEN=$$FIND1^DIC(19.01,","_MENUIEN_",",,"MAGV SEARCH PROBLEMS")
 +6                if 'ITEMIEN
                       QUIT 
 +7                SET IENS=ITEMIEN_","_MENUIEN_","
 +8                SET FDA(19.01,IENS,2)="SRPR"
 +9                DO FILE^DIE(,"FDA","MAGERR")
 +10      ;
 +11               KILL IENS,MAGERR,ITEMIEN
 +12               SET ITEMIEN=$$FIND1^DIC(19.01,","_MENUIEN_",",,"MAGV RESOLVE PROBLEMS")
 +13               if 'ITEMIEN
                       QUIT 
 +14               SET IENS=ITEMIEN_","_MENUIEN_","
 +15               SET FDA(19.01,IENS,2)="VRPR"
 +16               DO FILE^DIE(,"FDA","MAGERR")
               End DoDot:1
 +17      ;
 +18       QUIT 
 +19      ;
 +20      ;***** PRE-INSTALL CODE
PRE       ; Pre-Install
 +1        NEW DIU,MAGFLD,MAGERR,MAGOPTID,MAGOPTDE,DA
 +2        SET MAGOPTID=$$FIND1^DIC(19,,"X","MAGV IDENTIFY DUPLICATES")
 +3        SET MAGOPTDE=$$FIND1^DIC(19,,"X","MAGV DELETE DUPLICATES")
 +4       ; Delete Obsolete Options if they exist
 +5        IF MAGOPTID
               Begin DoDot:1
 +6                NEW MAGVRMI,DIK
 +7                SET MAGVRMI=$$DELETE^XPDMENU("MAGV HDIG MENU","MAGV IDENTIFY DUPLICATES")
 +8                IF MAGVRMI
                       SET DIK="^DIC(19,"
                       SET DA=+$GET(MAGOPTID)
                       DO ^DIK
               End DoDot:1
 +9        IF MAGOPTDE
               Begin DoDot:1
 +10               NEW MAGVRMD,DIK
 +11               SET MAGVRMD=$$DELETE^XPDMENU("MAGV HDIG MENU","MAGV DELETE DUPLICATES")
 +12               IF MAGVRMD
                       SET DIK="^DIC(19,"
                       SET DA=+$GET(MAGOPTID)
                       DO ^DIK
               End DoDot:1
 +13       DO FIELD^DID(2005.67,.01,,"LABEL","MAGFLD","MAGERR")
 +14      ; If old DD exists, remove it
 +15       IF $GET(MAGFLD("LABEL"))="DUPLICATE IEN"
               Begin DoDot:1
 +16               SET DIU(0)="D"
                   SET DIU="^MAGV(2005.67,"
                   DO EN^DIU2
               End DoDot:1
 +17       QUIT