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

USRP1001.m

Go to the documentation of this file.
  1. USRP1001 ; SLC/MAM - After installing TIU*1.0*137;28-Feb-2006 16:13;MGH
  1. ;;1.0;AUTHORIZATION/SUBSCRIPTION;**1001**;Jun 20, 1997
  1. ; Run this after installing patch 137.
  1. ;Use option: TIU137 DDEFS Rules, Anat Path
  1. ;
  1. ENV N PATCH
  1. S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
  1. ;
  1. S PATCH="USR*1.0*23"
  1. I '$$PATCH(PATCH) D Q
  1. . W !,"You must first install "_PATCH_"." S XPDQUIT=2
  1. Q
  1. PATCH(X) ;return 1 if patch X was installed, X=aaaa*nn.nn*nnnn
  1. ;copy of code from XPDUTL but modified to handle 4 digit IHS patch numb
  1. Q:X'?1.4UN1"*"1.2N1"."1.2N.1(1"V",1"T").2N1"*"1.4N 0
  1. NEW NUM,I,J
  1. S I=$O(^DIC(9.4,"C",$P(X,"*"),0)) Q:'I 0
  1. S J=$O(^DIC(9.4,I,22,"B",$P(X,"*",2),0)),X=$P(X,"*",3) Q:'J 0
  1. ;check if patch is just a number
  1. Q:$O(^DIC(9.4,I,22,J,"PAH","B",X,0)) 1
  1. S NUM=$O(^DIC(9.4,I,22,J,"PAH","B",X_" SEQ"))
  1. Q (X=+NUM)
  1. ;
  1. POST ; Create new Business Rules
  1. ; Create rules for ONE User Class & ONE DDEF
  1. ; -- Set data for rules:
  1. ;If rules already exist, quit
  1. N CL,ST,ACTION,MSG,RULENUM,VIEW,PRINT,IEN,USR
  1. S RULENUM=0
  1. S CL=$$FIND1^DIC(8925.1,,,"CLINICAL DOCUMENTS",,,"MSG")
  1. I $D(MSG) D Q
  1. .W !!,"Unable to find the class clinical documents. Rules cannot be added"
  1. S ST=$$FIND1^DIC(8930.6,,,"RETRACTED",,,"MSG")
  1. I $D(MSG) D Q
  1. .W !!,"Unable to find the status RETRACTED. Rules cannot be added"
  1. S USR=$$FIND1^DIC(8930,,,"CHIEF, MIS",,,"MSG")
  1. I $D(MSG) D Q
  1. .W !!,"Unable to find the user class CHIEF, MIS. Rules cannot be added."
  1. S VIEW=$$FIND1^DIC(8930.8,,,"VIEW",,,"MSG")
  1. I $D(MSG) D Q
  1. .W !!,"Unable to find the action, VIEW. Rules cannot be added."
  1. S PRINT=$$FIND1^DIC(8930.8,,,"PRINT RECORD",,,"MSG")
  1. I $D(MSG) D Q
  1. .W !!,"Unable to find the action PRINT RECORD. Rules cannot be added."
  1. S IEN="" S IEN=$O(^USR(8930.1,"AC",CL,ST,VIEW,USR,IEN))
  1. ;Only add if this rule does not exist
  1. I IEN="" D
  1. . S RULENUM=RULENUM+1
  1. . D SETDATA(RULENUM,VIEW)
  1. ;Only add the print rule if its not there
  1. S IEN="" S IEN=$O(^USR(8930.1,"AC",CL,ST,PRINT,USR,IEN))
  1. I IEN="" D
  1. . S RULENUM=RULENUM+1
  1. . D SETDATA(RULENUM,PRINT)
  1. N NUM,SUCCESS
  1. S SUCCESS=1,NUM=0
  1. ; -- Loop through numbered list of rules:
  1. I '$O(^TMP("USR1001",$J,"RULES",0)) S SUCCESS=0 W "Business rules already exist" Q
  1. F S NUM=$O(^TMP("USR1001",$J,"RULES",NUM)) Q:'NUM D
  1. .N USRERR,FDA,DESC
  1. .M FDA(8930.1,"+1,")=^TMP("USR1001",$J,"RULES",NUM)
  1. .M DESC=^TMP("USR1001",$J,"RULESDESC")
  1. .S FDA(8930.1,"+1,",1)="DESC"
  1. .D UPDATE^DIE("","FDA","","USRERR")
  1. .I $D(USRERR) S SUCCESS=0 Q
  1. .K ^TMP("USR1001",$J,"RULES",NUM)
  1. K ^TMP("USR1001",$J,"RULESDESC")
  1. I '$G(SUCCESS) D Q
  1. . W "Problem creating Business Rules. Please contact National VistA Support."
  1. W "Business Rules created successfully."
  1. Q
  1. ;
  1. SETDATA(RULENUM,ACTION) ; Set data for rules
  1. ; -- Set data for exported Rules into Rule nodes of ^TMP.
  1. ; Use interior data since there may be dup DDEF names.
  1. ; Must set AFTER User Class is created:
  1. N DDEFIEN,USRCLASS,EXACTION
  1. S ^TMP("USR1001",$J,"RULES",RULENUM,.01)=CL
  1. S ^TMP("USR1001",$J,"RULES",RULENUM,.04)=USR
  1. S ^TMP("USR1001",$J,"RULES",RULENUM,.02)=ST
  1. S ^TMP("USR1001",$J,"RULES",RULENUM,.03)=ACTION
  1. S ^TMP("USR1001",$J,"RULESDESC",1)="Rule created by patch USR*1*1001."
  1. S ^TMP("USR1001",$J,"RULESDESC",2)="Rules allowing retracted documents to be used by only medical records."
  1. Q
  1. SETX ;
  1. Q