HMPPRXY2 ;ASMR/JCH,PB - Post-Install Routine to Create HMP User ; 02/01/16 11:56
 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Feb 03, 2015;Build 63
 ;Per VA Directive 6402, this routine should not be modified.
 ;
 ;Jan 29, 2016 - PB added code to add the APPLICATION PROXY user class to the HMP,APPLILCATION PROXY proxy account
 Q
 ;
POST ; Entry point for post install
 D BMES^XPDUTL("  Starting post-install")
 D ADDUSR
 Q
 ;
ADDUSR() ; FileMan calls to add user, update fields, update sub-files
 N DIC ; DIC(0) is required by the LAGYO code attached to NAME (#.01) field in NEW  PERSON (#200) file (see below)
 ;  NEW PERSON (#200 file :          ^DD(200,.01,"LAYGO",1,0)="D LAYGO^XUA4A7"
 ;  Routine XUA4A7 :        LAYGO    ;Called from ^DD(200,.01,"LAYGO",1,0)
 ;                                   Q:DIC(0)'["E"
 N FDA ; The name of the root of a VA FileMan Data Array, which describes the entries to add to the database.
 N ERR ; Array containing error messages.
 N HMPERTXT ; Array containing generic user message text indicating fields/files that were not updated
 N USRIEN ; The Internal Entry Number (IEN) of the 
 N FDAIEN ; The IEN of HMP,APPLICATION PROXY user found in the NEW PERSON (#200) file
 N HMPERR ; The full reference to each ERR error node, including the array with subscripts and data (i.e., ERR("DIERR",1,"TEXT")="Error Message")
 ;
 ; Add new user to ^VA(200
 S DIC(0)="" ; Define DIC(0) so DD(200,.01,"LAGYO" code doesn't blow up (LAYGO^XUA4A7)
 S FDA(200,"?+1,",.01)="HMP,APPLICATION PROXY"
 D UPDATE^DIE("E","FDA","FDAIEN","ERR")
 ; Quit if user not added
 S USRIEN=$G(FDAIEN(1))
 I '$G(USRIEN) D  Q
 .D BMES^XPDUTL("HMP,APPLICATION PROXY user not added")
 .I $D(ERR) D ERROUT(.ERR)
 ;
 S HMPERTXT=$S($G(FDAIEN(1,0))="?":"User HMP,APPLICATION PROXY already on file.",$G(FDAIEN(1,0))="+":"User HMP,APPLICATION PROXY added",1:"")
 D BMES^XPDUTL(HMPERTXT)
 ;
 ; Add fields for new user file entry
 K FDA,ERR
 S FDA(200,USRIEN_",",1)="PU"                ; Initials
 S FDA(200,USRIEN_",",7.2)="Y"
 S FDA(200,USRIEN_",",20.2)="HMPPROXY USER"  ; Signature Block
 S FDA(200,USRIEN_",",101.01)="NO"           ; Restrict Patient Selection
 S FDA(200,USRIEN_",",201)="XMUSER"             ; Primary Menu Option
 D FILE^DIE("E","FDA","ERR")
 ;
 ;  display progress (Data is refiled each time post-install is run - updated message will display each time)
 K HMPERTXT
 S HMPERTXT(1)="The following HMP,APPLICATION PROXY fields were "_$S($D(ERR):"NOT updated: ",1:"updated: ")
 S HMPERTXT(2)="INITIALS, ACCESS CODE, SIGNATURE BLOCK, RESTRICT PATIENT SELECTION, PRIMARY MENU OPTION"
 D BMES^XPDUTL(.HMPERTXT)
 ;
 ; If failure, provide details
 I $D(ERR) D ERROUT(.ERR)
 ;
 ; Update sub-files for new user file entry
 K FDA,ERR
 S FDA(200.051,"?+1,"_USRIEN_",",.01)="HMP ADMIN"
 S FDA(200.051,"?+2,"_USRIEN_",",.01)="PROVIDER"
 S FDA(200.010113,"?+3,"_USRIEN_",",.01)="COR"
 S FDA(200.03,"?+5,"_USRIEN_",",.01)="HMP UI CONTEXT"
 S FDA(200.03,"?+6,"_USRIEN_",",.01)="HMP SYNCHRONIZATION CONTEXT"
 D UPDATE^DIE("E","FDA",,"ERR")
 ;
 ; It's an all or nothing transaction - display progress (Data is refiled each time post-install is run - updated message will display each time)
 K HMPERTXT
 S HMPERTXT(1)="The following sub-files for user HMP,APPLICATION PROXY were "_$S($D(ERR):"NOT updated: ",1:"updated: ")
 S HMPERTXT(2)="  KEYS, CPRS TAB, SECONDARY MENU OPTIONS"
 D BMES^XPDUTL(.HMPERTXT)
 ; 
 ; If failure, provide details
 I $D(ERR) D ERROUT(.ERR)
 ;
 ;JAN 29, 2016 - PB - Add User Class, APPLICATION PROXY to the HMP,APPLICATION PROXY account
 ;get pointers for classes in file 201
 K FDA,ERR
 S FDA(200.07,"?+1,"_USRIEN_",",.01)="APPLICATION PROXY"
 S FDA(200.07,"?+1,"_USRIEN_",",2)="1"
 D UPDATE^DIE("E","FDA",,"ERR")
 ;if user class, APPLICATION PROXY is not added notify users
 K HMPERTXT
 S HMPERTXT(1)="The following sub-files for user HMP,APPLICATION PROXY were "_$S($D(ERR):"NOT updated: ",1:"updated: ")
 S HMPERTXT(2)="  User Class - APPLICATION PROXY"
 D BMES^XPDUTL(.HMPERTXT)
 Q
 ;end changes to add user classes to the HMP,APPLICATION PROXY proxy user account.
 ;
ERROUT(ERR) ; Output ERR array
 D BMES^XPDUTL("Error Details:")
 S HMPERR="ERR(""DIERR"")" F  S HMPERR=$Q(@HMPERR) Q:HMPERR=""  D MES^XPDUTL(HMPERR_"="_@HMPERR)
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPPRXY2   4356     printed  Sep 23, 2025@19:30:32                                                                                                                                                                                                    Page 2
HMPPRXY2  ;ASMR/JCH,PB - Post-Install Routine to Create HMP User ; 02/01/16 11:56
 +1       ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Feb 03, 2015;Build 63
 +2       ;Per VA Directive 6402, this routine should not be modified.
 +3       ;
 +4       ;Jan 29, 2016 - PB added code to add the APPLICATION PROXY user class to the HMP,APPLILCATION PROXY proxy account
 +5        QUIT 
 +6       ;
POST      ; Entry point for post install
 +1        DO BMES^XPDUTL("  Starting post-install")
 +2        DO ADDUSR
 +3        QUIT 
 +4       ;
ADDUSR()  ; FileMan calls to add user, update fields, update sub-files
 +1       ; DIC(0) is required by the LAGYO code attached to NAME (#.01) field in NEW  PERSON (#200) file (see below)
           NEW DIC
 +2       ;  NEW PERSON (#200 file :          ^DD(200,.01,"LAYGO",1,0)="D LAYGO^XUA4A7"
 +3       ;  Routine XUA4A7 :        LAYGO    ;Called from ^DD(200,.01,"LAYGO",1,0)
 +4       ;                                   Q:DIC(0)'["E"
 +5       ; The name of the root of a VA FileMan Data Array, which describes the entries to add to the database.
           NEW FDA
 +6       ; Array containing error messages.
           NEW ERR
 +7       ; Array containing generic user message text indicating fields/files that were not updated
           NEW HMPERTXT
 +8       ; The Internal Entry Number (IEN) of the 
           NEW USRIEN
 +9       ; The IEN of HMP,APPLICATION PROXY user found in the NEW PERSON (#200) file
           NEW FDAIEN
 +10      ; The full reference to each ERR error node, including the array with subscripts and data (i.e., ERR("DIERR",1,"TEXT")="Error Message")
           NEW HMPERR
 +11      ;
 +12      ; Add new user to ^VA(200
 +13      ; Define DIC(0) so DD(200,.01,"LAGYO" code doesn't blow up (LAYGO^XUA4A7)
           SET DIC(0)=""
 +14       SET FDA(200,"?+1,",.01)="HMP,APPLICATION PROXY"
 +15       DO UPDATE^DIE("E","FDA","FDAIEN","ERR")
 +16      ; Quit if user not added
 +17       SET USRIEN=$GET(FDAIEN(1))
 +18       IF '$GET(USRIEN)
               Begin DoDot:1
 +19               DO BMES^XPDUTL("HMP,APPLICATION PROXY user not added")
 +20               IF $DATA(ERR)
                       DO ERROUT(.ERR)
               End DoDot:1
               QUIT 
 +21      ;
 +22       SET HMPERTXT=$SELECT($GET(FDAIEN(1,0))="?":"User HMP,APPLICATION PROXY already on file.",$GET(FDAIEN(1,0))="+":"User HMP,APPLICATION PROXY added",1:"")
 +23       DO BMES^XPDUTL(HMPERTXT)
 +24      ;
 +25      ; Add fields for new user file entry
 +26       KILL FDA,ERR
 +27      ; Initials
           SET FDA(200,USRIEN_",",1)="PU"
 +28       SET FDA(200,USRIEN_",",7.2)="Y"
 +29      ; Signature Block
           SET FDA(200,USRIEN_",",20.2)="HMPPROXY USER"
 +30      ; Restrict Patient Selection
           SET FDA(200,USRIEN_",",101.01)="NO"
 +31      ; Primary Menu Option
           SET FDA(200,USRIEN_",",201)="XMUSER"
 +32       DO FILE^DIE("E","FDA","ERR")
 +33      ;
 +34      ;  display progress (Data is refiled each time post-install is run - updated message will display each time)
 +35       KILL HMPERTXT
 +36       SET HMPERTXT(1)="The following HMP,APPLICATION PROXY fields were "_$SELECT($DATA(ERR):"NOT updated: ",1:"updated: ")
 +37       SET HMPERTXT(2)="INITIALS, ACCESS CODE, SIGNATURE BLOCK, RESTRICT PATIENT SELECTION, PRIMARY MENU OPTION"
 +38       DO BMES^XPDUTL(.HMPERTXT)
 +39      ;
 +40      ; If failure, provide details
 +41       IF $DATA(ERR)
               DO ERROUT(.ERR)
 +42      ;
 +43      ; Update sub-files for new user file entry
 +44       KILL FDA,ERR
 +45       SET FDA(200.051,"?+1,"_USRIEN_",",.01)="HMP ADMIN"
 +46       SET FDA(200.051,"?+2,"_USRIEN_",",.01)="PROVIDER"
 +47       SET FDA(200.010113,"?+3,"_USRIEN_",",.01)="COR"
 +48       SET FDA(200.03,"?+5,"_USRIEN_",",.01)="HMP UI CONTEXT"
 +49       SET FDA(200.03,"?+6,"_USRIEN_",",.01)="HMP SYNCHRONIZATION CONTEXT"
 +50       DO UPDATE^DIE("E","FDA",,"ERR")
 +51      ;
 +52      ; It's an all or nothing transaction - display progress (Data is refiled each time post-install is run - updated message will display each time)
 +53       KILL HMPERTXT
 +54       SET HMPERTXT(1)="The following sub-files for user HMP,APPLICATION PROXY were "_$SELECT($DATA(ERR):"NOT updated: ",1:"updated: ")
 +55       SET HMPERTXT(2)="  KEYS, CPRS TAB, SECONDARY MENU OPTIONS"
 +56       DO BMES^XPDUTL(.HMPERTXT)
 +57      ; 
 +58      ; If failure, provide details
 +59       IF $DATA(ERR)
               DO ERROUT(.ERR)
 +60      ;
 +61      ;JAN 29, 2016 - PB - Add User Class, APPLICATION PROXY to the HMP,APPLICATION PROXY account
 +62      ;get pointers for classes in file 201
 +63       KILL FDA,ERR
 +64       SET FDA(200.07,"?+1,"_USRIEN_",",.01)="APPLICATION PROXY"
 +65       SET FDA(200.07,"?+1,"_USRIEN_",",2)="1"
 +66       DO UPDATE^DIE("E","FDA",,"ERR")
 +67      ;if user class, APPLICATION PROXY is not added notify users
 +68       KILL HMPERTXT
 +69       SET HMPERTXT(1)="The following sub-files for user HMP,APPLICATION PROXY were "_$SELECT($DATA(ERR):"NOT updated: ",1:"updated: ")
 +70       SET HMPERTXT(2)="  User Class - APPLICATION PROXY"
 +71       DO BMES^XPDUTL(.HMPERTXT)
 +72       QUIT 
 +73      ;end changes to add user classes to the HMP,APPLICATION PROXY proxy user account.
 +74      ;
ERROUT(ERR) ; Output ERR array
 +1        DO BMES^XPDUTL("Error Details:")
 +2        SET HMPERR="ERR(""DIERR"")"
           FOR 
               SET HMPERR=$QUERY(@HMPERR)
               if HMPERR=""
                   QUIT 
               DO MES^XPDUTL(HMPERR_"="_@HMPERR)
 +3        QUIT