Changeset 963 for Scheduling/trunk


Ignore:
Timestamp:
Sep 28, 2010, 9:37:08 AM (14 years ago)
Author:
Sam Habiel
Message:

Updated files to intelligently deal with mulitple divisions issue

Location:
Scheduling/trunk/m
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/m/BSDX01.m

    r962 r963  
    1 BSDX01  ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 9/16/10 9:54am
     1BSDX01  ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 9/28/10 4:47pm
    22        ;;1.4;BSDX;;Sep 07, 2010
     3    ; Change Log:
     4    ; V 1.4.1 (Sep 28 2010): Separate user divisions based on $$INDIV.
     5    ; Affects:
     6    ; - RESUSR
     7    ; - DEPUSR
     8    ; - DEPRES
    39        ;
    410        ;
     
    3945        ;Called by BSDX RESOURCE GROUPS BY USER
    4046        ;Returns ADO Recordset with all ACTIVE resource group names to which user has access
    41         ;based on entries in BSDX RESOURCE USER file
     47        ;based on entries in BSDX RESOURCE USER file (Say this again for myself: Groups ONLY!!)
    4248        ;If BSDXDUZ=0 then returns all department names for current DUZ
     49    ;What is returned depends if it is in the same divsion as the hosptial location if it is linked
     50    ;if not linked, always returned.
    4351        ;If user BSDXDUZ possesses the key BSDXZMGR or XUPROGMODE
    4452        ;then ALL resource group names are returned regardless of whether any active resources
     
    6270        I 'BSDXMGR,$D(^BSDXRSU("AC",BSDXDUZ)) S BSDXIEN=0 F  S BSDXIEN=$O(^BSDXRSU("AC",BSDXDUZ,BSDXIEN)) Q:'+BSDXIEN  D
    6371        . S BSDXRES=$P(^BSDXRSU(BSDXIEN,0),U)
    64         . Q:'$D(^BSDXDEPT("AB",BSDXRES))
     72        . Q:'$D(^BSDXDEPT("AB",BSDXRES))  ; If not part of a group, quit ("AB" is the whole file index for the resource multiple in Group file)
     73    . Q:'$$INDIV2(BSDXRES)  ; If not in the same division as user, quit
    6574        . S BSDXRNOD=^BSDXRES(BSDXRES,0)
    6675        . ;QUIT if the resource is inactive
     
    178187        ;Returns ADO Recordset with all ACTIVE GROUP/RESOURCE combinations
    179188        ;to which user has access based on entries in BSDX RESOURCE USER file
     189    ;by Division (set in DUZ(2))
    180190        ;If BSDXDUZ=0 then returns all ACTIVE GROUP/RESOURCE combinations for current DUZ
    181191        ;If user BSDXDUZ possesses the key BSDXZMGR or XUPROGMODE
     
    198208        I 'BSDXMGR,$D(^BSDXRSU("AC",BSDXDUZ))  S BSDXIEN=0 F  S BSDXIEN=$O(^BSDXRSU("AC",BSDXDUZ,BSDXIEN)) Q:'+BSDXIEN  D
    199209        . S BSDXRES=$P(^BSDXRSU(BSDXIEN,0),U)
    200         . Q:'$D(^BSDXDEPT("AB",BSDXRES))
     210        . Q:'$D(^BSDXDEPT("AB",BSDXRES))  ; Quit if Resource isn't part of any Group
     211    . Q:'$$INDIV2(BSDXRES)  ; Quit if Resource isn't in same division as user.
    201212        . S BSDXRNOD=$G(^BSDXRES(BSDXRES,0))
    202213        . Q:BSDXRNOD=""
     
    220231        . S BSDXRES=0 F  S BSDXRES=$O(^BSDXDEPT(BSDXIEN,1,BSDXRES)) Q:'+BSDXRES  D
    221232        . . N BSDXRESD
    222         . . Q:'$D(^BSDXDEPT(BSDXIEN,1,BSDXRES,0))
     233        . . Q:'$D(^BSDXDEPT(BSDXIEN,1,BSDXRES,0))  ; Quit if zero node is invalid in multiple
    223234        . . S BSDXRESD=$P(^BSDXDEPT(BSDXIEN,1,BSDXRES,0),"^")
    224         . . Q:'$D(^BSDXRES(BSDXRESD,0))
     235        . . Q:'$D(^BSDXRES(BSDXRESD,0))  ; Quit if zero node of resouce file is invalid
     236    . . Q:'$$INDIV2(BSDXRESD)  ; Quit if resource is not in the same division
    225237        . . S BSDXRNOD=$G(^BSDXRES(BSDXRESD,0))
    226238        . . Q:BSDXRNOD=""
     
    257269        Q 1
    258270INDIV(BSDXSC) ; PEP - Is ^SC clinic in the same DUZ(2) as user?
     271    ; Input: BSDXSC - Hospital Location IEN
     272    ; Output: True or False
    259273    I '+BSDXSC QUIT 1  ;If not tied to clinic, yes
    260274    I '$D(^SC(BSDXSC,0)) QUIT 1 ; If Clinic does not exist, yes
     
    266280    E  Q 0 ; Otherwise, no
    267281    QUIT
     282INDIV2(BSDXRES) ; PEP - Is Resource in the same DUZ(2) as user?
     283    ; Input BSDXRES - BSDX RESOURCE IEN
     284    ; Output: True of False
     285    Q $$INDIV($P($G(^BSDXRES(BSDXRES,0)),U,4)) ; Extract Hospital Location and send to $$INDIV
    268286UnitTestINDIV
    269287    W "Testing if they are the same",!
     
    280298    I $$INDIV(2) W "ERROR",!
    281299    QUIT
     300UnitTestINDIV2
     301    W "Testing if they are the same",!
     302    S DUZ(2)=69
     303    I $$INDIV2(22)'=0 W "ERROR",!
     304    I $$INDIV2(25)'=1 W "ERROR",!
     305    I $$INDIV2(26)'=1 W "ERROR",!
     306    I $$INDIV2(27)'=1 W "ERROR",!
     307    QUIT
  • Scheduling/trunk/m/BSDX32.m

    r951 r963  
    2020HOSPLOC(BSDXY)  ;EP
    2121        ;Called by BSDX HOSPITAL LOCATION
     22    ;Returns all hospital locations that are active AND in the same division as the user
    2223        ;
    2324        N BSDXI,BSDXIEN,BSDXNOD,BSDXNAM,BSDXINA,BSDXREA,BSDXSCOD
     
    3334        . Q:'+BSDXIEN>0
    3435        . Q:'$D(^SC(+BSDXIEN,0))
     36    . Q:'$$INDIV^BSDX01(+BSDXIEN)  ; if not in the same division, quit
    3537        . S BSDXINA=$$GET1^DIQ(44,BSDXIEN_",",2505) ;INACTIVATE
    3638        . S BSDXREA=$$GET1^DIQ(44,BSDXIEN_",",2506) ;REACTIVATE
Note: See TracChangeset for help on using the changeset viewer.