ORY95 ;SLC/DAN Post-Init for patch OR*3*95 ;9/18/01  13:38
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**95**;Dec 17, 1997
 ;Post-init will check for display text and mnemonics that can potentially cause problems with fileman and the fileman reader (DIR)
POST ; -- postinit
 N ORMSG
 S ORMSG(1)=""
 S ORMSG(2)="This patch imports the STATUS OF ORDER entry"
 S ORMSG(3)="from the OE/RR PRINT FIELDS file.  As a result, the entries"
 S ORMSG(4)="in the OE/RR PRINT FORMAT file need to be recompiled."
 S ORMSG(5)=""
 S ORMSG(6)="**NOTE: If you have made local modifications to the compiled"
 S ORMSG(7)="code in the OE/RR PRINT FORMAT file they will be OVERWRITTEN."
 S ORMSG(8)=""
 S ORMSG(9)="Recompiling..."
 D MES^XPDUTL(.ORMSG) H 3
 D RECMPL^ORPR00 K ORMSG
 S ORMSG(1)="",ORMSG(2)="Starting ORDER DIALOG and ORDERABLE ITEMS file checking in the background.",ORMSG(3)="You'll receive an email when it finishes." D MES^XPDUTL(.ORMSG) H 3 K ORMSG
 S ZTRTN="CHECK^ORY95",ZTDTH=$H,ZTDESC="Patch OR*3*95 Post-Init",ZTSAVE("DUZ")="",ZTIO="" D ^%ZTLOAD Q
CHECK ;Enter here to check files for invalid entries
 N IEN,SUBIEN
 K ^TMP($J)
 S IEN=0 F  S IEN=$O(^ORD(101.41,IEN)) Q:'+IEN  D
 .;Check DISPLAY TEXT field first
 .I $$CHKNAM^ORUTL($P($G(^ORD(101.41,IEN,0)),"^",2)) D REPORT(1,"ODFIX")
 .;Check DISPLAY TEXT subfield of ITEMS multiple next
 .S SUBIEN=0 F  S SUBIEN=$O(^ORD(101.41,IEN,10,SUBIEN)) Q:'+SUBIEN  D
 ..I $$CHKNAM^ORUTL($P($G(^ORD(101.41,IEN,10,SUBIEN,0)),"^",4)) D REPORT(2,"ODFIX")
 ..;Check MNEMONIC field next
 ..I $$CHKMNE^ORUTL($P($G(^ORD(101.41,IEN,10,SUBIEN,0)),"^",3)) D REPORT(3,"ODMFIX")
 ..Q
 .Q
 ;Check NAME field of ORDERABLE ITEMS file for ;
 S IEN=0 F  S IEN=$O(^ORD(101.43,IEN)) Q:'+IEN  I $$CHKNAM^ORUTL($P($G(^ORD(101.43,IEN,0)),"^"),";") D REPORT(4,"OIFIX")
 ;Send mail message with results
 D MAIL
 Q
REPORT(E,FIX) ;Store entries that need to be reported
 N FIEN
 S FIEN=0 I $D(^TMP($J,FIX,IEN,FIEN)) S FIEN=$O(^(999),-1)+1 ;get last subscript
 I E=1 S ^TMP($J,FIX,IEN,FIEN)="DISPLAY TEXT <"_$P(^ORD(101.41,IEN,0),"^",2)_"> for ORDER DIALOG <"_$P(^(0),"^")_">" Q
 I E=2 S ^TMP($J,FIX,IEN,FIEN)="DISPLAY TEXT <"_$P(^ORD(101.41,IEN,10,SUBIEN,0),"^",4)_"> for SEQUENCE # "_$P(^(0),"^")_" of ORDER DIALOG < "_$P(^ORD(101.41,IEN,0),"^")_">" Q
 I E=3 S ^TMP($J,FIX,IEN,FIEN)="MNEMONIC <"_$P(^ORD(101.41,IEN,10,SUBIEN,0),"^",3)_"> for SEQUENCE # "_$P(^(0),"^")_" of ORDER DIALOG <"_$P(^ORD(101.41,IEN,0),"^")_">" Q
 I E=4 S ^TMP($J,FIX,IEN,FIEN)=$P(^ORD(101.43,IEN,0),"^")_" entry in ORDERABLE ITEMS file" Q
 Q
MAIL ;prepare results for sending
 N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG,ORTXT,I,J,K
 S XMDUZ="PATCH OR*3*95 POST-INIT",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
 ;Check mnemonics in this section
 S I=0 I '$D(^TMP($J,"ODMFIX")) S I=I+1,^TMP($J,"ORTXT",I)="No problems with MNEMONIC names were found."
 I $D(^TMP($J,"ODMFIX")) D  ;Add entries that have problems with mnemonics
 .S I=I+1,^TMP($J,"ORTXT",I)="The following entries in the ORDER DIALOG file have MNEMONICS that are the same"
 .S I=I+1,^TMP($J,"ORTXT",I)="as a standard List Manager mnemonic and need to be changed."
 .S I=I+1,^TMP($J,"ORTXT",I)="List Manager mnemonics take precedence over the MNEMONIC field and"
 .S I=I+1,^TMP($J,"ORTXT",I)="will cause the entry to be unselectable by MNEMONIC from within List Manager.",I=I+1,^TMP($J,"ORTXT",I)=""
 .S J=0 F  S J=$O(^TMP($J,"ODMFIX",J)) Q:'+J  S K="" F  S K=$O(^TMP($J,"ODMFIX",J,K)) Q:K=""  S I=I+1 S ^TMP($J,"ORTXT",I)=^(K)
 S I=I+1 S ^TMP($J,"ORTXT",I)=""
 ;Check orderable items name section
 I '$D(^TMP($J,"OIFIX")) S I=I+1 S ^TMP($J,"ORTXT",I)="No problems with ORDERABLE ITEM names were found."
 I $D(^TMP($J,"OIFIX")) D  ;add ORDERABLE ITEMS that have problems
 .S I=I+1,^TMP($J,"ORTXT",I)="The following entries in the ORDERABLE ITEMS file contain"
 .S I=I+1,^TMP($J,"ORTXT",I)="a semi colon (;) and may cause problems during editing.  You need to remove"
 .S I=I+1,^TMP($J,"ORTXT",I)="these characters from these entries to avoid potential problems."
 .S I=I+1,^TMP($J,"ORTXT",I)=""
 .S I=I+1,^TMP($J,"ORTXT",I)="Please use PACKAGE SPECIFIC options to change the names.  The changes"
 .S I=I+1,^TMP($J,"ORTXT",I)="will then update the ORDERABLE ITEMS file and will remain synchronized."
 .S I=I+1,^TMP($J,"ORTXT",I)=""
 .S J=0 F  S J=$O(^TMP($J,"OIFIX",J)) Q:'+J  S I=I+1 S ^TMP($J,"ORTXT",I)=^TMP($J,"OIFIX",J,0)
 S I=I+1,^TMP($J,"ORTXT",I)=""
 ;Check display text section
 I '$D(^TMP($J,"ODFIX")) S I=I+1,^TMP($J,"ORTXT",I)="No problems with DISPLAY TEXT in the ORDER DIALOG file were found."
 I $D(^TMP($J,"ODFIX")) D  ;add ORDER DIALOG problems to mail message
 .S I=I+1,^TMP($J,"ORTXT",I)="The following entries in the ORDER DIALOG file contain special"
 .S I=I+1,^TMP($J,"ORTXT",I)="characters in the DISPLAY TEXT field or the DISPLAY TEXT subfield of"
 .S I=I+1,^TMP($J,"ORTXT",I)="the ITEMS multiple that will not display in the List Manager display."
 .S I=I+1,^TMP($J,"ORTXT",I)="",I=I+1,^TMP($J,"ORTXT",I)="In order to be consistent you may wish to remove the special characters"
 .S I=I+1,^TMP($J,"ORTXT",I)="from the following entries.  The special characters are ;,-^="
 .S I=I+1,^TMP($J,"ORTXT",I)="This is recommended but it is NOT REQUIRED.  They are being"
 .S I=I+1,^TMP($J,"ORTXT",I)="reported for information only.",I=I+1,^TMP($J,"ORTXT",I)=""
 .S J=0 F  S J=$O(^TMP($J,"ODFIX",J)) Q:'+J  S K="" F  S K=$O(^TMP($J,"ODFIX",J,K)) Q:K=""  S I=I+1 S ^TMP($J,"ORTXT",I)=^(K)
 S I=I+1,^TMP($J,"ORTXT",I)="",I=I+1,^TMP($J,"ORTXT",I)="Patch OR*3*95 post-init complete."
 S XMTEXT="^TMP($J,""ORTXT"",",XMSUB="PATCH OR*3*95 Post-init completed"
 D ^XMD
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORY95   5686     printed  Sep 23, 2025@20:19:25                                                                                                                                                                                                       Page 2
ORY95     ;SLC/DAN Post-Init for patch OR*3*95 ;9/18/01  13:38
 +1       ;;3.0;ORDER ENTRY/RESULTS REPORTING;**95**;Dec 17, 1997
 +2       ;Post-init will check for display text and mnemonics that can potentially cause problems with fileman and the fileman reader (DIR)
POST      ; -- postinit
 +1        NEW ORMSG
 +2        SET ORMSG(1)=""
 +3        SET ORMSG(2)="This patch imports the STATUS OF ORDER entry"
 +4        SET ORMSG(3)="from the OE/RR PRINT FIELDS file.  As a result, the entries"
 +5        SET ORMSG(4)="in the OE/RR PRINT FORMAT file need to be recompiled."
 +6        SET ORMSG(5)=""
 +7        SET ORMSG(6)="**NOTE: If you have made local modifications to the compiled"
 +8        SET ORMSG(7)="code in the OE/RR PRINT FORMAT file they will be OVERWRITTEN."
 +9        SET ORMSG(8)=""
 +10       SET ORMSG(9)="Recompiling..."
 +11       DO MES^XPDUTL(.ORMSG)
           HANG 3
 +12       DO RECMPL^ORPR00
           KILL ORMSG
 +13       SET ORMSG(1)=""
           SET ORMSG(2)="Starting ORDER DIALOG and ORDERABLE ITEMS file checking in the background."
           SET ORMSG(3)="You'll receive an email when it finishes."
           DO MES^XPDUTL(.ORMSG)
           HANG 3
           KILL ORMSG
 +14       SET ZTRTN="CHECK^ORY95"
           SET ZTDTH=$HOROLOG
           SET ZTDESC="Patch OR*3*95 Post-Init"
           SET ZTSAVE("DUZ")=""
           SET ZTIO=""
           DO ^%ZTLOAD
           QUIT 
CHECK     ;Enter here to check files for invalid entries
 +1        NEW IEN,SUBIEN
 +2        KILL ^TMP($JOB)
 +3        SET IEN=0
           FOR 
               SET IEN=$ORDER(^ORD(101.41,IEN))
               if '+IEN
                   QUIT 
               Begin DoDot:1
 +4       ;Check DISPLAY TEXT field first
 +5                IF $$CHKNAM^ORUTL($PIECE($GET(^ORD(101.41,IEN,0)),"^",2))
                       DO REPORT(1,"ODFIX")
 +6       ;Check DISPLAY TEXT subfield of ITEMS multiple next
 +7                SET SUBIEN=0
                   FOR 
                       SET SUBIEN=$ORDER(^ORD(101.41,IEN,10,SUBIEN))
                       if '+SUBIEN
                           QUIT 
                       Begin DoDot:2
 +8                        IF $$CHKNAM^ORUTL($PIECE($GET(^ORD(101.41,IEN,10,SUBIEN,0)),"^",4))
                               DO REPORT(2,"ODFIX")
 +9       ;Check MNEMONIC field next
 +10                       IF $$CHKMNE^ORUTL($PIECE($GET(^ORD(101.41,IEN,10,SUBIEN,0)),"^",3))
                               DO REPORT(3,"ODMFIX")
 +11                       QUIT 
                       End DoDot:2
 +12               QUIT 
               End DoDot:1
 +13      ;Check NAME field of ORDERABLE ITEMS file for ;
 +14       SET IEN=0
           FOR 
               SET IEN=$ORDER(^ORD(101.43,IEN))
               if '+IEN
                   QUIT 
               IF $$CHKNAM^ORUTL($PIECE($GET(^ORD(101.43,IEN,0)),"^"),";")
                   DO REPORT(4,"OIFIX")
 +15      ;Send mail message with results
 +16       DO MAIL
 +17       QUIT 
REPORT(E,FIX) ;Store entries that need to be reported
 +1        NEW FIEN
 +2       ;get last subscript
           SET FIEN=0
           IF $DATA(^TMP($JOB,FIX,IEN,FIEN))
               SET FIEN=$ORDER(^(999),-1)+1
 +3        IF E=1
               SET ^TMP($JOB,FIX,IEN,FIEN)="DISPLAY TEXT <"_$PIECE(^ORD(101.41,IEN,0),"^",2)_"> for ORDER DIALOG <"_$PIECE(^(0),"^")_">"
               QUIT 
 +4        IF E=2
               SET ^TMP($JOB,FIX,IEN,FIEN)="DISPLAY TEXT <"_$PIECE(^ORD(101.41,IEN,10,SUBIEN,0),"^",4)_"> for SEQUENCE # "_$PIECE(^(0),"^")_" of ORDER DIALOG < "_$PIECE(^ORD(101.41,IEN,0),"^")_">"
               QUIT 
 +5        IF E=3
               SET ^TMP($JOB,FIX,IEN,FIEN)="MNEMONIC <"_$PIECE(^ORD(101.41,IEN,10,SUBIEN,0),"^",3)_"> for SEQUENCE # "_$PIECE(^(0),"^")_" of ORDER DIALOG <"_$PIECE(^ORD(101.41,IEN,0),"^")_">"
               QUIT 
 +6        IF E=4
               SET ^TMP($JOB,FIX,IEN,FIEN)=$PIECE(^ORD(101.43,IEN,0),"^")_" entry in ORDERABLE ITEMS file"
               QUIT 
 +7        QUIT 
MAIL      ;prepare results for sending
 +1        NEW XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG,ORTXT,I,J,K
 +2        SET XMDUZ="PATCH OR*3*95 POST-INIT"
           SET XMY(.5)=""
           if $GET(DUZ)
               SET XMY(DUZ)=""
 +3       ;Check mnemonics in this section
 +4        SET I=0
           IF '$DATA(^TMP($JOB,"ODMFIX"))
               SET I=I+1
               SET ^TMP($JOB,"ORTXT",I)="No problems with MNEMONIC names were found."
 +5       ;Add entries that have problems with mnemonics
           IF $DATA(^TMP($JOB,"ODMFIX"))
               Begin DoDot:1
 +6                SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="The following entries in the ORDER DIALOG file have MNEMONICS that are the same"
 +7                SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="as a standard List Manager mnemonic and need to be changed."
 +8                SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="List Manager mnemonics take precedence over the MNEMONIC field and"
 +9                SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="will cause the entry to be unselectable by MNEMONIC from within List Manager."
                   SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)=""
 +10               SET J=0
                   FOR 
                       SET J=$ORDER(^TMP($JOB,"ODMFIX",J))
                       if '+J
                           QUIT 
                       SET K=""
                       FOR 
                           SET K=$ORDER(^TMP($JOB,"ODMFIX",J,K))
                           if K=""
                               QUIT 
                           SET I=I+1
                           SET ^TMP($JOB,"ORTXT",I)=^(K)
               End DoDot:1
 +11       SET I=I+1
           SET ^TMP($JOB,"ORTXT",I)=""
 +12      ;Check orderable items name section
 +13       IF '$DATA(^TMP($JOB,"OIFIX"))
               SET I=I+1
               SET ^TMP($JOB,"ORTXT",I)="No problems with ORDERABLE ITEM names were found."
 +14      ;add ORDERABLE ITEMS that have problems
           IF $DATA(^TMP($JOB,"OIFIX"))
               Begin DoDot:1
 +15               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="The following entries in the ORDERABLE ITEMS file contain"
 +16               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="a semi colon (;) and may cause problems during editing.  You need to remove"
 +17               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="these characters from these entries to avoid potential problems."
 +18               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)=""
 +19               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="Please use PACKAGE SPECIFIC options to change the names.  The changes"
 +20               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="will then update the ORDERABLE ITEMS file and will remain synchronized."
 +21               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)=""
 +22               SET J=0
                   FOR 
                       SET J=$ORDER(^TMP($JOB,"OIFIX",J))
                       if '+J
                           QUIT 
                       SET I=I+1
                       SET ^TMP($JOB,"ORTXT",I)=^TMP($JOB,"OIFIX",J,0)
               End DoDot:1
 +23       SET I=I+1
           SET ^TMP($JOB,"ORTXT",I)=""
 +24      ;Check display text section
 +25       IF '$DATA(^TMP($JOB,"ODFIX"))
               SET I=I+1
               SET ^TMP($JOB,"ORTXT",I)="No problems with DISPLAY TEXT in the ORDER DIALOG file were found."
 +26      ;add ORDER DIALOG problems to mail message
           IF $DATA(^TMP($JOB,"ODFIX"))
               Begin DoDot:1
 +27               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="The following entries in the ORDER DIALOG file contain special"
 +28               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="characters in the DISPLAY TEXT field or the DISPLAY TEXT subfield of"
 +29               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="the ITEMS multiple that will not display in the List Manager display."
 +30               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)=""
                   SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="In order to be consistent you may wish to remove the special characters"
 +31               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="from the following entries.  The special characters are ;,-^="
 +32               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="This is recommended but it is NOT REQUIRED.  They are being"
 +33               SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)="reported for information only."
                   SET I=I+1
                   SET ^TMP($JOB,"ORTXT",I)=""
 +34               SET J=0
                   FOR 
                       SET J=$ORDER(^TMP($JOB,"ODFIX",J))
                       if '+J
                           QUIT 
                       SET K=""
                       FOR 
                           SET K=$ORDER(^TMP($JOB,"ODFIX",J,K))
                           if K=""
                               QUIT 
                           SET I=I+1
                           SET ^TMP($JOB,"ORTXT",I)=^(K)
               End DoDot:1
 +35       SET I=I+1
           SET ^TMP($JOB,"ORTXT",I)=""
           SET I=I+1
           SET ^TMP($JOB,"ORTXT",I)="Patch OR*3*95 post-init complete."
 +36       SET XMTEXT="^TMP($J,""ORTXT"","
           SET XMSUB="PATCH OR*3*95 Post-init completed"
 +37       DO ^XMD