Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDECSTNG

SDECSTNG.m

Go to the documentation of this file.
  1. SDECSTNG ; ALB/WTC - VISTA SCHEDULING - Settings Utilities ;MAY 16,2018@09:48
  1. ;;5.3;Scheduling;**694,756**;;Build 43
  1. ;;Per VHA Directive 2004-038, this routine should not be modified
  1. Q ;
  1. ;
  1. ;
  1. ; Extract help text and URLs from SDEC Settings file (#409.98)
  1. ;
  1. N SDECI,CTR ;
  1. S SDECI=0 ;
  1. S SDECY="^TMP(""SDECSTNG"","_$J_",""HELPLINK"")" ;
  1. K @SDECY ;
  1. S @SDECY@(SDECI)="T00030ID^T00030TEXT^T00255URL"_$C(30) ;
  1. ;
  1. ; Get help text, url and source for the national hyperlinks
  1. ;
  1. S CTR=0 D LOAD(1) ;
  1. ;
  1. ; Get help text, url and source for the local hyperlinks
  1. ;
  1. D LOAD(2) ;
  1. ;
  1. ; Return links
  1. ;
  1. S SDECI=SDECI+1 ;
  1. S @SDECY@(SDECI)=$C(31)
  1. Q
  1. ;
  1. LOAD(SITE) ;
  1. ;
  1. ; Load URLs for a site into output array.
  1. ;
  1. N DA,X,Y ;
  1. S DA=0 F S DA=$O(^SDEC(409.98,SITE,1,DA)) Q:'DA D ;
  1. . ;
  1. . ; Generate link based on type, address and mail subject.
  1. . ;
  1. . S CTR=CTR+1,X=CTR_"^"_$P(^SDEC(409.98,SITE,1,DA,0),"^",1)_"^" ;
  1. . S X=X_$S($P(^SDEC(409.98,SITE,1,DA,0),"^",2)=1:"http://",$P(^(0),"^",2)=2:"https://",$P(^(0),"^",2)=3:"mailto:",1:"")_^(1) ;
  1. . ;
  1. . ; If link is a mail link with a subject, append "?subject=" and the encoded subject.
  1. . ;
  1. . I $G(^SDEC(409.98,SITE,1,DA,2))'="" S Y=^(2) X "S Y=$ZCONVERT(Y,""O"",""URL"")" S X=X_"?subject="_Y ;
  1. . S SDECI=SDECI+1,@SDECY@(SDECI)=X_$C(30) Q ;
  1. Q
  1. ;
  1. SERVER ; Entry point for server option to kick off file update.
  1. ;
  1. ; Update SDEC Settings file (#409.98) from messages sent through SDECSETTINGS mail group.
  1. ;
  1. ; SD*5.3*694 wtc/zeb 8/29/2018
  1. ;
  1. ; ID of triggering message is in assumed variable XMZ
  1. ; Call to XMXAPI covered by IA #2729
  1. ; Call to XMXUTIL2 covered by IA #2736
  1. ;
  1. N MESSAGE,SDECXMZ,X,GUIVERS,EFFDATE,Y,CMTLNGTH,I,HASHTAG,CMTTEXT,ACTION,DIC,DIK,DA,STOPCODE ;
  1. ;
  1. S SDECXMZ=$G(XMZ) Q:SDECXMZ="" ; Message unknown.
  1. ;
  1. D:$$SUBJ^XMXUTIL2($G(^XMB(3.9,SDECXMZ,0)))["SDEC SETTINGS REMOTE UPDATE" ;
  1. . ;
  1. . ; Check message text for action to take.
  1. . ;
  1. . ;F I=1:1 Q:$G(^XMB(3.9,SDECXMZ,2,I,0))="" S MESSAGE=^(0) D ;
  1. . N XMZ,XMER S XMZ=SDECXMZ F S MESSAGE=$$READ^XMGAPI1() Q:XMER<0 D ; Modified to use MailMan API - 756 WTC 7/23/2020 - ICR #1048
  1. .. ;
  1. .. ; Process version change. Data is "VERSION^version number^effective date (external)"
  1. .. ;
  1. .. I $P(MESSAGE,U,1)="VERSION" D Q ;
  1. ... S GUIVERS=$P(MESSAGE,U,2),EFFDATE=$P(MESSAGE,U,3) ;
  1. ... S Y=$$NETTOFM^SDECDATE(EFFDATE,"N") ;
  1. ... S $P(^SDEC(409.98,2,0),"^",2,3)=GUIVERS_"^"_Y ;
  1. .. ;
  1. .. ; Process changes to canned comments. Data is "CANCELLATION COMMENT^action^hash tag^text equivalent"
  1. .. ; "action" can be "ADD" or "DELETE".
  1. .. ;
  1. .. I $P(MESSAGE,U,1)="CANCELLATION COMMENT" D Q ;
  1. ... S ACTION=$P(MESSAGE,U,2),HASHTAG=$$STRIP($P(MESSAGE,U,3)),CMTTEXT=$$STRIP($P(MESSAGE,U,4)) ;
  1. ... ;
  1. ... I ACTION="ADD" D Q ;
  1. .... I CMTTEXT="" D APPERROR^%ZTER("Entry ("_HASHTAG_") could not be added to file #409.88. Text missing.") Q ;
  1. .... S DA=0 F S DA=$O(^SDEC(409.88,"B",HASHTAG,DA)) Q:'DA Q:$P(^SDEC(409.88,DA,0),U,3)=1 ; Find national hashtag match
  1. .... I DA D APPERROR^%ZTER("Entry ("_HASHTAG_") could not be added to file #409.88. It already exists.") Q ;
  1. .... K DIC,DA S X=HASHTAG,DIC="^SDEC(409.88,",DIC(0)="L",DIC("DR")="1///"_CMTTEXT_";2///1" D FILE^DICN Q:Y>0 ;
  1. .... D APPERROR^%ZTER("Entry ("_HASHTAG_") could not be added to file #409.88") Q ;
  1. ... ;
  1. ... I ACTION="DELETE" D Q ;
  1. .... K DIK,DA ;
  1. .... S DIK="^SDEC(409.88," ;
  1. .... S DA=0 F S DA=$O(^SDEC(409.88,"B",HASHTAG,DA)) Q:'DA Q:$P(^SDEC(409.88,DA,0),U,3)=1 ; Find national hashtag match
  1. .... I 'DA D APPERROR^%ZTER("Entry ("_HASHTAG_") not on file for deletion from file #409.88") Q ;
  1. .... D ^DIK ;
  1. .. ;
  1. .. ; Process changes to VVC stop codes. Data is "VVC STOP CODE^action^stop code^"
  1. .. ; "action" can be "ADD" or "DELETE".
  1. .. ;
  1. .. I $P(MESSAGE,U,1)="VVC STOP CODE" D Q ;
  1. ... S ACTION=$P(MESSAGE,U,2),STOPCODE=$$STRIP($P(MESSAGE,U,3)) ;
  1. ... ;
  1. ... I 'STOPCODE D APPERROR^%ZTER("Invalid stop code ("_STOPCODE_"). No action taken in file #409.98") Q ;
  1. ... I '$O(^DIC(40.7,"C",STOPCODE)) D APPERROR^%ZTER("Undefined stop code ("_STOPCODE_"). No action taken in file #409.98") Q ;
  1. ... ;
  1. ... I ACTION="ADD" D Q ;
  1. .... S DA=$O(^SDEC(409.98,1,3,"B",STOPCODE,0)) ; Find stop code
  1. .... I DA D APPERROR^%ZTER("Stop code ("_STOPCODE_") could not be added to file #409.98. It already exists.") Q ;
  1. .... K DIC,DA S DA(1)=1,X=STOPCODE,DIC="^SDEC(409.98,1,3,",DIC(0)="L" D FILE^DICN Q:Y>0 ;
  1. .... D APPERROR^%ZTER("Stop code ("_STOPCODE_") could not be added to file #409.98") Q ;
  1. ... ;
  1. ... I ACTION="DELETE" D Q ;
  1. .... K DIC,DIK,DA ;
  1. .... S DA(1)=1,DA=$O(^SDEC(409.98,1,3,"B",STOPCODE,0)) ; Find stop code
  1. .... I 'DA D APPERROR^%ZTER("Stop code ("_STOPCODE_") not on file for deletion from file #409.98") Q ;
  1. .... S DIK="^SDEC(409.98,1,3," ;
  1. .... D ^DIK ;
  1. ;
  1. N ZTREQ ;
  1. D ZAPSERV^XMXAPI("S.SDEC SETTINGS REMOTE UPDATE",SDECXMZ) ;
  1. S ZTREQ="@" ;
  1. Q ;
  1. ;
  1. STRIP(X) ; Strip off trailing spaces.
  1. ;
  1. I $E(X,$L(X))=" " S X=$E(X,1,$L(X)-1),X=$$STRIP(X) ;
  1. Q X ;
  1. ;