Changeset 636 for FOIAVistA/tag/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XQALSURO.m
- Timestamp:
- Dec 4, 2009, 8:26:01 PM (14 years ago)
- Location:
- FOIAVistA/tag/r
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
FOIAVistA/tag/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XQALSURO.m
r628 r636 1 XQALSURO ;ISC-SF.SEA/JLI - SURROGATES FOR ALERTS ; 3/17/08 15:202 ;;8.0;KERNEL;**114,125,173,285,366 ,443**;Jul 10, 1995;Build 41 XQALSURO ;ISC-SF.SEA/JLI - SURROGATES FOR ALERTS ;9/6/05 15:13 2 ;;8.0;KERNEL;**114,125,173,285,366**;Jul 10, 1995 3 3 ;; 4 4 Q … … 16 16 D SURRO1^XQALSUR1(XQAUSER) 17 17 Q 18 ; P366 - optional start and end dates added to permit identification of cyclical surrogates in specific times 18 19 CYCLIC(XQALSURO,XQAUSER,XQASTRT,XQAEND) ; code added to prevent cyclical surrogates 19 I '$$ACTIVE^XUSER(XQALSURO) Q "You cannot have an INACTIVE USER ("_XQALSURO_") as a surrogate!" ;P44320 I XQALSURO=XQAUSER Q "You cannot specify yourself as your own surrogate!" ; moved in P44321 20 I $G(XQASTRT)>0 Q $$DCYCLIC^XQALSUR1(XQALSURO,XQAUSER,XQASTRT,$G(XQAEND)) 22 21 N XQALSTRT 22 I XQALSURO=XQAUSER Q "You cannot specify yourself as your own surrogate!" 23 23 S XQALSTRT=$$CURRSURO(XQALSURO) I XQALSTRT>0 D 24 . I XQALSTRT=XQAUSER S XQALSURO="YOU are designated as the surrogate for this user ("_XQALSURO_")- can't do it!" Q24 . I XQALSTRT=XQAUSER S XQALSURO="YOU are designated as the surrogate for this user - can't do it!" Q 25 25 . F S XQALSTRT=$$CURRSURO(XQALSTRT) Q:XQALSTRT'>0 I XQALSTRT=XQAUSER S XQALSURO="This forms a circle which leads back to you - can't do it!" Q 26 26 . Q 27 27 Q XQALSURO 28 28 ; 29 SETSURO(XQAUSER,XQALSURO,XQALSTRT,XQALEND) ; Use SETSURO1 instead 30 N XQALVAL ; P443 31 S XQALVAL=$$SETSURO1(XQAUSER,XQALSURO,$G(XQALSTRT),$G(XQALEND)) ; P443 32 Q 33 ; 34 SETSUROX(XQAUSER,XQALSURO,XQALSTRT,XQALEND) ; SETSURO CODE MOVED TO HERE TO PERMIT AN ERROR TO BE GENERATED AT THE OLD ENTRY POINT 29 SETSURO(XQAUSER,XQALSURO,XQALSTRT,XQALEND) ; SR 35 30 N XQALFM,XQALIEN,XQAIENS 36 31 I $G(XQAUSER)'>0 Q … … 60 55 S XMSUB="Surrogate Recipient for "_$$GET1^DIQ(200,XQAIENS,.01,"E") 61 56 S XMTEXT="XQAMESG(" 62 ; ZEXCEPT: XTMUNIT - Defined if unit tests are being run 63 D:'$D(XTMUNIT) SENDMESG 57 D:'$D(XQATEST) SENDMESG 64 58 Q 65 59 ; … … 80 74 N XQAVAL 81 75 S XQAVAL=$$CYCLIC(XQALSURO,XQAUSER,XQALSTRT,$G(XQALEND)) I XQAVAL'>0 Q XQAVAL ; Can't use as surrogate 82 D SETSURO X(XQAUSER,XQALSURO,XQALSTRT,$G(XQALEND)) ; P44376 D SETSURO(XQAUSER,XQALSURO,XQALSTRT,$G(XQALEND)) 83 77 Q XQALSURO 84 78 ; … … 108 102 ; 109 103 ; P366 - find the latest start time which is now or past or the first one in the future 110 S XQANOW=$$NOW^XLFDT() D 104 S XQANOW=$$NOW^XLFDT() 105 ;I $P($G(^XTV(8992,XQAUSER,0)),U,2)'>0 D 106 D 111 107 . S XQAIVAL=0,XQASTR1=0 112 108 . F XQASTRT=0:0 S XQASTRT=$O(^XTV(8992,XQAUSER,2,"B",XQASTRT)) Q:XQASTRT'>0 Q:XQASTRT'<XQANOW S XQASTR1=XQASTRT F XQAI=0:0 S XQAI=$O(^XTV(8992,XQAUSER,2,"B",XQASTRT,XQAI)) Q:XQAI'>0 D … … 124 120 I $P(X,U,2)>0,+$P(X,U,3)'>XQANOW D I $P($G(^XTV(8992,XQAUSER,0)),U,2)>0 Q +$P(^XTV(8992,XQAUSER,0),U,2) 125 121 . N DATE ; Get Current date/time to check date/times if present 126 . ; FOLLOWING LINES MODIFIED IN P443 TO ELIMINATE A STACK ERROR WHEN SURROGATE WAS CIRCULAR 127 . ; Current Date/time past End date for surrogate 128 . S DATE=$P(X,U,4) I (DATE>0&(DATE<XQANOW)) D REMVSURO(XQAUSER) Q 129 . N XQASURO,XQASURO1 S XQASURO1=+$P(^XTV(8992,XQAUSER,0),U,2) 130 . ; REMOVE IF SURROGATE IS USER 131 . I XQASURO1=XQAUSER D REMVSURO(XQAUSER) Q 132 . N XQALLIST S XQALLIST(XQAUSER)="" 133 . ; REMOVE IF CYCLES BACK TO USER - thought about removing inactive, but best to let those be handled by groups for unprocessed alerts 134 . F S XQASURO=$P($G(^XTV(8992,XQASURO1,0)),U,2) Q:XQASURO'>0 Q:'$$ISACTIVE(XQASURO) S XQASURO1=XQASURO D 135 . . I $D(XQALLIST(XQASURO)) D REMVSURO(XQASURO) S XQASURO1=XQAUSER K XQALLIST S XQALLIST(XQAUSER)="" Q 136 . . S XQALLIST(XQASURO1)="" 137 . . Q 138 . ; END OF P443 MODIFICATION 122 . ; Current Date/time past End date for surrogate or cyclic relationship remove checks for new surrogate 123 . S DATE=$P(X,U,4) I (DATE>0&(DATE<XQANOW))!('$$CYCLIC($P(X,U,2),XQAUSER)) D REMVSURO(XQAUSER) 139 124 . Q 140 125 Q -1 141 ;142 ISACTIVE(XQAUSER) ; checks for whether a surrogate relationship is active or not (returns 0 or 1)143 N DATA144 S DATA=$G(^XTV(8992,XQAUSER,0)) Q:$P(DATA,U,2)="" 0 ; NO SURROGATE SPECIFIED145 I $P(DATA,U,3)>0,$P(DATA,U,3)>$$NOW^XLFDT() Q 0 ; START DATE/TIME NOT YET146 I $P(DATA,U,4)>0,$P(DATA,U,4)<$$NOW^XLFDT() Q 0 ; PAST END DATE/TIME147 Q 1148 126 ; 149 127 ACTVSURO(XQAUSER) ;SR. - returns the actual surrogate at this time
Note:
See TracChangeset
for help on using the changeset viewer.