[613] | 1 | DGFCPROT ;FLB/ALB-DG Field Monitor cross-reference initialing routine. ; 01 AUG 2000 ; 6/18/03 9:08am
|
---|
| 2 | ;;5.3;Registration;**273,526,707**;AUG 13, 1993;Build 14
|
---|
| 3 | ;
|
---|
| 4 | FC(DGDA,DGFILE,DGFIELD,DGTYPE,DGDTH,DGUSER,DGX,DGX1,DGX2,DGOPT) ; Field change listener
|
---|
| 5 | ;Input: DGDA = DA array as exists during Fileman editing
|
---|
| 6 | ;Input: DGFILE = File or subfile number where changed field resides
|
---|
| 7 | ;Input: DGFIELD = Number of changed field
|
---|
| 8 | ;Input: DGTYPE = Type of cross reference action ("SET" or "KILL")
|
---|
| 9 | ;Input: DGDTH = date/time of change in $Horolog format
|
---|
| 10 | ;Input: DGUSER = DUZ of user that made the change
|
---|
| 11 | ;Input: DGX = X array as documented for Fileman new style x-refs
|
---|
| 12 | ;Input: DGX1 = X1 array as documented for Fileman new style x-refs
|
---|
| 13 | ;Input: DGX2 = X2 array as documented for Fileman new style x-refs
|
---|
| 14 | ;Input: DGOPT = current option in "option_name^menu_text" format
|
---|
| 15 | ;
|
---|
| 16 | ;This utility invokes the DG FIELD MONITOR event point protocol.
|
---|
| 17 | ;The DG variables as described above are made available to the
|
---|
| 18 | ;subscribers of this event point.
|
---|
| 19 | ;
|
---|
| 20 | ;NOTE: This event point is not invoked if the action type is "KILL"
|
---|
| 21 | ; and the old field value is null or the new value is not null.
|
---|
| 22 | ; It is not invoked if the action type is "SET" and the new
|
---|
| 23 | ; field value is null.
|
---|
| 24 | ;
|
---|
| 25 | Q:DGX="" ;Quit if setting or killing null value
|
---|
| 26 | ;
|
---|
| 27 | I DGTYPE="KILL",DGX2]"" Q ;Skip kill action on data update
|
---|
| 28 | ;
|
---|
| 29 | ;Manipulate DGTYPE value
|
---|
| 30 | S DGTYPE=$S(DGTYPE="KILL":"DELETE",DGTYPE="SET":"ADD",1:DGTYPE)
|
---|
| 31 | I DGX1]"",DGX2]"" S DGTYPE="UPDATE"
|
---|
| 32 | ;
|
---|
| 33 | S DGOPT=$P(DGOPT,U,1,2) S:DGOPT="" DGOPT="-1^Unknown" ;Current option
|
---|
| 34 | ;
|
---|
| 35 | ;Task off (Taskman) driver routine.
|
---|
| 36 | N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSAVE,ZTSK,DGVAR,BXREF,SUBSCR,ZTREQ
|
---|
| 37 | S ZTRTN="INIT^DGFCPROT",ZTDESC="DG Field monitor task"
|
---|
| 38 | S ZTIO="DG FIELD MONITOR",ZTDTH=$$NOW^XLFDT
|
---|
| 39 | F DGVAR="DGDA","DGDA(","DGFILE","DGFIELD","DGTYPE","DGDTH","DGUSER","DGX","DGX(","DGX1","DGX1(","DGX2","DGX2(","DGOPT" S ZTSAVE(DGVAR)=""
|
---|
| 40 | ;If there are no subscribers, do not call Taskman
|
---|
| 41 | I $D(VAFCA08) S ZTSAVE("VAFCA08")=VAFCA08 ;**707
|
---|
| 42 | I $D(VAFHCA08) S ZTSAVE("VAFHCA08")=VAFHCA08 ;**707
|
---|
| 43 | S BXREF=0,BXREF=$O(^ORD(101,"B","DG FIELD MONITOR",BXREF))
|
---|
| 44 | S SUBSCR=0,SUBSCR=$O(^ORD(101,BXREF,10,SUBSCR))
|
---|
| 45 | I 'SUBSCR Q
|
---|
| 46 | D ^%ZTLOAD
|
---|
| 47 | Q
|
---|
| 48 | ;
|
---|
| 49 | INIT N X
|
---|
| 50 | S X=$O(^ORD(101,"B","DG FIELD MONITOR",0))_";ORD(101," D EN1^XQOR
|
---|
| 51 | I $D(ZTQUEUED) S ZTREQ="@"
|
---|
| 52 | K DGDA,DGFILE,DGFIELD,DGTYPE,DGDTH,DGUSER,DGX,DGX1,DGX2,DGOPT
|
---|
| 53 | Q
|
---|