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

ORY44C.m

Go to the documentation of this file.
  1. ORY44C ; SLC/PKS OE/RR - Delete Personal lists for terminated users. ; [2/21/00 1:02pm]
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**44**;Dec 17, 1997
  1. ;
  1. Q
  1. ;
  1. EN ; Clean out Team Lists of type "Personal" with only one user when
  1. ; user has been terminated.
  1. ;
  1. N DIK,DA,Y,ORLPTYPE,ORLPTEAM,ORLPCNT,ORLPFRST,ORLPUSER,ORLPTNM
  1. ;
  1. ; Order through each team in the file:
  1. S ORLPTEAM=0
  1. F S ORLPTEAM=$O(^OR(100.21,ORLPTEAM)) Q:+ORLPTEAM=0 D
  1. .;
  1. .; Find out if team is "Personal" type:
  1. .I $P(^OR(100.21,ORLPTEAM,0),U,2)="P" D
  1. ..;
  1. ..; Check users currently on team:
  1. ..S ORLPFRST=""
  1. ..S ORLPCNT=0
  1. ..S ORLPUSER=0
  1. ..F S ORLPUSER=$O(^OR(100.21,+ORLPTEAM,1,ORLPUSER)) Q:+ORLPUSER=0 D
  1. ...S ORLPCNT=ORLPCNT+1 ; Increment counter.
  1. ...I ORLPCNT=1 S ORLPFRST=ORLPUSER ; Get first user.
  1. ...I ORLPCNT>1 Q ; If more than one user, punt.
  1. ..;
  1. ..; Check for none or only one user:
  1. ..I ORLPCNT=0!'(ORLPFRST="") D
  1. ...;
  1. ...; Find out if user is terminated:
  1. ...I ORLPCNT=0!'($$ACTIVE^XUSER(+ORLPFRST)) D
  1. ....S ORLPTNM=$P(^OR(100.21,ORLPTEAM,0),U,1) ; Get name of Team List.
  1. ....;
  1. ....; Dump team if of type "Personal" (and only user is terminated):
  1. ....L +^OR(100.21,+ORLPTEAM):3 ; Handle file locking.
  1. ....S DIK="^OR(100.21,"
  1. ....S DA=+ORLPTEAM
  1. ....D ^DIK ; Delete the Team List.
  1. ....K DIK,DA,Y,% ; Clean up after call to DIK.
  1. ....L -^OR(100.21,+ORLPTEAM) ; Unlock the file.
  1. ....D MES^XPDUTL("Personal Team "_ORLPTNM_" / IEN "_+ORLPTEAM_" deleted.") ; Installation message to run under Taskman.
  1. ....;
  1. ....; Call Consults package code to delete pointers there:
  1. ....D CLNLIST^GMRCTU(+ORLPTEAM,1)
  1. ;
  1. Q
  1. ;