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

ORLPTU.m

Go to the documentation of this file.
  1. ORLPTU ; SLC/PKS OE/RR - Terminated users, pointer removal. ; [3/13/00 1:04pm]
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**44**;Dec 17, 1997
  1. ;
  1. ; OE/RR - Remove pointers from team lists file.
  1. ; The records to be edited are pointers to file #200, NEW PERSON.
  1. ; Routine is triggered by Kernel's XU USER TERMINATE event.
  1. ;
  1. ; This routine also removes the complete team list record from
  1. ; team file ^OR(100.21 if the Team List involved is a Personal
  1. ; type list and the terminated user is the only user on the list.
  1. ;
  1. ; Entries are removed from the following files::
  1. ;
  1. ; File Name File#,Field# Field Name
  1. ; -------------------------------------------------------------
  1. ; OE/RR LIST 100.21,2 USER
  1. ; OE/RR LIST 100.21,3 AUTOLINK
  1. ;
  1. ; The first example is a subfile multiple pointer and DINUM field.
  1. ; The second example is a subfile multiple variable pointer.
  1. ; Variable "USER" is DUZ of user for whom entries will be removed;
  1. ; it's value must be available to the routine from Kernel.
  1. ;
  1. ; =============================================================
  1. ;
  1. ; EXAMPLES of file entries with pointers being removed:
  1. ; (Where "777" is the USER) -
  1. ;
  1. ; ^OR(100.21,140,1,777,0) = 777
  1. ; ^OR(100,21,140,2,1,0) = 777;VA(200,^B
  1. ;
  1. ; =============================================================
  1. ;
  1. ; Variables used:
  1. ;
  1. ; USER = DUZ of terminated user.
  1. ; DIK,DA = Used by call to ^DIK.
  1. ; RFILE = Root file.
  1. ; IEN = Record IEN.
  1. ; SIEN = Subfile IEN.
  1. ; TEAM = IEN of team to kill if terminated user is only user.
  1. ; ORYDAT = File data holder.
  1. ;
  1. ; -------------------------------------------------------------
  1. ;
  1. Q
  1. ;
  1. PASS(TU) ; TU (Terminated User = USER variable) sent in call at this tag.
  1. ;
  1. N USER
  1. S USER=TU ; Assign USER variable.
  1. I USER="" Q ; Punt right away if there's a problem.
  1. D MAIN ; Skip next tag, go to main processing.
  1. Q
  1. ;
  1. KUSER ; Get USER from kernel - called by option: OR TERMINATE CLEANUP.
  1. ;
  1. N USER
  1. S USER=$GET(XUIFN) ; Assign USER variable.
  1. I USER="" Q ; Punt here if there's a problem.
  1. ;
  1. MAIN ; Processing portion of routine.
  1. ;
  1. N DIK,DA,RFILE,IEN,TEAM,CNT,SIEN,ORYDAT
  1. ;
  1. ; Order through the file for each team:
  1. S RFILE="^OR(100.21," ; Assign root file string.
  1. S IEN=0 ; Initialize.
  1. ;
  1. F S IEN=$ORDER(^OR(100.21,IEN)) Q:+IEN=0 D ; Each team.
  1. .S TEAM=""
  1. .S CNT=0
  1. .S SIEN=0
  1. .;
  1. .; Check and remove user from teams as applicable:
  1. .F CNT=0:1 S SIEN=$ORDER(^OR(100.21,IEN,1,SIEN)) Q:+SIEN=0 D
  1. ..I SIEN=USER D ; If user is on team, set FM vars and call DIK.
  1. ...N DA
  1. ...S DA=SIEN,DA(1)=IEN,DIK=RFILE_DA(1)_",1,"
  1. ...D ^DIK
  1. ...;
  1. ...; Set up for possible team kill if team type is "P" (Personal):
  1. ...I $P(^OR(100.21,IEN,0),"^",2)="P" S TEAM=IEN
  1. .;
  1. .; Check and remove user for AUTOLINKS if found:
  1. .S SIEN=0 ; Initialize again.
  1. .F S SIEN=$O(^OR(100.21,IEN,2,SIEN)) Q:+SIEN=0 D
  1. ..I +(^OR(100.21,IEN,2,SIEN,0))=USER D
  1. ...;
  1. ...; Check for correct type of AUTOLINK:
  1. ...S ORYDAT="^OR(100.21,"_IEN_",2,"_SIEN_",0)"
  1. ...I $G(@ORYDAT)'["VA" Q ; Not a ^VA(200 file pointer.
  1. ...;
  1. ...N DA
  1. ...S DA=SIEN,DA(1)=IEN,DIK=RFILE_DA(1)_",2,"
  1. ...D ^DIK
  1. .;
  1. .; Remove team entry altogether if terminated user is only user:
  1. .I CNT=1&'(TEAM="") D ; Set FM vars, call DIK, kill team entry.
  1. ..N DA
  1. ..S DA=TEAM,DIK=RFILE
  1. ..D ^DIK
  1. ..;
  1. ..; Call tag/routine to clean up pointers to the list in file 123.5:
  1. ..D CLNLIST^GMRCTU(TEAM,0)
  1. ;
  1. Q
  1. ;