DVBA2833 ;ALB/KCL - PATCH DVBA*2.7*133 INSTALL UTILITIES ; 7/22/08
;;2.7;AMIE;**133**;Apr 10, 1995;Build 35
;
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
;
;what the template version will be in the incoming patch
;(version pulled from export account)
S DVBVERSS="133F"
;what the final template version should be once the template is
;loaded by the patch on the target system
S DVBVERSN="133"
;
W !!!,"**** PRE-INSTALL PROCESSING ****",!
W !,"Disabling templates...",!!
;
D DISABLE("GENERAL MEDICAL EXAMINATION")
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
;
;what the template version will be in the incoming patch
;(version pulled from export account)
S DVBVERSS="133F"
;what the final template version should be once the template is
;loaded by the patch on the target system
S DVBVERSN="133"
;
W !!!,"**** POST-INSTALL PROCESSING ****",!
W !,"Activating templates...",!!
;
D POSTP("GENERAL MEDICAL EXAMINATION")
;
;re-build cross references
D RBXREF
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~124F) to it's
;new name/version (i.e. ACROMEGALY~124T6).
;
N DVBABIEN,DVBABIE2 ;ien of CAPRI TEMPLATE DEFINITIONS file
N DVBABST ;template NAME field (i.e. ACROMEGALY~124F)
N DVBABS2 ;template NAME field (i.e. ACROMEGALY~124T6)
N DVBACH ;flag to indicate if template version is found or not
;
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 (~124F)
.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
...W "Found existing "_NM_". No modifications made.",!
...K ^DVB(396.18,DVBABIEN)
..;otherwise, if new version isn't found, rename imported template
..;name to the new version name (i.e. ACROMEGALY~124F --> ACROMEGALY~124t6)
..I DVBACH=0 D
...S $P(^DVB(396.18,DVBABIEN,0),"^",1)=NM_"~"_DVBVERSN
...W "Activated: "_$P($G(^DVB(396.18,DVBABIEN,0)),"^",1),!
;
K DVBABIEN,DVBABST,DVBACH
Q
;
RBXREF ;Rebuild cross-references in (#396.18) file.
;
W !!,"Cleaning up files and rebuilding 2 cross-references.",!,"This may take a few minutes.",!
;
;XRef: B
W !!,"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
W !!,"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. ~124T5) does not match the version suffix that will be used
;for templates loaded by the patch on the target system (i.e. ~124T6).
;
;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~124T5)
N DVBACH ;flag used to indicate template was disabled
;
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 field off
..I $P(^DVB(396.18,DVBABIEN,6),"^",1)'="0" S $P(^DVB(396.18,DVBABIEN,6),"^",1)="0",DVBACH=1
..;set DE-ACTIVATION DATE field to TODAY
..I $P(^DVB(396.18,DVBABIEN,2),"^",2)="" S $P(^DVB(396.18,DVBABIEN,2),"^",2)=DT,DVBACH=1
..;output list of disabled templates
..I DVBACH=1 W "Disabled: "_DVBABST,!
;
K DVBABIEN,DVBABST,DVBACH
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBA2833 5795 printed Dec 13, 2024@01:39:56 Page 2
DVBA2833 ;ALB/KCL - PATCH DVBA*2.7*133 INSTALL UTILITIES ; 7/22/08
+1 ;;2.7;AMIE;**133**;Apr 10, 1995;Build 35
+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
+10 ;
+11 ;what the template version will be in the incoming patch
+12 ;(version pulled from export account)
+13 SET DVBVERSS="133F"
+14 ;what the final template version should be once the template is
+15 ;loaded by the patch on the target system
+16 SET DVBVERSN="133"
+17 ;
+18 WRITE !!!,"**** PRE-INSTALL PROCESSING ****",!
+19 WRITE !,"Disabling templates...",!!
+20 ;
+21 DO DISABLE("GENERAL MEDICAL EXAMINATION")
+22 QUIT
+23 ;
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
+9 ;
+10 ;what the template version will be in the incoming patch
+11 ;(version pulled from export account)
+12 SET DVBVERSS="133F"
+13 ;what the final template version should be once the template is
+14 ;loaded by the patch on the target system
+15 SET DVBVERSN="133"
+16 ;
+17 WRITE !!!,"**** POST-INSTALL PROCESSING ****",!
+18 WRITE !,"Activating templates...",!!
+19 ;
+20 DO POSTP("GENERAL MEDICAL EXAMINATION")
+21 ;
+22 ;re-build cross references
+23 DO RBXREF
+24 QUIT
+25 ;
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~124F) to it's
+5 ;new name/version (i.e. ACROMEGALY~124T6).
+6 ;
+7 ;ien of CAPRI TEMPLATE DEFINITIONS file
NEW DVBABIEN,DVBABIE2
+8 ;template NAME field (i.e. ACROMEGALY~124F)
NEW DVBABST
+9 ;template NAME field (i.e. ACROMEGALY~124T6)
NEW DVBABS2
+10 ;flag to indicate if template version is found or not
NEW DVBACH
+11 ;
+12 SET DVBABIEN=0
+13 ;
+14 ;main loop-walk through CAPRI TEMPLATE DEFINITIONS file entries
+15 FOR
SET DVBABIEN=$ORDER(^DVB(396.18,DVBABIEN))
if 'DVBABIEN
QUIT
Begin DoDot:1
+16 ;template name
SET DVBABST=$PIECE($GET(^DVB(396.18,DVBABIEN,0)),"^",1)
+17 ;look for template versions just loaded by the patch (~124F)
+18 IF $PIECE(DVBABST,"~",1)=NM
IF $PIECE(DVBABST,"~",2)=DVBVERSS
Begin DoDot:2
+19 SET DVBABIE2=0
SET DVBACH=0
+20 ;secondary loop-walk through CAPRI TEMPLATE DEFINITIONS file entries
+21 FOR
SET DVBABIE2=$ORDER(^DVB(396.18,DVBABIE2))
if 'DVBABIE2
QUIT
Begin DoDot:3
+22 ;template name
SET DVBABS2=$PIECE($GET(^DVB(396.18,DVBABIE2,0)),"^",1)
+23 ;if new version of template already exists in file, set flag
+24 IF $PIECE(DVBABS2,"~",1)=NM
IF $PIECE(DVBABS2,"~",2)=DVBVERSN
SET DVBACH=1
End DoDot:3
+25 ;if new version already exists, delete the imported version (abort rename)
+26 IF DVBACH=1
Begin DoDot:3
+27 WRITE "Found existing "_NM_". No modifications made.",!
+28 KILL ^DVB(396.18,DVBABIEN)
End DoDot:3
+29 ;otherwise, if new version isn't found, rename imported template
+30 ;name to the new version name (i.e. ACROMEGALY~124F --> ACROMEGALY~124t6)
+31 IF DVBACH=0
Begin DoDot:3
+32 SET $PIECE(^DVB(396.18,DVBABIEN,0),"^",1)=NM_"~"_DVBVERSN
+33 WRITE "Activated: "_$PIECE($GET(^DVB(396.18,DVBABIEN,0)),"^",1),!
End DoDot:3
End DoDot:2
End DoDot:1
+34 ;
+35 KILL DVBABIEN,DVBABST,DVBACH
+36 QUIT
+37 ;
RBXREF ;Rebuild cross-references in (#396.18) file.
+1 ;
+2 WRITE !!,"Cleaning up files and rebuilding 2 cross-references.",!,"This may take a few minutes.",!
+3 ;
+4 ;XRef: B
+5 WRITE !!,"Rebuilding 'B' x-ref, CAPRI TEMPLATE DEFINITIONS file",!
+6 NEW DA,DIK,REGIEN,ROOT
+7 SET ROOT=$$ROOT^DILFD(396.18,,1)
KILL @ROOT@("B")
+8 SET REGIEN=0
+9 FOR
SET REGIEN=$ORDER(@ROOT@(REGIEN))
if 'REGIEN
QUIT
Begin DoDot:1
+10 SET DIK=$$ROOT^DILFD(396.18,","_REGIEN_",")
SET DIK(1)=".01^B"
+11 SET DA(1)=REGIEN
DO ENALL^DIK
End DoDot:1
+12 ;
+13 ;XRef: AV
+14 WRITE !!,"Rebuilding 'AV' x-ref, CAPRI TEMPLATE DEFINITIONS file",!
+15 NEW DA,DIK,REGIEN,ROOT
+16 SET ROOT=$$ROOT^DILFD(396.18,,1)
KILL @ROOT@("AV")
+17 SET REGIEN=0
+18 FOR
SET REGIEN=$ORDER(@ROOT@(REGIEN))
if 'REGIEN
QUIT
Begin DoDot:1
+19 SET DIK=$$ROOT^DILFD(396.18,","_REGIEN_",")
SET DIK(1)=".01^AV"
+20 SET DA(1)=REGIEN
DO ENALL^DIK
End DoDot:1
+21 ;
+22 KILL DA,DIK,REGIEN,ROOT
+23 QUIT
+24 ;
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. ~124T5) does not match the version suffix that will be used
+6 ;for templates loaded by the patch on the target system (i.e. ~124T6).
+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~124T5)
NEW DVBABST
+15 ;flag used to indicate template was disabled
NEW DVBACH
+16 ;
+17 SET DVBABIEN=0
+18 ;
+19 ;walk through CAPRI TEMPLATE DEFINITIONS file entries
+20 FOR
SET DVBABIEN=$ORDER(^DVB(396.18,DVBABIEN))
if 'DVBABIEN
QUIT
Begin DoDot:1
+21 ;template name
SET DVBABST=$PIECE($GET(^DVB(396.18,DVBABIEN,0)),"^",1)
+22 ;if name matches and version is different, then disable entry
+23 IF $PIECE(DVBABST,"~",1)=NM
IF $PIECE(DVBABST,"~",2)'=DVBVERSN
Begin DoDot:2
+24 SET DVBACH=0
+25 ;turn SELECTABLE BY USER field off
+26 IF $PIECE(^DVB(396.18,DVBABIEN,6),"^",1)'="0"
SET $PIECE(^DVB(396.18,DVBABIEN,6),"^",1)="0"
SET DVBACH=1
+27 ;set DE-ACTIVATION DATE field to TODAY
+28 IF $PIECE(^DVB(396.18,DVBABIEN,2),"^",2)=""
SET $PIECE(^DVB(396.18,DVBABIEN,2),"^",2)=DT
SET DVBACH=1
+29 ;output list of disabled templates
+30 IF DVBACH=1
WRITE "Disabled: "_DVBABST,!
End DoDot:2
End DoDot:1
+31 ;
+32 KILL DVBABIEN,DVBABST,DVBACH
+33 QUIT