PXRMEXIC ;SLC/PKR/PJH - Routines to install repository entry components. ;24-Mar-2015 10:50;DU
;;2.0;CLINICAL REMINDERS;**6,1001,12,17,16,18,22,24,26,1005**;Feb 04, 2005;Build 23
;=================================================
FILE(PXRMRIEN,SITEIEN,IND120,JND120,ACTION,ATTR,NAMECHG) ;Read and process a
;file entry in repository entry PXRMRIEN. IND120 and JND120 are the
;indexes for the component list. ACTION is one of the possible actions.
I ACTION="S" Q
N DATA,DUZ0S,EDULIST,FDA,FDAEND,FDASTART,FIELD,FILENUM
N IEN,IENS,IENREND,IENROOT,IENRSTR,IENUSED,IND,INDICES
N LINE,MSG,NAME,NEW01,PXNAT,PXRMEDOK,PXRMEXCH
N SRCIEN,START,TEMP,TEXT,TFDA,TIENROOT,TIUFPRIV,TNAME,TOPFNUM,VERSN,XUMF
N WPLCNT,WPTMP
;I $G(PXRMIGDS) S DUZ0S=DUZ(0),DUZ(0)="^",XUMF=1
;Set PXRMEDOK so files pointing to sponsors can be installed.
;Set PXRMEXCH so national entries can be installed and prevent
;execution of the input transform for custom logic fields.
;Set PXNAT to allow installation of national (those starting with VA-)
;PCE items.
;IHS/MGH/MGH -Set toolkit variable so it doesn't write to the screen
S XTLKSAY=0
S (PXNAT,PXRMEDOK,PXRMEXCH)=1
S TEMP=^PXD(811.8,PXRMRIEN,120,IND120,1,JND120,0)
S FDASTART=+$P(TEMP,U,2)
S FDAEND=+$P(TEMP,U,3)
S IENRSTR=+$P(TEMP,U,4)
S IENREND=+$P(TEMP,U,5)
F IND=FDASTART:1:FDAEND D
. S LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
. S INDICES=$P(LINE,"~",1)
. S DATA=$P(LINE,"~",2)
. S FILENUM=$P(INDICES,";",1)
. S IENS=$P(INDICES,";",2)
. I IND=FDASTART S SRCIEN=+IENS
. S FIELD=$P(INDICES,";",3)
. I LINE["WP-start" D
.. S DATA="WPTMP("_IND_","_+FIELD_")"
.. S WPLCNT=$P(LINE,"~",3)
.. D WORDPROC(PXRMRIEN,.WPTMP,IND,+FIELD,.IND,WPLCNT)
. I (IND=FDASTART)&((FIELD=.01)!(FIELD=.001)) D
..;Save the top level file number.
.. S TOPFNUM=FILENUM
..;If the action is copy put it in the first open spot. PCE files go
..;in the site number space.
.. I ACTION="C" D
... S START=$S($$ISPCEFIL^PXRMEXU0(TOPFNUM):$P($$SITE^VASITE,U,3)_"000",1:0)
... S IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM,START)
..;
..;If the entry does not exist and the action is not copy set the
..;action to install.
.. I SITEIEN=0 S ACTION="I"
..;
..;If the action is install try to install at the source ien. If
..;an entry already exists at the source ien put it in the first
..;open spot. For PCE entries install at source ien unless they
..;are national.
.. I ACTION="I" D
... S IENUSED=+$$FIND1^DIC(FILENUM,"","QU","`"_SRCIEN)
... S IENROOT(SRCIEN)=$S(IENUSED=0:SRCIEN,1:$$LOIEN^PXRMEXU5(FILENUM))
... I $$ISPCEFIL^PXRMEXU0(TOPFNUM) D
.... I IENUSED=0 S IENROOT(SRCIEN)=SRCIEN
.... I IENUSED>0 D
..... S START=$S(IENUSED>100000:$E(IENUSED,1,3)_"000",1:0)
..... S IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM,START)
.... I $G(PXRMMNAT) S IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM)
..;
..;If the action is merge, overwrite,or update install at the site's
..;ien.
.. I (ACTION="M")!(ACTION="O")!(ACTION="U") S IENROOT(SRCIEN)=SITEIEN
.;
.;This line is use to convert pre-patch 12 disable text to the new
.;value of 1 for disable
. I FILENUM=801.41,FIELD=3,DATA'="",$L(DATA)>2 D
..I DATA="DISABLE AND DO NOT SEND MESSAGE" Q
..S DATA="DISABLE AND SEND MESSAGE"
.;
. S FDA(FILENUM,IENS,FIELD)=DATA
;
;Initialize the edit history.
D INIEH(TOPFNUM,IENS,.FDA,.WPTMP)
;Build the IENROOT
F IND=IENRSTR:1:IENREND D
. I IND=0 Q
. S TEMP=^PXD(811.8,PXRMRIEN,100,IND,0)
. S IENROOT($P(TEMP,U,1))=$P(TEMP,U,2)
;Check for name changes, i.e., the copy action.
D NAMECHG(.FDA,.NAMECHG,TOPFNUM)
;
;Special handling for file 142.
I TOPFNUM=142 D Q:'$D(FDA)
. D SFMVPI^PXRMEXIU(.FDA,.NAMECHG,142.14)
;
;Special handling for file 801
I TOPFNUM=801 D Q:PXRMDONE
. D SFMVPI^PXRMEXIU(.FDA,.NAMECHG,801.015)
. D ROC^PXRMEXU5(.FDA)
;
;Special handling for file 801.1
I TOPFNUM=801.1 D Q:PXRMDONE
. D ROCR^PXRMEXU5(.FDA)
;
;Special handling for file 801.41
I TOPFNUM=801.41 D Q:PXRMDONE
. I ACTION="M" D MOU^PXRMEXU5(801.41,SITEIEN,"18*",.FDA,.IENROOT,ACTION,.WPTMP)
. D DLG^PXRMEXU4(.FDA,.NAMECHG)
;
;Special handling for file 810.9
I TOPFNUM=810.9 D LOC^PXRMEXU0(.FDA)
;
;Special handling for file 811.2
I TOPFNUM=811.2 D TAX^PXRMEXU0(.FDA,"CFR")
;
;If the file number is 811.4 the user must have programmer
;access to install it.
I (TOPFNUM=811.4)&(DUZ(0)'="@") D Q
. W !,"Only programmers can install Reminder Computed Findings."
;
;Special handling for file 811.5.
I TOPFNUM=811.5 D Q:'$D(FDA)
.;If the site has any findings already mapped merge them in.
. I (ACTION="M")!(ACTION="U") D MOU^PXRMEXU5(811.5,SITEIEN,"20*",.FDA,.IENROOT,ACTION,.WPTMP)
. D SFMVPI^PXRMEXIU(.FDA,.NAMECHG,811.52)
;
;Special handling for file 811.9.
I TOPFNUM=811.9 D
.;Don't execute the input transform for custom logic fields.
. S PXRMEXCH=1
. D DEF^PXRMEXIU(.FDA,.NAMECHG)
;
;Special handling for file 9999999.09, EDUCATION TOPICS.
I TOPFNUM=9999999.09 D
. S IENS=$O(FDA(TOPFNUM,""))
. S EDULIST(FDA(TOPFNUM,IENS,.01))=""
;
;Special handling for file 8925.1
I TOPFNUM=8925.1 D
. S TIUFPRIV=1
. D TIUOBJ^PXRMEXIU(.FDA)
;
;Special handling for file 9999999.64.
I TOPFNUM=9999999.64 D
. D HF^PXRMEXIU(.FDA,.NAMECHG)
;
;If FDA is not defined at this point the user has opted to abort
;the install.
I '$D(FDA) Q
;
;If the action is merge, overwrite, or update do a test install
;before deleting the original entry.
I (ACTION="M")!(ACTION="O")!(ACTION="U") D
.;Make the .01 unique for the test install.
. S IENS=$O(FDA(TOPFNUM,""))
.;Get the length of the .01 field
. D FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
. S TNAME="tmp"_$E(FDA(TOPFNUM,IENS,.01),1,ATTR("FIELD LENGTH")-3)
.;Make sure the test entry does not already exist.
. D DELALL^PXRMEXFI(TOPFNUM,TNAME)
. M TFDA=FDA
. S TFDA(TOPFNUM,IENS,.01)=TNAME
. K TIENROOT M TIENROOT=IENROOT
. S TIENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM)
. D UPDATE^DIE("E","TFDA","TIENROOT","MSG")
. I $D(MSG) D Q
.. S TEXT(1)=ATTR("FILE NAME")_" entry "_$G(ATTR("PT01"))_" did not get installed!"
.. S TEXT(2)="Examine the following error message for the reason."
.. S TEXT(3)=""
.. S TEXT(4)="The test update failed, UPDATE^DIE returned the following error message:"
.. D MES^XPDUTL(.TEXT)
.. D AWRITE^PXRMUTIL("MSG")
.. H 2
.;Delete the test entry.
. D DELALL^PXRMEXFI(TOPFNUM,TNAME)
.;If the original update worked put the entry at its original ien.
.;Delete the existing entry.
. D DELETE^PXRMEXFI(TOPFNUM,SITEIEN)
D UPDATE^DIE("E","FDA","IENROOT","MSG")
I $D(MSG) D
. S TEXT(1)=ATTR("FILE NAME")_" entry "_$G(ATTR("PT01"))_" did not get installed!"
. S TEXT(2)="Examine the following error message for the reason."
. S TEXT(3)=""
. S TEXT(4)="The update failed, UPDATE^DIE returned the following error message:"
. D MES^XPDUTL(.TEXT)
. D AWRITE^PXRMUTIL("MSG")
. W !
. H 2
;
I TOPFNUM=811.2 D
.;Finish conversion from pointer based structure to Lexicon based.
. N IEN,PDS
. S IEN=+$O(^PXD(811.2,"B",ATTR("NAME"),""))
. I IEN=0 Q
. D EXCH^PXRMTXCR(IEN,"CFR")
. S PDS=$P(^PXD(811.2,IEN,0),U,4)
. I PDS="" D SPDS^PXRMPDS(IEN,PDS)
. D TAX30^PXRMEXU0(IEN)
;
S VERSN=$$GETTAGV^PXRMEXU3(^PXD(811.8,PXRMRIEN,100,3,0),"<PACKAGE_VERSION>")
I TOPFNUM=811.9,VERSN=1.5 D
. N IEN,PXRMEXCH,X
. S IEN=+$O(^PXD(811.9,"B",ATTR("PT01"),""))
. I IEN=0 Q
.;For reminder definitions build the found/not found text counts.
. D SFNFTC^PXRMEXU0(IEN)
.;Build the internal logic and finding strings.
. S X=$G(^PXD(811.9,IEN,30))
. I X'="" D CPPCLS^PXRMLOGX(IEN,X)
. S X=$G(^PXD(811.9,IEN,34))
. I X'="" D CPRESLS^PXRMLOGX(IEN,X)
. D BLDALL^PXRMLOGX(IEN,"","")
;If there are national education topics rename them so they start
;with VA-
I $D(EDULIST),$G(PXRMMNAT) D
.;Get the length of the .01 field
. D FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
. S NAME=""
. F S NAME=$O(EDULIST(NAME)) Q:NAME="" D
.. I $E(NAME,1,3)="VA-" Q
.. S TNAME="VA-"_$E(ATTR("FIELD LENGTH")-3)
.. D RENAME^PXRMUTIL(TOPFNUM,NAME,TNAME)
;I $G(PXRMIGDS) S DUZ(0)=DUZ0S
Q
;
;=================================================
INIEH(FILENUM,IENS,FDA,WPTMP) ;If the file is a clinical reminder file and
;it has an edit history initialize the history.
I (FILENUM<800)!(FILENUM>811.9) Q
N IENS,SFN,TARGET,WP
D FIELD^DID(FILENUM,"EDIT HISTORY","","SPECIFIER","TARGET")
S SFN=+$G(TARGET("SPECIFIER"))
I SFN=0 Q
S IENS=$O(FDA(SFN,""))
I IENS="" Q
S FDA(SFN,IENS,.01)=$$FMTE^XLFDT($$NOW^XLFDT,"5Z")
S FDA(SFN,IENS,1)="`"_DUZ
;The word-processing field is set when the packing is done.
S WP=FDA(SFN,IENS,2)
K @WP
S @WP@(1)="Exchange Install"
Q
;
;=================================================
NAMECHG(FDA,NAMECHG,FILENUM) ;If this component has been copied to a new
;name make the change.
N CLASS,IENS,PT01
S IENS=$O(FDA(FILENUM,""))
S PT01=FDA(FILENUM,IENS,.01)
I $D(NAMECHG(FILENUM,PT01)) D
. S FDA(FILENUM,IENS,.01)=NAMECHG(FILENUM,PT01)
. I (FILENUM<801.41)!(FILENUM>811.9) Q
.;Once a component has been copied CLASS can no longer be national.
. S CLASS=$G(FDA(FILENUM,IENS,100))
. I CLASS["N" S FDA(FILENUM,IENS,100)="LOCAL"
.;The Sponsor is also removed.
. K FDA(FILENUM,IENS,101)
Q
;
;=================================================
RTNLD(PXRMRIEN,START,END,ATTR,RTN) ;Load a routine from the repository into
;the array RTN.
N IND,LINE,LN,ROUTINE
S LINE=^PXD(811.8,PXRMRIEN,100,START,0)
S ROUTINE=$P(LINE,";",1)
S ROUTINE=$TR(ROUTINE," ","")
S ATTR("FILE NUMBER")=0
S ATTR("NAME")=$P(LINE,";",1)
S ATTR("NAME")=$TR(ATTR("NAME")," ","")
S ATTR("MIN FIELD LENGTH")=3
S ATTR("FIELD LENGTH")=8
S LN=0
F IND=START:1:END D
. S LN=LN+1
. S LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
. S RTN(LN,0)=LINE
Q
;
;=================================================
RTNSAVE(RTN,NAME) ;Save the routine loaded in RTN to the name
;found in NAMECHG.
N DIE,XCN
;%ZOSF("SAVE") requires a global.
K ^TMP($J,"PXRMRTN")
S DIE="^TMP($J,""PXRMRTN"","
M ^TMP($J,"PXRMRTN")=RTN
S XCN=0
S X=NAME
X ^%ZOSF("SAVE")
K ^TMP($J,"PXRMRTN")
Q
;
;=================================================
WORDPROC(PXRMRIEN,WPTMP,I1,I2,IND,WPLCNT) ;Load WPTMP with the word
;processing field.
N I3
F I3=1:1:WPLCNT D
. S IND=IND+1
. S WPTMP(I1,I2,I3)=$G(^PXD(811.8,PXRMRIEN,100,IND,0))
Q
;
PXRMEXIC ;SLC/PKR/PJH - Routines to install repository entry components. ;24-Mar-2015 10:50;DU
+1 ;;2.0;CLINICAL REMINDERS;**6,1001,12,17,16,18,22,24,26,1005**;Feb 04, 2005;Build 23
+2 ;=================================================
FILE(PXRMRIEN,SITEIEN,IND120,JND120,ACTION,ATTR,NAMECHG) ;Read and process a
+1 ;file entry in repository entry PXRMRIEN. IND120 and JND120 are the
+2 ;indexes for the component list. ACTION is one of the possible actions.
+3 IF ACTION="S"
QUIT
+4 NEW DATA,DUZ0S,EDULIST,FDA,FDAEND,FDASTART,FIELD,FILENUM
+5 NEW IEN,IENS,IENREND,IENROOT,IENRSTR,IENUSED,IND,INDICES
+6 NEW LINE,MSG,NAME,NEW01,PXNAT,PXRMEDOK,PXRMEXCH
+7 NEW SRCIEN,START,TEMP,TEXT,TFDA,TIENROOT,TIUFPRIV,TNAME,TOPFNUM,VERSN,XUMF
+8 NEW WPLCNT,WPTMP
+9 ;I $G(PXRMIGDS) S DUZ0S=DUZ(0),DUZ(0)="^",XUMF=1
+10 ;Set PXRMEDOK so files pointing to sponsors can be installed.
+11 ;Set PXRMEXCH so national entries can be installed and prevent
+12 ;execution of the input transform for custom logic fields.
+13 ;Set PXNAT to allow installation of national (those starting with VA-)
+14 ;PCE items.
+15 ;IHS/MGH/MGH -Set toolkit variable so it doesn't write to the screen
+16 SET XTLKSAY=0
+17 SET (PXNAT,PXRMEDOK,PXRMEXCH)=1
+18 SET TEMP=^PXD(811.8,PXRMRIEN,120,IND120,1,JND120,0)
+19 SET FDASTART=+$PIECE(TEMP,U,2)
+20 SET FDAEND=+$PIECE(TEMP,U,3)
+21 SET IENRSTR=+$PIECE(TEMP,U,4)
+22 SET IENREND=+$PIECE(TEMP,U,5)
+23 FOR IND=FDASTART:1:FDAEND
Begin DoDot:1
+24 SET LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
+25 SET INDICES=$PIECE(LINE,"~",1)
+26 SET DATA=$PIECE(LINE,"~",2)
+27 SET FILENUM=$PIECE(INDICES,";",1)
+28 SET IENS=$PIECE(INDICES,";",2)
+29 IF IND=FDASTART
SET SRCIEN=+IENS
+30 SET FIELD=$PIECE(INDICES,";",3)
+31 IF LINE["WP-start"
Begin DoDot:2
+32 SET DATA="WPTMP("_IND_","_+FIELD_")"
+33 SET WPLCNT=$PIECE(LINE,"~",3)
+34 DO WORDPROC(PXRMRIEN,.WPTMP,IND,+FIELD,.IND,WPLCNT)
End DoDot:2
+35 IF (IND=FDASTART)&((FIELD=.01)!(FIELD=.001))
Begin DoDot:2
+36 ;Save the top level file number.
+37 SET TOPFNUM=FILENUM
+38 ;If the action is copy put it in the first open spot. PCE files go
+39 ;in the site number space.
+40 IF ACTION="C"
Begin DoDot:3
+41 SET START=$SELECT($$ISPCEFIL^PXRMEXU0(TOPFNUM):$PIECE($$SITE^VASITE,U,3)_"000",1:0)
+42 SET IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM,START)
End DoDot:3
+43 ;
+44 ;If the entry does not exist and the action is not copy set the
+45 ;action to install.
+46 IF SITEIEN=0
SET ACTION="I"
+47 ;
+48 ;If the action is install try to install at the source ien. If
+49 ;an entry already exists at the source ien put it in the first
+50 ;open spot. For PCE entries install at source ien unless they
+51 ;are national.
+52 IF ACTION="I"
Begin DoDot:3
+53 SET IENUSED=+$$FIND1^DIC(FILENUM,"","QU","`"_SRCIEN)
+54 SET IENROOT(SRCIEN)=$SELECT(IENUSED=0:SRCIEN,1:$$LOIEN^PXRMEXU5(FILENUM))
+55 IF $$ISPCEFIL^PXRMEXU0(TOPFNUM)
Begin DoDot:4
+56 IF IENUSED=0
SET IENROOT(SRCIEN)=SRCIEN
+57 IF IENUSED>0
Begin DoDot:5
+58 SET START=$SELECT(IENUSED>100000:$EXTRACT(IENUSED,1,3)_"000",1:0)
+59 SET IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM,START)
End DoDot:5
+60 IF $GET(PXRMMNAT)
SET IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM)
End DoDot:4
End DoDot:3
+61 ;
+62 ;If the action is merge, overwrite,or update install at the site's
+63 ;ien.
+64 IF (ACTION="M")!(ACTION="O")!(ACTION="U")
SET IENROOT(SRCIEN)=SITEIEN
End DoDot:2
+65 ;
+66 ;This line is use to convert pre-patch 12 disable text to the new
+67 ;value of 1 for disable
+68 IF FILENUM=801.41
IF FIELD=3
IF DATA'=""
IF $LENGTH(DATA)>2
Begin DoDot:2
+69 IF DATA="DISABLE AND DO NOT SEND MESSAGE"
QUIT
+70 SET DATA="DISABLE AND SEND MESSAGE"
End DoDot:2
+71 ;
+72 SET FDA(FILENUM,IENS,FIELD)=DATA
End DoDot:1
+73 ;
+74 ;Initialize the edit history.
+75 DO INIEH(TOPFNUM,IENS,.FDA,.WPTMP)
+76 ;Build the IENROOT
+77 FOR IND=IENRSTR:1:IENREND
Begin DoDot:1
+78 IF IND=0
QUIT
+79 SET TEMP=^PXD(811.8,PXRMRIEN,100,IND,0)
+80 SET IENROOT($PIECE(TEMP,U,1))=$PIECE(TEMP,U,2)
End DoDot:1
+81 ;Check for name changes, i.e., the copy action.
+82 DO NAMECHG(.FDA,.NAMECHG,TOPFNUM)
+83 ;
+84 ;Special handling for file 142.
+85 IF TOPFNUM=142
Begin DoDot:1
+86 DO SFMVPI^PXRMEXIU(.FDA,.NAMECHG,142.14)
End DoDot:1
IF '$DATA(FDA)
QUIT
+87 ;
+88 ;Special handling for file 801
+89 IF TOPFNUM=801
Begin DoDot:1
+90 DO SFMVPI^PXRMEXIU(.FDA,.NAMECHG,801.015)
+91 DO ROC^PXRMEXU5(.FDA)
End DoDot:1
IF PXRMDONE
QUIT
+92 ;
+93 ;Special handling for file 801.1
+94 IF TOPFNUM=801.1
Begin DoDot:1
+95 DO ROCR^PXRMEXU5(.FDA)
End DoDot:1
IF PXRMDONE
QUIT
+96 ;
+97 ;Special handling for file 801.41
+98 IF TOPFNUM=801.41
Begin DoDot:1
+99 IF ACTION="M"
DO MOU^PXRMEXU5(801.41,SITEIEN,"18*",.FDA,.IENROOT,ACTION,.WPTMP)
+100 DO DLG^PXRMEXU4(.FDA,.NAMECHG)
End DoDot:1
IF PXRMDONE
QUIT
+101 ;
+102 ;Special handling for file 810.9
+103 IF TOPFNUM=810.9
DO LOC^PXRMEXU0(.FDA)
+104 ;
+105 ;Special handling for file 811.2
+106 IF TOPFNUM=811.2
DO TAX^PXRMEXU0(.FDA,"CFR")
+107 ;
+108 ;If the file number is 811.4 the user must have programmer
+109 ;access to install it.
+110 IF (TOPFNUM=811.4)&(DUZ(0)'="@")
Begin DoDot:1
+111 WRITE !,"Only programmers can install Reminder Computed Findings."
End DoDot:1
QUIT
+112 ;
+113 ;Special handling for file 811.5.
+114 IF TOPFNUM=811.5
Begin DoDot:1
+115 ;If the site has any findings already mapped merge them in.
+116 IF (ACTION="M")!(ACTION="U")
DO MOU^PXRMEXU5(811.5,SITEIEN,"20*",.FDA,.IENROOT,ACTION,.WPTMP)
+117 DO SFMVPI^PXRMEXIU(.FDA,.NAMECHG,811.52)
End DoDot:1
IF '$DATA(FDA)
QUIT
+118 ;
+119 ;Special handling for file 811.9.
+120 IF TOPFNUM=811.9
Begin DoDot:1
+121 ;Don't execute the input transform for custom logic fields.
+122 SET PXRMEXCH=1
+123 DO DEF^PXRMEXIU(.FDA,.NAMECHG)
End DoDot:1
+124 ;
+125 ;Special handling for file 9999999.09, EDUCATION TOPICS.
+126 IF TOPFNUM=9999999.09
Begin DoDot:1
+127 SET IENS=$ORDER(FDA(TOPFNUM,""))
+128 SET EDULIST(FDA(TOPFNUM,IENS,.01))=""
End DoDot:1
+129 ;
+130 ;Special handling for file 8925.1
+131 IF TOPFNUM=8925.1
Begin DoDot:1
+132 SET TIUFPRIV=1
+133 DO TIUOBJ^PXRMEXIU(.FDA)
End DoDot:1
+134 ;
+135 ;Special handling for file 9999999.64.
+136 IF TOPFNUM=9999999.64
Begin DoDot:1
+137 DO HF^PXRMEXIU(.FDA,.NAMECHG)
End DoDot:1
+138 ;
+139 ;If FDA is not defined at this point the user has opted to abort
+140 ;the install.
+141 IF '$DATA(FDA)
QUIT
+142 ;
+143 ;If the action is merge, overwrite, or update do a test install
+144 ;before deleting the original entry.
+145 IF (ACTION="M")!(ACTION="O")!(ACTION="U")
Begin DoDot:1
+146 ;Make the .01 unique for the test install.
+147 SET IENS=$ORDER(FDA(TOPFNUM,""))
+148 ;Get the length of the .01 field
+149 DO FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
+150 SET TNAME="tmp"_$EXTRACT(FDA(TOPFNUM,IENS,.01),1,ATTR("FIELD LENGTH")-3)
+151 ;Make sure the test entry does not already exist.
+152 DO DELALL^PXRMEXFI(TOPFNUM,TNAME)
+153 MERGE TFDA=FDA
+154 SET TFDA(TOPFNUM,IENS,.01)=TNAME
+155 KILL TIENROOT
MERGE TIENROOT=IENROOT
+156 SET TIENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM)
+157 DO UPDATE^DIE("E","TFDA","TIENROOT","MSG")
+158 IF $DATA(MSG)
Begin DoDot:2
+159 SET TEXT(1)=ATTR("FILE NAME")_" entry "_$GET(ATTR("PT01"))_" did not get installed!"
+160 SET TEXT(2)="Examine the following error message for the reason."
+161 SET TEXT(3)=""
+162 SET TEXT(4)="The test update failed, UPDATE^DIE returned the following error message:"
+163 DO MES^XPDUTL(.TEXT)
+164 DO AWRITE^PXRMUTIL("MSG")
+165 HANG 2
End DoDot:2
QUIT
+166 ;Delete the test entry.
+167 DO DELALL^PXRMEXFI(TOPFNUM,TNAME)
+168 ;If the original update worked put the entry at its original ien.
+169 ;Delete the existing entry.
+170 DO DELETE^PXRMEXFI(TOPFNUM,SITEIEN)
End DoDot:1
+171 DO UPDATE^DIE("E","FDA","IENROOT","MSG")
+172 IF $DATA(MSG)
Begin DoDot:1
+173 SET TEXT(1)=ATTR("FILE NAME")_" entry "_$GET(ATTR("PT01"))_" did not get installed!"
+174 SET TEXT(2)="Examine the following error message for the reason."
+175 SET TEXT(3)=""
+176 SET TEXT(4)="The update failed, UPDATE^DIE returned the following error message:"
+177 DO MES^XPDUTL(.TEXT)
+178 DO AWRITE^PXRMUTIL("MSG")
+179 WRITE !
+180 HANG 2
End DoDot:1
+181 ;
+182 IF TOPFNUM=811.2
Begin DoDot:1
+183 ;Finish conversion from pointer based structure to Lexicon based.
+184 NEW IEN,PDS
+185 SET IEN=+$ORDER(^PXD(811.2,"B",ATTR("NAME"),""))
+186 IF IEN=0
QUIT
+187 DO EXCH^PXRMTXCR(IEN,"CFR")
+188 SET PDS=$PIECE(^PXD(811.2,IEN,0),U,4)
+189 IF PDS=""
DO SPDS^PXRMPDS(IEN,PDS)
+190 DO TAX30^PXRMEXU0(IEN)
End DoDot:1
+191 ;
+192 SET VERSN=$$GETTAGV^PXRMEXU3(^PXD(811.8,PXRMRIEN,100,3,0),"<PACKAGE_VERSION>")
+193 IF TOPFNUM=811.9
IF VERSN=1.5
Begin DoDot:1
+194 NEW IEN,PXRMEXCH,X
+195 SET IEN=+$ORDER(^PXD(811.9,"B",ATTR("PT01"),""))
+196 IF IEN=0
QUIT
+197 ;For reminder definitions build the found/not found text counts.
+198 DO SFNFTC^PXRMEXU0(IEN)
+199 ;Build the internal logic and finding strings.
+200 SET X=$GET(^PXD(811.9,IEN,30))
+201 IF X'=""
DO CPPCLS^PXRMLOGX(IEN,X)
+202 SET X=$GET(^PXD(811.9,IEN,34))
+203 IF X'=""
DO CPRESLS^PXRMLOGX(IEN,X)
+204 DO BLDALL^PXRMLOGX(IEN,"","")
End DoDot:1
+205 ;If there are national education topics rename them so they start
+206 ;with VA-
+207 IF $DATA(EDULIST)
IF $GET(PXRMMNAT)
Begin DoDot:1
+208 ;Get the length of the .01 field
+209 DO FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
+210 SET NAME=""
+211 FOR
SET NAME=$ORDER(EDULIST(NAME))
IF NAME=""
QUIT
Begin DoDot:2
+212 IF $EXTRACT(NAME,1,3)="VA-"
QUIT
+213 SET TNAME="VA-"_$EXTRACT(ATTR("FIELD LENGTH")-3)
+214 DO RENAME^PXRMUTIL(TOPFNUM,NAME,TNAME)
End DoDot:2
End DoDot:1
+215 ;I $G(PXRMIGDS) S DUZ(0)=DUZ0S
+216 QUIT
+217 ;
+218 ;=================================================
INIEH(FILENUM,IENS,FDA,WPTMP) ;If the file is a clinical reminder file and
+1 ;it has an edit history initialize the history.
+2 IF (FILENUM<800)!(FILENUM>811.9)
QUIT
+3 NEW IENS,SFN,TARGET,WP
+4 DO FIELD^DID(FILENUM,"EDIT HISTORY","","SPECIFIER","TARGET")
+5 SET SFN=+$GET(TARGET("SPECIFIER"))
+6 IF SFN=0
QUIT
+7 SET IENS=$ORDER(FDA(SFN,""))
+8 IF IENS=""
QUIT
+9 SET FDA(SFN,IENS,.01)=$$FMTE^XLFDT($$NOW^XLFDT,"5Z")
+10 SET FDA(SFN,IENS,1)="`"_DUZ
+11 ;The word-processing field is set when the packing is done.
+12 SET WP=FDA(SFN,IENS,2)
+13 KILL @WP
+14 SET @WP@(1)="Exchange Install"
+15 QUIT
+16 ;
+17 ;=================================================
NAMECHG(FDA,NAMECHG,FILENUM) ;If this component has been copied to a new
+1 ;name make the change.
+2 NEW CLASS,IENS,PT01
+3 SET IENS=$ORDER(FDA(FILENUM,""))
+4 SET PT01=FDA(FILENUM,IENS,.01)
+5 IF $DATA(NAMECHG(FILENUM,PT01))
Begin DoDot:1
+6 SET FDA(FILENUM,IENS,.01)=NAMECHG(FILENUM,PT01)
+7 IF (FILENUM<801.41)!(FILENUM>811.9)
QUIT
+8 ;Once a component has been copied CLASS can no longer be national.
+9 SET CLASS=$GET(FDA(FILENUM,IENS,100))
+10 IF CLASS["N"
SET FDA(FILENUM,IENS,100)="LOCAL"
+11 ;The Sponsor is also removed.
+12 KILL FDA(FILENUM,IENS,101)
End DoDot:1
+13 QUIT
+14 ;
+15 ;=================================================
RTNLD(PXRMRIEN,START,END,ATTR,RTN) ;Load a routine from the repository into
+1 ;the array RTN.
+2 NEW IND,LINE,LN,ROUTINE
+3 SET LINE=^PXD(811.8,PXRMRIEN,100,START,0)
+4 SET ROUTINE=$PIECE(LINE,";",1)
+5 SET ROUTINE=$TRANSLATE(ROUTINE," ","")
+6 SET ATTR("FILE NUMBER")=0
+7 SET ATTR("NAME")=$PIECE(LINE,";",1)
+8 SET ATTR("NAME")=$TRANSLATE(ATTR("NAME")," ","")
+9 SET ATTR("MIN FIELD LENGTH")=3
+10 SET ATTR("FIELD LENGTH")=8
+11 SET LN=0
+12 FOR IND=START:1:END
Begin DoDot:1
+13 SET LN=LN+1
+14 SET LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
+15 SET RTN(LN,0)=LINE
End DoDot:1
+16 QUIT
+17 ;
+18 ;=================================================
RTNSAVE(RTN,NAME) ;Save the routine loaded in RTN to the name
+1 ;found in NAMECHG.
+2 NEW DIE,XCN
+3 ;%ZOSF("SAVE") requires a global.
+4 KILL ^TMP($JOB,"PXRMRTN")
+5 SET DIE="^TMP($J,""PXRMRTN"","
+6 MERGE ^TMP($JOB,"PXRMRTN")=RTN
+7 SET XCN=0
+8 SET X=NAME
+9 XECUTE ^%ZOSF("SAVE")
+10 KILL ^TMP($JOB,"PXRMRTN")
+11 QUIT
+12 ;
+13 ;=================================================
WORDPROC(PXRMRIEN,WPTMP,I1,I2,IND,WPLCNT) ;Load WPTMP with the word
+1 ;processing field.
+2 NEW I3
+3 FOR I3=1:1:WPLCNT
Begin DoDot:1
+4 SET IND=IND+1
+5 SET WPTMP(I1,I2,I3)=$GET(^PXD(811.8,PXRMRIEN,100,IND,0))
End DoDot:1
+6 QUIT
+7 ;