DVBA2845 ;BPFO/MM - PATCH DVBA*2.7*145 INSTALL UTILITIES;5/5/2009
;;2.7;AMIE;**145**;Apr 10, 1995;Build 33
;
PRE ;Pre-install entry point.
;
;Used to disable older versions of a template for those templates being
;exported with the patch.
; - Make sure to call the DISABLE procedure for each template name
; being exported in the patch.
; - This must be called as a pre-init or else it will disable the
; templates that are being loaded by the patch.
;
N DVBVERSS,DVBVERSN,DVBACTR
;
;what the template version will be in the incoming patch
;(version pulled from export account)
S DVBVERSS="145F"
;what the final template version should be once the template is
;loaded by the patch on the target system
S DVBVERSN="145"
S DVBACTR=0
;
D BMES^XPDUTL("**** PRE-INSTALL PROCESSING ****")
D BMES^XPDUTL("Disabling templates...")
D MES^XPDUTL(" ")
;
D DISABLE("DICTATION")
;
D BMES^XPDUTL(" Number of templates disabled: "_DVBACTR)
Q
;
POST ;Post-install entry point.
;
;Used to rename templates that were loaded by the patch.
; - Make sure to call POSTP procedure for each template
; name being loaded by the patch.
; - Must be called as a post-init in order to rename those
; templates being loaded by the patch.
;
N DVBVERSS,DVBVERSN,DVBACTR
;
;what the template version will be in the incoming patch
;(version pulled from export account)
S DVBVERSS="145F"
;what the final template version should be once the template is
;loaded by the patch on the target system
S DVBVERSN="145"
S DVBACTR=0
;
D BMES^XPDUTL("**** POST-INSTALL PROCESSING ****")
D BMES^XPDUTL("Activating templates...")
D MES^XPDUTL(" ")
;
D POSTP("DICTATION")
;
;re-build cross references
;D RBXREF
;
D BMES^XPDUTL(" Number of templates activated: "_DVBACTR)
Q
;
POSTP(NM) ;Rename templates loaded by the patch.
;
;This procedure is used to lookup and rename a template in the
;CAPRI TEMPLATE DEFINITIONS (#396.18) file. This is done to rename
;the imported version of a template (i.e. ACROMEGALY~145F) to it's
;new name/version (i.e. ACROMEGALY~145T6).
;
N DVBABIEN,DVBABIE2 ;ien of CAPRI TEMPLATE DEFINITIONS file
N DVBABST ;template NAME field (i.e. ACROMEGALY~145F)
N DVBABS2 ;template NAME field (i.e. ACROMEGALY~145T6)
N DVBACH ;flag to indicate if template version is found or not
N DVBAFDA ;FDA array for FILE^DIE
N DVBAERR ;Error array for FILE^DIE
N DVBAMSG,DVBAMSG1 ;Used to write message to installer/Install file entry
N DVBAADT ;Template activation date
;
S DVBABIEN=0
;
;main loop-walk through CAPRI TEMPLATE DEFINITIONS file entries
F S DVBABIEN=$O(^DVB(396.18,DVBABIEN)) Q:'DVBABIEN D
.S DVBABST=$P($G(^DVB(396.18,DVBABIEN,0)),"^",1) ;template name
.;look for template versions just loaded by the patch (~145F)
.I $P(DVBABST,"~",1)=NM I $P(DVBABST,"~",2)=DVBVERSS D
..S DVBABIE2=0,DVBACH=0
..;secondary loop-walk through CAPRI TEMPLATE DEFINITIONS file entries
..F S DVBABIE2=$O(^DVB(396.18,DVBABIE2)) Q:'DVBABIE2 D
...S DVBABS2=$P($G(^DVB(396.18,DVBABIE2,0)),"^",1) ;template name
...;if new version of template already exists in file, set flag
...I $P(DVBABS2,"~",1)=NM I $P(DVBABS2,"~",2)=DVBVERSN S DVBACH=1
..;if new version already exists, delete the imported version (abort rename)
..I DVBACH=1 D
...;Beginning with DVBA*2.7*139, use FILE^DIE to delete duplicate record.
...;D MES^XPDUTL(" Found existing "_NM_". No modifications made.")
...;K ^DVB(396.18,DVBABIEN)
...S DVBAMSG=" Found existing "_NM_". No modifications made."
...S DVBAFDA(396.18,DVBABIEN_",",.01)="@"
...D FILE^DIE("","DVBAFDA","DVBAERR")
..;otherwise, if new version isn't found, rename imported template
..;name to the new version name (i.e. ACROMEGALY~145F --> ACROMEGALY~145t6)
..I DVBACH=0 D
...;Beginning with DVBA*2.7*139, use FILE^DIE to update Name field.
...;Added update to Activation Date field in DVBA*2.7*139.
...;S $P(^DVB(396.18,DVBABIEN,0),"^",1)=NM_"~"_DVBVERSN
...;D MES^XPDUTL(" Activated: "_$P($G(^DVB(396.18,DVBABIEN,0)),"^",1))
...S DVBAADT=$P($G(^DVB(396.18,DVBABIEN,2)),"^")
...S DVBACTR=DVBACTR+1
...S DVBAFDA(396.18,DVBABIEN_",",.01)=NM_"~"_DVBVERSN
...I DVBAADT=""!(DVBAADT<DT) S DVBAFDA(396.18,DVBABIEN_",",2)=DT
...D FILE^DIE("","DVBAFDA","DVBAERR")
...S DVBAMSG=" Activating: "_$P($G(^DVB(396.18,DVBABIEN,0)),"^",1)
..D MES^XPDUTL(DVBAMSG)
..I $D(DVBAERR) D
...D MSG^DIALOG("AE",.DVBAMSG1,"","","DVBAERR")
...D MES^XPDUTL(.DVBAMSG1)
;
K DVBABIEN,DVBABST,DVBACH
Q
;
RBXREF ;Rebuild cross-references in (#396.18) file.
;
;Changes were made in DVBA*2.7*145 to use Fileman APIs to update
;the entries in the CAPRI TEMPLATE DEFINITIONS (#396.18) file.
;Do not need to re-index the "B" and "AV" cross references.
;
D BMES^XPDUTL("Cleaning up files and rebuilding 2 cross-references.")
D MES^XPDUTL("This may take a few minutes.")
;
;XRef: B
D BMES^XPDUTL(" Rebuilding 'B' x-ref, CAPRI TEMPLATE DEFINITIONS file")
N DA,DIK,REGIEN,ROOT
S ROOT=$$ROOT^DILFD(396.18,,1) K @ROOT@("B")
S REGIEN=0
F S REGIEN=$O(@ROOT@(REGIEN)) Q:'REGIEN D
. S DIK=$$ROOT^DILFD(396.18,","_REGIEN_","),DIK(1)=".01^B"
. S DA(1)=REGIEN D ENALL^DIK
;
;XRef: AV
D MES^XPDUTL(" Rebuilding 'AV' x-ref, CAPRI TEMPLATE DEFINITIONS file")
N DA,DIK,REGIEN,ROOT
S ROOT=$$ROOT^DILFD(396.18,,1) K @ROOT@("AV")
S REGIEN=0
F S REGIEN=$O(@ROOT@(REGIEN)) Q:'REGIEN D
. S DIK=$$ROOT^DILFD(396.18,","_REGIEN_","),DIK(1)=".01^AV"
. S DA(1)=REGIEN D ENALL^DIK
;
K DA,DIK,REGIEN,ROOT
Q
;
DISABLE(NM) ;Disable matching exam template entries.
;
;This procedure will find each entry in the CAPRI TEMPLATE DEFINITIONS
;(#396.18) file that matches the name (NM) of the template being exported.
;Once a matching entry is found, it will be disabled if the version
;suffix (i.e. ~145T5) does not match the version suffix that will be used
;for templates loaded by the patch on the target system (i.e. ~145T6).
;
;An entry will be disabled by doing the following:
; - Turning off the SELECTABLE BY USER? field. This will keep the entry
; from showing in the CAPRI GUI template list.
; - Looking at DE-ACTIVATION DATE field. If there's no date, set it to today.
;
N DVBABIEN ;ien of CAPRI TEMPLATE DEFINITIONS file
N DVBABST ;template NAME field (i.e. ACROMEGALY~145T5)
N DVBACH ;flag used to indicate template was disabled
N DVBAFDA ;FDA array for FILE^DIE
N DVBAERR ;Error array for FILE^DIE
N DVBAMSG1 ;Used to write message to installer/Install file entry
;
S DVBABIEN=0
;
;walk through CAPRI TEMPLATE DEFINITIONS file entries
F S DVBABIEN=$O(^DVB(396.18,DVBABIEN)) Q:'DVBABIEN D
.S DVBABST=$P($G(^DVB(396.18,DVBABIEN,0)),"^",1) ;template name
.;if name matches and version is different, then disable entry
.I $P(DVBABST,"~",1)=NM I $P(DVBABST,"~",2)'=DVBVERSN D
..S DVBACH=0
..;turn SELECTABLE BY USER (#7) field off
..I $P($G(^DVB(396.18,DVBABIEN,6)),"^",1)'="0" S DVBAFDA(396.18,DVBABIEN_",",7)="0",DVBACH=1
..;set DE-ACTIVATION DATE (#3) field to TODAY
..I $P($G(^DVB(396.18,DVBABIEN,2)),"^",2)="" S DVBAFDA(396.18,DVBABIEN_",",3)=DT,DVBACH=1
..;output list of disabled templates
..I DVBACH=1 D
...S DVBACTR=DVBACTR+1
...D FILE^DIE("","DVBAFDA","DVBAERR")
...D MES^XPDUTL(" Disabling: "_DVBABST)
...I $D(DVBAERR) D
....D MSG^DIALOG("AE",.DVBAMSG1,"","","DVBAERR")
....D MES^XPDUTL(.DVBAMSG1)
;
K DVBABIEN,DVBABST,DVBACH
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBA2845 7604 printed Oct 16, 2024@17:40:52 Page 2
DVBA2845 ;BPFO/MM - PATCH DVBA*2.7*145 INSTALL UTILITIES;5/5/2009
+1 ;;2.7;AMIE;**145**;Apr 10, 1995;Build 33
+2 ;
PRE ;Pre-install entry point.
+1 ;
+2 ;Used to disable older versions of a template for those templates being
+3 ;exported with the patch.
+4 ; - Make sure to call the DISABLE procedure for each template name
+5 ; being exported in the patch.
+6 ; - This must be called as a pre-init or else it will disable the
+7 ; templates that are being loaded by the patch.
+8 ;
+9 NEW DVBVERSS,DVBVERSN,DVBACTR
+10 ;
+11 ;what the template version will be in the incoming patch
+12 ;(version pulled from export account)
+13 SET DVBVERSS="145F"
+14 ;what the final template version should be once the template is
+15 ;loaded by the patch on the target system
+16 SET DVBVERSN="145"
+17 SET DVBACTR=0
+18 ;
+19 DO BMES^XPDUTL("**** PRE-INSTALL PROCESSING ****")
+20 DO BMES^XPDUTL("Disabling templates...")
+21 DO MES^XPDUTL(" ")
+22 ;
+23 DO DISABLE("DICTATION")
+24 ;
+25 DO BMES^XPDUTL(" Number of templates disabled: "_DVBACTR)
+26 QUIT
+27 ;
POST ;Post-install entry point.
+1 ;
+2 ;Used to rename templates that were loaded by the patch.
+3 ; - Make sure to call POSTP procedure for each template
+4 ; name being loaded by the patch.
+5 ; - Must be called as a post-init in order to rename those
+6 ; templates being loaded by the patch.
+7 ;
+8 NEW DVBVERSS,DVBVERSN,DVBACTR
+9 ;
+10 ;what the template version will be in the incoming patch
+11 ;(version pulled from export account)
+12 SET DVBVERSS="145F"
+13 ;what the final template version should be once the template is
+14 ;loaded by the patch on the target system
+15 SET DVBVERSN="145"
+16 SET DVBACTR=0
+17 ;
+18 DO BMES^XPDUTL("**** POST-INSTALL PROCESSING ****")
+19 DO BMES^XPDUTL("Activating templates...")
+20 DO MES^XPDUTL(" ")
+21 ;
+22 DO POSTP("DICTATION")
+23 ;
+24 ;re-build cross references
+25 ;D RBXREF
+26 ;
+27 DO BMES^XPDUTL(" Number of templates activated: "_DVBACTR)
+28 QUIT
+29 ;
POSTP(NM) ;Rename templates loaded by the patch.
+1 ;
+2 ;This procedure is used to lookup and rename a template in the
+3 ;CAPRI TEMPLATE DEFINITIONS (#396.18) file. This is done to rename
+4 ;the imported version of a template (i.e. ACROMEGALY~145F) to it's
+5 ;new name/version (i.e. ACROMEGALY~145T6).
+6 ;
+7 ;ien of CAPRI TEMPLATE DEFINITIONS file
NEW DVBABIEN,DVBABIE2
+8 ;template NAME field (i.e. ACROMEGALY~145F)
NEW DVBABST
+9 ;template NAME field (i.e. ACROMEGALY~145T6)
NEW DVBABS2
+10 ;flag to indicate if template version is found or not
NEW DVBACH
+11 ;FDA array for FILE^DIE
NEW DVBAFDA
+12 ;Error array for FILE^DIE
NEW DVBAERR
+13 ;Used to write message to installer/Install file entry
NEW DVBAMSG,DVBAMSG1
+14 ;Template activation date
NEW DVBAADT
+15 ;
+16 SET DVBABIEN=0
+17 ;
+18 ;main loop-walk through CAPRI TEMPLATE DEFINITIONS file entries
+19 FOR
SET DVBABIEN=$ORDER(^DVB(396.18,DVBABIEN))
if 'DVBABIEN
QUIT
Begin DoDot:1
+20 ;template name
SET DVBABST=$PIECE($GET(^DVB(396.18,DVBABIEN,0)),"^",1)
+21 ;look for template versions just loaded by the patch (~145F)
+22 IF $PIECE(DVBABST,"~",1)=NM
IF $PIECE(DVBABST,"~",2)=DVBVERSS
Begin DoDot:2
+23 SET DVBABIE2=0
SET DVBACH=0
+24 ;secondary loop-walk through CAPRI TEMPLATE DEFINITIONS file entries
+25 FOR
SET DVBABIE2=$ORDER(^DVB(396.18,DVBABIE2))
if 'DVBABIE2
QUIT
Begin DoDot:3
+26 ;template name
SET DVBABS2=$PIECE($GET(^DVB(396.18,DVBABIE2,0)),"^",1)
+27 ;if new version of template already exists in file, set flag
+28 IF $PIECE(DVBABS2,"~",1)=NM
IF $PIECE(DVBABS2,"~",2)=DVBVERSN
SET DVBACH=1
End DoDot:3
+29 ;if new version already exists, delete the imported version (abort rename)
+30 IF DVBACH=1
Begin DoDot:3
+31 ;Beginning with DVBA*2.7*139, use FILE^DIE to delete duplicate record.
+32 ;D MES^XPDUTL(" Found existing "_NM_". No modifications made.")
+33 ;K ^DVB(396.18,DVBABIEN)
+34 SET DVBAMSG=" Found existing "_NM_". No modifications made."
+35 SET DVBAFDA(396.18,DVBABIEN_",",.01)="@"
+36 DO FILE^DIE("","DVBAFDA","DVBAERR")
End DoDot:3
+37 ;otherwise, if new version isn't found, rename imported template
+38 ;name to the new version name (i.e. ACROMEGALY~145F --> ACROMEGALY~145t6)
+39 IF DVBACH=0
Begin DoDot:3
+40 ;Beginning with DVBA*2.7*139, use FILE^DIE to update Name field.
+41 ;Added update to Activation Date field in DVBA*2.7*139.
+42 ;S $P(^DVB(396.18,DVBABIEN,0),"^",1)=NM_"~"_DVBVERSN
+43 ;D MES^XPDUTL(" Activated: "_$P($G(^DVB(396.18,DVBABIEN,0)),"^",1))
+44 SET DVBAADT=$PIECE($GET(^DVB(396.18,DVBABIEN,2)),"^")
+45 SET DVBACTR=DVBACTR+1
+46 SET DVBAFDA(396.18,DVBABIEN_",",.01)=NM_"~"_DVBVERSN
+47 IF DVBAADT=""!(DVBAADT<DT)
SET DVBAFDA(396.18,DVBABIEN_",",2)=DT
+48 DO FILE^DIE("","DVBAFDA","DVBAERR")
+49 SET DVBAMSG=" Activating: "_$PIECE($GET(^DVB(396.18,DVBABIEN,0)),"^",1)
End DoDot:3
+50 DO MES^XPDUTL(DVBAMSG)
+51 IF $DATA(DVBAERR)
Begin DoDot:3
+52 DO MSG^DIALOG("AE",.DVBAMSG1,"","","DVBAERR")
+53 DO MES^XPDUTL(.DVBAMSG1)
End DoDot:3
End DoDot:2
End DoDot:1
+54 ;
+55 KILL DVBABIEN,DVBABST,DVBACH
+56 QUIT
+57 ;
RBXREF ;Rebuild cross-references in (#396.18) file.
+1 ;
+2 ;Changes were made in DVBA*2.7*145 to use Fileman APIs to update
+3 ;the entries in the CAPRI TEMPLATE DEFINITIONS (#396.18) file.
+4 ;Do not need to re-index the "B" and "AV" cross references.
+5 ;
+6 DO BMES^XPDUTL("Cleaning up files and rebuilding 2 cross-references.")
+7 DO MES^XPDUTL("This may take a few minutes.")
+8 ;
+9 ;XRef: B
+10 DO BMES^XPDUTL(" Rebuilding 'B' x-ref, CAPRI TEMPLATE DEFINITIONS file")
+11 NEW DA,DIK,REGIEN,ROOT
+12 SET ROOT=$$ROOT^DILFD(396.18,,1)
KILL @ROOT@("B")
+13 SET REGIEN=0
+14 FOR
SET REGIEN=$ORDER(@ROOT@(REGIEN))
if 'REGIEN
QUIT
Begin DoDot:1
+15 SET DIK=$$ROOT^DILFD(396.18,","_REGIEN_",")
SET DIK(1)=".01^B"
+16 SET DA(1)=REGIEN
DO ENALL^DIK
End DoDot:1
+17 ;
+18 ;XRef: AV
+19 DO MES^XPDUTL(" Rebuilding 'AV' x-ref, CAPRI TEMPLATE DEFINITIONS file")
+20 NEW DA,DIK,REGIEN,ROOT
+21 SET ROOT=$$ROOT^DILFD(396.18,,1)
KILL @ROOT@("AV")
+22 SET REGIEN=0
+23 FOR
SET REGIEN=$ORDER(@ROOT@(REGIEN))
if 'REGIEN
QUIT
Begin DoDot:1
+24 SET DIK=$$ROOT^DILFD(396.18,","_REGIEN_",")
SET DIK(1)=".01^AV"
+25 SET DA(1)=REGIEN
DO ENALL^DIK
End DoDot:1
+26 ;
+27 KILL DA,DIK,REGIEN,ROOT
+28 QUIT
+29 ;
DISABLE(NM) ;Disable matching exam template entries.
+1 ;
+2 ;This procedure will find each entry in the CAPRI TEMPLATE DEFINITIONS
+3 ;(#396.18) file that matches the name (NM) of the template being exported.
+4 ;Once a matching entry is found, it will be disabled if the version
+5 ;suffix (i.e. ~145T5) does not match the version suffix that will be used
+6 ;for templates loaded by the patch on the target system (i.e. ~145T6).
+7 ;
+8 ;An entry will be disabled by doing the following:
+9 ; - Turning off the SELECTABLE BY USER? field. This will keep the entry
+10 ; from showing in the CAPRI GUI template list.
+11 ; - Looking at DE-ACTIVATION DATE field. If there's no date, set it to today.
+12 ;
+13 ;ien of CAPRI TEMPLATE DEFINITIONS file
NEW DVBABIEN
+14 ;template NAME field (i.e. ACROMEGALY~145T5)
NEW DVBABST
+15 ;flag used to indicate template was disabled
NEW DVBACH
+16 ;FDA array for FILE^DIE
NEW DVBAFDA
+17 ;Error array for FILE^DIE
NEW DVBAERR
+18 ;Used to write message to installer/Install file entry
NEW DVBAMSG1
+19 ;
+20 SET DVBABIEN=0
+21 ;
+22 ;walk through CAPRI TEMPLATE DEFINITIONS file entries
+23 FOR
SET DVBABIEN=$ORDER(^DVB(396.18,DVBABIEN))
if 'DVBABIEN
QUIT
Begin DoDot:1
+24 ;template name
SET DVBABST=$PIECE($GET(^DVB(396.18,DVBABIEN,0)),"^",1)
+25 ;if name matches and version is different, then disable entry
+26 IF $PIECE(DVBABST,"~",1)=NM
IF $PIECE(DVBABST,"~",2)'=DVBVERSN
Begin DoDot:2
+27 SET DVBACH=0
+28 ;turn SELECTABLE BY USER (#7) field off
+29 IF $PIECE($GET(^DVB(396.18,DVBABIEN,6)),"^",1)'="0"
SET DVBAFDA(396.18,DVBABIEN_",",7)="0"
SET DVBACH=1
+30 ;set DE-ACTIVATION DATE (#3) field to TODAY
+31 IF $PIECE($GET(^DVB(396.18,DVBABIEN,2)),"^",2)=""
SET DVBAFDA(396.18,DVBABIEN_",",3)=DT
SET DVBACH=1
+32 ;output list of disabled templates
+33 IF DVBACH=1
Begin DoDot:3
+34 SET DVBACTR=DVBACTR+1
+35 DO FILE^DIE("","DVBAFDA","DVBAERR")
+36 DO MES^XPDUTL(" Disabling: "_DVBABST)
+37 IF $DATA(DVBAERR)
Begin DoDot:4
+38 DO MSG^DIALOG("AE",.DVBAMSG1,"","","DVBAERR")
+39 DO MES^XPDUTL(.DVBAMSG1)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+40 ;
+41 KILL DVBABIEN,DVBABST,DVBACH
+42 QUIT