Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMEXSI.m

    r613 r623  
    1 PXRMEXSI        ; SLC/PKR/PJH - Silent repository entry install. ;09/28/2007
    2         ;;2.0;CLINICAL REMINDERS;**6**;Feb 04, 2005;Build 123
    3         ;
    4         ;===================================================
    5 INITMPG ;Initialize ^TMP arrays.
    6         K ^TMP("PXRMEXFND",$J)
    7         K ^TMP("PXRMEXIA",$J)
    8         K ^TMP("PXRMEXIAD",$J)
    9         K ^TMP("PXRMEXLC",$J)
    10         K ^TMP("PXRMEXLD",$J)
    11         K ^TMP("PXRMEXTMP",$J)
    12         Q
    13         ;
    14         ;===================================================
    15 INSCOM(PXRMRIEN,ACTION,IND,TEMP,REMNAME,HISTSUB)        ;Install component IND
    16         ;of PXRMRIEN.
    17         N ATTR,END,EXISTS,FILENUM,IND120,JND120,NAME
    18         N PT01,RTN,SAME,START,TEXT
    19         S FILENUM=$P(TEMP,U,1),EXISTS=$P(TEMP,U,4)
    20         S IND120=$P(TEMP,U,2),JND120=$P(TEMP,U,3)
    21         I (IND120="")!(JND120="") Q
    22         S TEMP=^PXD(811.8,PXRMRIEN,120,IND120,1,JND120,0)
    23         ;If the component does not exist then the action has to be "I".
    24         ;If the component exists and the action is "I" change it to "O".
    25         ;If the component exists and the action is "M" leave it "M".
    26         ;If the component exists and the action is "O" leave it "O".
    27         S ACTION=$S('EXISTS:"I",ACTION="I":"O",1:ACTION)
    28         S SAME=0
    29         S START=$P(TEMP,U,2)
    30         S END=$P(TEMP,U,3)
    31         I FILENUM=0 D
    32         . D RTNLD^PXRMEXIC(PXRMRIEN,START,END,.ATTR,.RTN)
    33         . I EXISTS D
    34         .. D CHECKSUM^PXRMEXCS(.ATTR,START,END)
    35         .. S CSUM=$$RTNCS^PXRMEXCS(ATTR("NAME"))
    36         .. I ATTR("CHECKSUM")=CSUM S SAME=1,ACTION="S"
    37         . S ^TMP("PXRMEXIA",$J,IND,"ROUTINE",ATTR("NAME"),ACTION)=""
    38         E  D
    39         . S TEMP=^PXD(811.8,PXRMRIEN,100,START,0)
    40         . S PT01=$P(TEMP,"~",2)
    41         .;Save reminder name for dialog install.
    42         . I FILENUM=811.9 S REMNAME=PT01
    43         . D SETATTR^PXRMEXFI(.ATTR,FILENUM,PT01)
    44         . I EXISTS D
    45         .. D CHECKSUM^PXRMEXCS(.ATTR,START,END)
    46         .. S CSUM=$$FILE^PXRMEXCS(ATTR("FILE NUMBER"),EXISTS)
    47         .. I ATTR("CHECKSUM")=CSUM S SAME=1,ACTION="S"
    48         .;Save what was done for the installation summary.
    49         . S ^TMP(HISTSUB,$J,IND,ATTR("FILE NAME"),PT01,ACTION)=""
    50         ;If the packed component and the installed component are the same
    51         ;there is nothing to do.
    52         I SAME Q
    53         ;Install this component.
    54         I FILENUM=0 D RTNSAVE^PXRMEXIC(.RTN,ATTR("NAME"))
    55         E  D FILE^PXRMEXIC(PXRMRIEN,EXISTS,IND120,JND120,ACTION,.ATTR,.PXRMNMCH)
    56         Q
    57         ;
    58         ;===================================================
    59 INSDLG(PXRMRIEN,ACTION) ;Install dialog components directly
    60         ;from the "SEL" array.
    61         N IND,FILENUM,ITEMP,NAME,REMNAME,TEMP
    62         ;Build the selection array in ^TMP("PXRMEXLD",$J,"SEL"). For dialogs
    63         ;the selection array is:
    64         ;file no.^FDA start^FDA end^EXISTS^IND120^JND120^NAME
    65         D BLDDISP^PXRMEXD1(0)
    66         ;Work through the selection array installing the dialog parts
    67         ;in reverse order.
    68         S IND=""
    69         F  S IND=$O(^TMP("PXRMEXLD",$J,"SEL",IND),-1) Q:(IND="")!(PXRMDONE)  D
    70         . S TEMP=^TMP("PXRMEXLD",$J,"SEL",IND)
    71         . S FILENUM=$P(TEMP,U,1),NAME=$P(TEMP,U,7)
    72         .;Dialog elements may be used more than once in a dialog so make sure
    73         .;the element has not already been installed.
    74         . S ITEMP=$P(TEMP,U,1)_U_$P(TEMP,U,5,6)_U_$$EXISTS^PXRMEXIU(FILENUM,NAME)
    75         . D INSCOM(PXRMRIEN,ACTION,IND,ITEMP,.REMNAME,"PXRMEXIAD")
    76         Q
    77         ;
    78         ;===================================================
    79 INSTALL(PXRMRIEN,ACTION,NOR)    ;Install all components in a repository entry.
    80         ;If NOR is true do not install routines.
    81         N DNAME,FILENUM,IND,PXRMDONE,PXRMNMCH,REMNAME,TEMP
    82         S PXRMDONE=0
    83         S NOR=$G(NOR)
    84         ;Initialize ^TMP globals.
    85         D INITMPG
    86         ;Build the component list.
    87         K ^PXD(811.8,PXRMRIEN,100,"B")
    88         K ^PXD(811.8,PXRMRIEN,120)
    89         D CLIST^PXRMEXU1(.PXRMRIEN)
    90         I PXRMRIEN=-1 Q
    91         ;Build the selectable list.
    92         D CDISP^PXRMEXLC(PXRMRIEN)
    93         ;Set the install date and time and type.
    94         S ^TMP("PXRMEXIA",$J,"DT")=$$NOW^XLFDT
    95         S ^TMP("PXRMEXIA",$J,"TYPE")="SILENT"
    96         ;Initialize the name change storage.
    97         K PXRMNMCH
    98         S IND=0
    99         F  S IND=$O(^TMP("PXRMEXLC",$J,"SEL",IND)) Q:(IND="")!(PXRMDONE)  D
    100         . S TEMP=^TMP("PXRMEXLC",$J,"SEL",IND)
    101         . S FILENUM=$P(TEMP,U,1)
    102         .;If NOR is true do not install routines.
    103         . I FILENUM=0,NOR Q
    104         . ;Install dialog components
    105         . I FILENUM=801.41 N PXRMDONE S PXRMDONE=0 D INSDLG(PXRMRIEN,ACTION) Q
    106         . ;Install component
    107         . E  D INSCOM(PXRMRIEN,ACTION,IND,TEMP,.REMNAME,"PXRMEXIA")
    108         ;
    109         ;Get the dialog name
    110         S DNAME=$G(^TMP("PXRMEXTMP",$J,"PXRMDNAM"))
    111         ;Link the dialog if it exists
    112         I DNAME'="" D
    113         . N DIEN,RIEN
    114         .;Get the dialog ien
    115         . S DIEN=$$EXISTS^PXRMEXIU(801.41,DNAME) Q:'DIEN
    116         .;Get the reminder ien
    117         . S RIEN=+$$EXISTS^PXRMEXIU(811.9,$G(REMNAME)) Q:'RIEN
    118         . I RIEN>0 D
    119         .. N DA,DIE,DIK,DR
    120         ..;Set reminder to dialog pointer
    121         .. S DR="51///^S X=DNAME",DIE="^PXD(811.9,",DA=RIEN
    122         .. D ^DIE
    123         ;
    124         ;Save the install history.
    125         D SAVHIST^PXRMEXU1
    126         ;If any components were skipped send the message.
    127         I $D(^TMP("PXRMEXNI",$J)) D
    128         . N NE,XMSUB
    129         . S NE=$O(^TMP("PXRMEXNI",$J,""),-1)+1
    130         . S ^TMP("PXRMEXNI",$J,NE,0)="Please review and make changes as necessary."
    131         . K ^TMP("PXRMXMZ",$J)
    132         . M ^TMP("PXRMXMZ",$J)=^TMP("PXRMEXNI",$J)
    133         . S XMSUB="COMPONENTS SKIPPED DURING SILENT MODE INSTALL"
    134         . D SEND^PXRMMSG(XMSUB)
    135         ;Cleanup TMP globals.
    136         D INITMPG
    137         Q
    138         ;
     1PXRMEXSI ; SLC/PKR/PJH - Silent repository entry install. ;12/22/2004
     2 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
     3 ;
     4 ;===================================================
     5BUILD ;Build list manager workfile from ^TMP("PXRMEXTMP" (see ^PXRMEXLB)
     6 N DDATA,DDLG,IND,JND,NLINE,NSEL
     7 S NLINE=0,NSEL=0
     8 S DDLG=$G(^TMP("PXRMEXTMP",$J,"PXRMDNAM")) Q:DDLG=""
     9 ;
     10 ;Save reminder dialog
     11 S DDATA=^TMP("PXRMEXTMP",$J,"DLOC",DDLG)
     12 S IND=$P(DDATA,U,3),JND=$P(DDATA,U,4)
     13 D DSAVE(DDLG,IND,JND)
     14 ;
     15 ;Process sub-components
     16 I $D(^TMP("PXRMEXTMP",$J,"DREPL",DDLG))>0 D DREPL(DDLG)
     17 D DCMP(DDLG)
     18 Q
     19 ;
     20 ;===================================================
     21DCMP(DLG) ;Search for dialog components
     22 N DDLG,DEND,DNAM,DSEQ,DSTRT,IND,JND
     23 S DSEQ=0
     24 F  S DSEQ=$O(^TMP("PXRMEXTMP",$J,"DMAP",DLG,DSEQ)) Q:'DSEQ  D
     25 . S DDATA=^TMP("PXRMEXTMP",$J,"DMAP",DLG,DSEQ)
     26 . S DNAM=$P(DDATA,U),DSTRT=$P(DDATA,U,2),DEND=$P(DDATA,U,3) Q:DNAM=""
     27 . S IND=$P(DDATA,U,4),JND=$P(DDATA,U,5)
     28 .;Save line in workfile
     29 . D DSAVE(DNAM,IND,JND)
     30 .;
     31 . I $D(^TMP("PXRMEXTMP",$J,"DREPL",DNAM))>0 D DREPL(DNAM)
     32 .;Process any sub-components
     33 . I $D(^TMP("PXRMEXTMP",$J,"DMAP",DNAM)) D DCMP(DNAM)
     34 Q
     35 ;
     36 ;===================================================
     37DREPL(DLG,LEV) ;
     38 N DDATA,DDLG,DEND,DNAM,DSEQ,DSTRT,IND,JND
     39 S DDATA=^TMP("PXRMEXTMP",$J,"DREPL",DLG)
     40 S DNAM=$P(DDATA,U),DSTRT=$P(DDATA,U,2),DEND=$P(DDATA,U,3) Q:DNAM=""
     41 S IND=$P(DDATA,U,4),JND=$P(DDATA,U,5)
     42 ;Save line in workfile
     43 D DSAVE(DNAM,IND,JND)
     44 I $D(^TMP("PXRMEXTMP",$J,"DMAP",DNAM)) D DCMP(DNAM)
     45 Q
     46 ;===================================================
     47DSAVE(DNAM,IND,JND) ;Update workfile
     48 ;Ignore national prompts
     49 I $$PXRM^PXRMEXID(DNAM) Q
     50 N DEXIST
     51 S NSEL=NSEL+1
     52 ;Check if dialog exists
     53 S DEXIST=$$EXISTS^PXRMEXIU(801.41,DNAM)
     54 ;Store the file number, start and stop line in the exchange file.
     55 S ^TMP("PXRMEXLD",$J,"SEL",NSEL)=FILENUM_U_IND_U_JND_U_DEXIST
     56 Q
     57 ;
     58 ;===================================================
     59INITMPG ;Initialize ^TMP arrays.
     60 K ^TMP("PXRMEXIA",$J)
     61 K ^TMP("PXRMEXLC",$J)
     62 K ^TMP("PXRMEXLD",$J)
     63 K ^TMP("PXRMEXTMP",$J)
     64 Q
     65 ;
     66 ;===================================================
     67INSCOM(PXRMRIEN,IND,TEMP,REMNAME) ;Install component IND of PXRMRIEN.
     68 N ACTION,ATTR,END,EXISTS,FILENUM,IND120,JND120,NAME
     69 N PT01,RTN,START
     70 S FILENUM=$P(TEMP,U,1),EXISTS=$P(TEMP,U,4)
     71 S IND120=$P(TEMP,U,2),JND120=$P(TEMP,U,3)
     72 S TEMP=^PXD(811.8,PXRMRIEN,120,IND120,1,JND120,0)
     73 I (FILENUM=801.41)!(FILENUM=811.5) S ACTION=$S(EXISTS:"M",1:"I")
     74 E  S ACTION=$S(EXISTS:"O",1:"I")
     75 S START=$P(TEMP,U,2)
     76 S END=$P(TEMP,U,3)
     77 S TEMP=^PXD(811.8,PXRMRIEN,100,START,0)
     78 I FILENUM=0 D
     79 . D RTNLD^PXRMEXIC(PXRMRIEN,START,END,.ATTR,.RTN)
     80 .;Save what was done for the installation summary.
     81 . S ^TMP("PXRMEXIA",$J,IND,"ROUTINE",ATTR("NAME"),ACTION)=""
     82 E  D
     83 . S PT01=$P(TEMP,"~",2)
     84 . S (ATTR("NAME"),ATTR("PT01"))=PT01
     85 . D SETATTR^PXRMEXFI(.ATTR,FILENUM)
     86 .;Save what was done for the installation summary.
     87 . S ^TMP("PXRMEXIA",$J,IND,ATTR("FILE NAME"),PT01,ACTION)=""
     88 ;Install this component.
     89 I FILENUM=0 D RTNSAVE^PXRMEXIC(.RTN,ATTR("NAME"))
     90 E  D FILE^PXRMEXIC(PXRMRIEN,EXISTS,IND120,JND120,ACTION,.ATTR,.PXRMNMCH)
     91 ;Save reminder name
     92 I FILENUM=811.9 S REMNAME=PT01
     93 ;If this component was not installed add to the no install message.
     94 Q
     95 ;
     96 ;===================================================
     97INSDLG(PXRMRIEN) ;Install dialog components (in reverse order)
     98 ;
     99 K ^TMP("PXRMEXSI",$J)
     100 N IND,TEMP,JND120,KIDSDONE
     101 ;Build list of components
     102 D BUILD
     103 S IND="",KIDSDONE=0
     104 F  S IND=$O(^TMP("PXRMEXLD",$J,"SEL",IND),-1) Q:'IND!(KIDSDONE=1)  D
     105 . S TEMP=^TMP("PXRMEXLD",$J,"SEL",IND),JND120=$P(TEMP,U,3)
     106 .;Skip install if dialog occurs more than once
     107 . I $D(^TMP("PXRMEXSI",$J,JND120)) Q
     108 . S ^TMP("PXRMEXSI",$J,JND120)=""
     109 .;Silent Dialog Install
     110 . D INSCOM(PXRMRIEN,IND,TEMP,.REMNAME)
     111 K ^TMP("PXRMEXSI",$J)
     112 Q
     113 ;
     114 ;===================================================
     115INSTALL(PXRMRIEN,NOR) ;Install all components in a repository entry.
     116 ;If NOR is true do not install routines.
     117 N DNAME,FILENUM,IND,PXRMNMCH,REMNAME,TEMP
     118 S NOR=$G(NOR)
     119 ;Initialize ^TMP globals.
     120 D INITMPG
     121 ;Build the component list.
     122 K ^PXD(811.8,PXRMRIEN,100,"B")
     123 K ^PXD(811.8,PXRMRIEN,120)
     124 D CLIST^PXRMEXU1(.PXRMRIEN)
     125 I PXRMRIEN=-1 Q
     126 ;Build the selectable list.
     127 D CDISP^PXRMEXLC(PXRMRIEN)
     128 ;Set the install date and time.
     129 S ^TMP("PXRMEXIA",$J,"DT")=$$NOW^XLFDT
     130 ;Initialize the name change storage.
     131 K PXRMNMCH
     132 S IND=0
     133 F  S IND=$O(^TMP("PXRMEXLC",$J,"SEL",IND)) Q:+IND=0  D
     134 . S TEMP=^TMP("PXRMEXLC",$J,"SEL",IND)
     135 . S FILENUM=$P(TEMP,U,1)
     136 .;If NOR is true do not install routines.
     137 . I FILENUM=0,NOR Q
     138 . ;Install dialog components
     139 . I FILENUM=801.41 N PXRMDONE S PXRMDONE=0 D INSDLG(PXRMRIEN) Q
     140 . ;Install component
     141 . E  D INSCOM(PXRMRIEN,IND,TEMP,.REMNAME)
     142 ;
     143 ;Get the dialog name
     144 S DNAME=$G(^TMP("PXRMEXTMP",$J,"PXRMDNAM"))
     145 ;Link the dialog if it exists
     146 I DNAME'="" D
     147 . N DIEN,RIEN
     148 .;Get the dialog ien
     149 . S DIEN=$$EXISTS^PXRMEXIU(801.41,DNAME) Q:'DIEN
     150 .;Get the reminder ien
     151 . S RIEN=+$$EXISTS^PXRMEXIU(811.9,$G(REMNAME)) Q:'RIEN
     152 . I RIEN>0 D
     153 .. N DA,DIE,DIK,DR
     154 ..;Set reminder to dialog pointer
     155 .. S DR="51///^S X=DNAME",DIE="^PXD(811.9,",DA=RIEN
     156 .. D ^DIE
     157 ;
     158 ;Save the install history.
     159 D SAVHIST^PXRMEXU1
     160 ;If any components were skipped send the message.
     161 I $D(^TMP("PXRMEXNI",$J)) D
     162 . N NE,XMSUB
     163 . S NE=$O(^TMP("PXRMEXNI",$J,""),-1)+1
     164 . S ^TMP("PXRMEXNI",$J,NE,0)="Please review and make changes as necessary."
     165 . K ^TMP("PXRMXMZ",$J)
     166 . M ^TMP("PXRMXMZ",$J)=^TMP("PXRMEXNI",$J)
     167 . S XMSUB="COMPONENTS SKIPPED DURING SILENT MODE INSTALL"
     168 . D SEND^PXRMMSG(XMSUB)
     169 ;Cleanup TMP globals.
     170 D INITMPG
     171 Q
     172 ;
Note: See TracChangeset for help on using the changeset viewer.