| 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 |  ;
 | 
|---|