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

USRAEDT.m

Go to the documentation of this file.
  1. USRAEDT ; SLC/JER - Business Rule Edit ;3/5/10
  1. ;;1.0;AUTHORIZATION/SUBSCRIPTION;**15,29,33**;Jun 20, 1997;Build 7
  1. MAIN ; Controls branching
  1. N DIC,DA,DIE,DR,DLAYGO,X,Y,DWPK,TIUFPRIV,USRY,USRI S TIUFPRIV=1
  1. W !,"Please Enter or Edit a Business Rule:",!
  1. S (DIC,DLAYGO)=8930.1,DIC(0)="AEMQL",DIC("A")="Select DOCUMENT DEFINITION: "
  1. D ^DIC K DIC,DLAYGO Q:+Y'>0 S DA=+Y
  1. S DIE=8930.1,DR="[USR DEFINE AUTHORIZATIONS]"
  1. D ^DIE
  1. I '$D(DA) W !!,"<Business Rule DELETED>" Q
  1. W !!,"You defined the following rule:",!
  1. D XLATE(.USRY,DA)
  1. S USRI=0 F S USRI=$O(USRY(USRI)) Q:+USRI'>0 D
  1. . W !?(2*USRI),USRY(USRI)
  1. Q
  1. XLATE(Y,DA) ; Translate business rule
  1. N STATUS,USRCLASS,USROLE,USRD0,USRI
  1. S USRD0=$G(^USR(8930.1,+DA,0))
  1. S STATUS=$$STATUS(DA,USRD0),USRCLASS=$$CLASS(DA,USRD0)
  1. S USROLE=$$ROLE(DA,USRD0)
  1. S Y=$S($E(STATUS,1,2)="UN":"An",$E(STATUS,1)="A":"An",1:"A")
  1. S Y=Y_" "_STATUS_" "
  1. ;**ID** was " may be "
  1. S Y=Y_$$DOCUMENT(DA,USRD0)_" may "_$$ACTION(DA,USRD0)_" by "
  1. S Y=Y_USRCLASS_$S($P(USRD0,U,5)="&":" who is also ",$P(USRD0,U,5)="!":" OR ",(($G(USRCLASS)'="")&($G(USROLE)'="")):" OR ",1:"")
  1. S Y=Y_USROLE,Y=$$WRAP^USRLS(Y,75)
  1. F USRI=1:1:$L(Y,"|") S Y(USRI)=$P(Y,"|",USRI)
  1. Q
  1. STATUS(DA,USRD0) ; to which status does the rule apply?
  1. N Y
  1. S Y=$P($G(^USR(8930.6,+$P(USRD0,U,2),0)),U)
  1. Q $G(Y)
  1. DOCUMENT(DA,USRD0) ; to which document does the rule apply?
  1. N Y
  1. S Y=$$DDHLEV($P($G(^TIU(8925.1,+USRD0,0)),U,4)) ;ICR 2321
  1. S Y=Y_$$UP^XLFSTR($$PNAME^TIULC1(+USRD0)) ;ICR 2323
  1. I $E(Y,$L(Y))="S" S Y=$E(Y,1,$L(Y)-1)
  1. Q $G(Y)
  1. DDHLEV(USRDTYP) ; External value of Document Definition Type
  1. N USRY
  1. S USRY=$S(USRDTYP="CL":"(CLASS) ",USRDTYP="DC":"(DOCUMENT CLASS) ",USRDTYP="DOC":"(TITLE) ",1:"")
  1. Q $G(USRY)
  1. ACTION(DA,USRD0) ; to which action does rule apply?
  1. N Y,ACTNDA,NODE0
  1. S ACTNDA=+$P(USRD0,U,3),NODE0=$G(^USR(8930.8,ACTNDA,0))
  1. S Y=$P(NODE0,U,6) ;DOCMT VERB
  1. ACTX Q $G(Y)
  1. ;
  1. CLASS(DA,USRD0) ; to which user class does the rule apply?
  1. N Y
  1. ;S Y=$$UP^XLFSTR($$CLNAME^USRLM($P(USRD0,U,4)))
  1. S Y=$$UP^XLFSTR($$CLNAME^USRLM($P(USRD0,U,4),1)) ; Use .01 class name
  1. ; **ID** was "A ". Omit U to avoid "an User"
  1. I $L(Y) S Y=$S("AEIO"[$E(Y):"an ",1:"a ")_Y
  1. Q $G(Y)
  1. ROLE(DA,USRD0) ; to which user role does the rule apply?
  1. N Y,USRDA
  1. S USRDA=$P(USRD0,U,6),Y=$P($G(^USR(8930.2,+USRDA,0)),U)
  1. ;**ID** changed A and An to lower case
  1. I $L(Y) S Y=$S($E(Y)="A":"an ",$E(Y)="E":"an ",1:"a ")_Y
  1. Q Y