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

USRPS23.m

Go to the documentation of this file.
  1. USRPS23 ; SLC/MAM - After installing TIU*1.0*137;6/16/03
  1. ;;1.0;AUTHORIZATION/SUBSCRIPTION;**23**;Jun 20, 1997
  1. ; Run this after installing patch 137.
  1. ;Use option: TIU137 DDEFS Rules, Anat Path
  1. MAIN ; Create new User Class & new Business Rules
  1. ; -- Check for potential dup User Class created after install
  1. ; but before option:
  1. K ^TMP("USR23",$J)
  1. D SETXTMP^USREN23
  1. N USRDUPS,TMPCNT,SILENT
  1. S TMPCNT=0
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=""
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=" ***** User Class and Rules for LABORATORY REPORTS *****"
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=""
  1. S SILENT=1
  1. S USRDUPS=$$USRDUPS^USREN23(SILENT)
  1. I $G(USRDUPS) D G MAINX
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="Duplicate problem. See description for patch TIU*1*137,"
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="in the National Patch Module."
  1. N DONE,SUCCESS
  1. ; -- If User Class previously created by this patch,
  1. ; say so and quit:
  1. S DONE=+$G(^XTMP("USR23","DONE"))
  1. I DONE>0 D G MAINX
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="User Class and, presumably, Business Rules"
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=" were already created in a previous install."
  1. ; -- Create new User Class:
  1. D NEWCLASS(.SUCCESS,.TMPCNT)
  1. ; -- Create new Business Rules:
  1. I SUCCESS D NEWRULES(.TMPCNT)
  1. MAINX ; Exit
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=""
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=" *********"
  1. Q
  1. ;
  1. NEWCLASS(SUCCESS,TMPCNT) ; Create one new User Class in file 8930
  1. N FDA,USRIEN,CLASSDA
  1. S SUCCESS=1
  1. ; -- Create new User Class:
  1. M FDA(8930,"+1,")=^XTMP("USR23","USRCLAS")
  1. D UPDATE^DIE("E","FDA","USRIEN")
  1. S CLASSDA=+$G(USRIEN(1))
  1. I CLASSDA'>0 D Q
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="Couldn't create a User Class named "_^XTMP("USR23","USRCLAS",.01)_"."
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=" Please contact National VistA Support."
  1. . S SUCCESS=0
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="User Class named "_^XTMP("USR23","USRCLAS",.01)
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=" created successfully."
  1. ; -- Set "DONE" node to IEN:
  1. S ^XTMP("USR23","DONE")=CLASSDA
  1. Q
  1. ;
  1. NEWRULES(TMPCNT) ; Create new Business Rules
  1. ; Create rules for ONE User Class & ONE DDEF
  1. ; -- Set data for rules:
  1. D SETDATA(.TMPCNT)
  1. N NUM,SUCCESS
  1. S SUCCESS=1,NUM=0
  1. ; -- Loop through numbered list of rules:
  1. I '$O(^XTMP("USR23","RULES",0)) S SUCCESS=0 Q
  1. F S NUM=$O(^XTMP("USR23","RULES",NUM)) Q:'NUM D
  1. . N USRERR,FDA,DESC
  1. . M FDA(8930.1,"+1,")=^XTMP("USR23","RULES",NUM)
  1. . M DESC=^XTMP("USR23","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 ^XTMP("USR23","RULES",NUM)
  1. K ^XTMP("USR23","RULESDESC")
  1. I '$G(SUCCESS) D Q
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=""
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="Problem creating Business Rules. Please contact National VistA Support."
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=""
  1. S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="Business Rules created successfully."
  1. Q
  1. ;
  1. SETDATA(TMPCNT) ; Set data for rules
  1. ; -- Set data for exported Rules into Rule nodes of ^XTMP.
  1. ; Use interior data since there may be dup DDEF names.
  1. ; Must set AFTER User Class is created:
  1. N DDEFIEN,USRCLASS,RULENUM,EXACTION
  1. ; -- Get IEN of DDEF Number 2. (DDEF Number 2 is DC,
  1. ; LR ANATOMIC PATHOLOGY. See ^TIUEN137.)
  1. S DDEFIEN=$G(^XTMP("TIU137","BASICS",2,"DONE"))
  1. I DDEFIEN'>0 D G SETX
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)=""
  1. . S TMPCNT=TMPCNT+1,^TMP("USR23",$J,TMPCNT)="Can't find Document Definition for rules. Contact National VistA Support."
  1. ; -- Get IEN of User Class created earlier:
  1. S USRCLASS=+$G(^XTMP("USR23","DONE"))
  1. ; -- Set data for flds .01 (DDEF) and .04 (User Class) for all rules:
  1. F RULENUM=1:1:9 D
  1. . S ^XTMP("USR23","RULES",RULENUM,.01)=DDEFIEN
  1. . S ^XTMP("USR23","RULES",RULENUM,.04)=USRCLASS
  1. ; -- Set rule desc data (same for all rules):
  1. S ^XTMP("USR23","RULESDESC",1)="Using this empty class to prevent this action on Anatomic Pathology documents."
  1. S ^XTMP("USR23","RULESDESC",2)="These documents should be managed from the Anatomic Pathology menu only."
  1. S ^XTMP("USR23","RULESDESC",3)="Rule created by patch USR*1*23."
  1. ; -- Set action data for each rule; set status data according
  1. ; to action:
  1. S RULENUM=0
  1. F EXACTION="AMENDMENT","CHANGE TITLE","COPY RECORD","DELETE RECORD","ENTRY","IDENTIFY SIGNERS","MAKE ADDENDUM","PRINT RECORD","REASSIGN" D
  1. . N INACTION,EXSTATUS,INSTATUS
  1. . S RULENUM=RULENUM+1
  1. . S INACTION=$O(^USR(8930.8,"B",EXACTION,0))
  1. . S ^XTMP("USR23","RULES",RULENUM,.03)=INACTION
  1. . ; -- For action ENTRY, status is untranscribed:
  1. . I EXACTION="ENTRY" D Q
  1. . . S EXSTATUS="UNTRANSCRIBED"
  1. . . S INSTATUS=$O(^USR(8930.6,"B",EXSTATUS,0))
  1. . . S ^XTMP("USR23","RULES",RULENUM,.02)=INSTATUS
  1. . ; -- For all others, status is completed:
  1. . S EXSTATUS="COMPLETED"
  1. . S INSTATUS=$O(^USR(8930.6,"B",EXSTATUS,0))
  1. . S ^XTMP("USR23","RULES",RULENUM,.02)=INSTATUS
  1. SETX ;
  1. Q