Ignore:
Timestamp:
Jul 9, 2012, 7:43:46 PM (12 years ago)
Author:
Sam Habiel
Message:

Added/fixed the following:

  • Unit Tests for running everything through PIMS
  • Checks for end of message for error handling ((31))
  • All routines previously using transactions use locks now
File:
1 edited

Legend:

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

    r1472 r1479  
    1 BSDX08  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 7/5/12 12:39pm
     1BSDX08  ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 7/9/12 4:22pm
    22        ;;1.7T1;BSDX;;Jul 06, 2012;Build 18
    33        ;
     
    3737        Q
    3838        ;
    39 APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT)         ;EP
     39APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT)         ; Private EP
    4040        ;Called by RPC: BSDX CANCEL APPOINTMENT
    4141        ;Cancels existing appointment in BSDX APPOINTMENT and 44/2 subfiles
     
    6565        S ^BSDXTMP($J,BSDXI)="T00100ERRORID"_$C(30)
    6666        ;
     67        ; Turn off SDAM APPT PROTOCOL BSDX Entries
     68        N BSDXNOEV
     69        S BSDXNOEV=1 ;Don't execute BSDX CANCEL APPOINTMENT protocol
     70        ;
     71        ;;;test for error inside transaction. See if %ZTER works
     72        I $G(BSDXDIE1) N X S X=1/0
     73        ;
     74        ; Check appointment ID and whether it exists
     75        I '+BSDXAPTID D ERR(BSDXI,"-2~BSDX08: Invalid Appointment ID") Q
     76        I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"-3~BSDX08: Invalid Appointment ID") Q
     77        ;
    6778        ; Lock BSDX node, only to synchronize access to the globals.
    6879        ; It's not expected that the error will ever happen as no filing
    6980        ; is supposed to take 5 seconds.
    70         L +^BSDXAPPT(BSDXAPTID):5 I '$T D ERR(BSDXI,"-1~BSDX08: Appt record is locked. Please contact technical support.") Q
    71         ;
    72         ; Turn off SDAM APPT PROTOCOL BSDX Entries
    73         N BSDXNOEV
    74         S BSDXNOEV=1 ;Don't execute BSDX CANCEL APPOINTMENT protocol
    75         ;
    76         ;;;test for error inside transaction. See if %ZTER works
    77         I $G(BSDXDIE1) N X S X=1/0
    78         ;
    79         ; Check appointment ID and whether it exists
    80         I '+BSDXAPTID D ERR(BSDXI,"-2~BSDX08: Invalid Appointment ID") Q
    81         I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"-3~BSDX08: Invalid Appointment ID") Q
    82         ;
     81        L +^BSDXAPPT(BSDXAPTID):5 E  D ERR(BSDXI,"-1~BSDX08: Appt record is locked. Please contact technical support.") Q
     82        ;
    8383        ; Start Processing:
    8484        ; First, get data
     
    124124        ; BSDXAPPT First; no need for rollback if error occured.
    125125        N BSDXERR S BSDXERR=$$BSDXCAN(BSDXAPTID)  ; Add a cancellation date in BSDX APPOINTMENT
    126         I BSDXERR D ERR(BSDXI,"$$BSDXCAN failed (Fileman filing error): "_$P(BSDXERR,U,2)) QUIT
     126        I BSDXERR D ERR(BSDXI,"-10~BSDX08: $$BSDXCAN failed (Fileman filing error): "_$P(BSDXERR,U,2)) QUIT
    127127        ;
    128128        ; Then PIMS:
    129129        ; cancel appt in "S" nodes in file 2 and 44, then update Legacy PIMS Availability
    130130        ; If error happens, must rollback ^BSDXAPPT
    131         I BSDXLOC D  QUIT:BSDXERR
    132         . S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) ; Cancel through BSDXAPI
    133         . ; Rollback BSDXAPPT if error occurs
    134         . I BSDXERR D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXERR,U,2)),ROLLBACK(BSDXAPTID)  QUIT
     131        I BSDXLOC S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) ; Cancel through BSDXAPI
     132        ; Rollback BSDXAPPT if error occurs
     133        I BSDXERR D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXERR,U,2)),ROLLBACK(BSDXAPTID)  QUIT
    135134        ;
    136135        L -^BSDXAPPT(BSDXAPTID)
     
    186185        . S BSDXNOD=$G(^BSDXAPPT(BSDXAPPT,0)) Q:BSDXNOD=""
    187186        . I $P(BSDXNOD,U,5)=BSDXPAT,$P(BSDXNOD,U,12)="" S BSDXFOUND=1 Q
    188         I BSDXFOUND,+$G(BSDXAPPT) D BSDXCAN(BSDXAPPT)
     187        I BSDXFOUND,+$G(BSDXAPPT) N % S %=$$BSDXCAN(BSDXAPPT) I % D ^%ZTER
    189188        Q BSDXFOUND
    190189        ;
     
    201200        ;
    202201ERR(BSDXI,BSDXERR)      ;Error processing
     202        ; Unlock first
     203        L:$D(BSDXAPTID) -^BSDXAPPT(BSDXAPTID)
    203204        ; If last line is $C(31), we are done. No more errors to send to client.
    204205        I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT
     
    208209        S BSDXI=BSDXI+1
    209210        S ^BSDXTMP($J,BSDXI)=$C(31)
    210         L -^BSDXAPPT(BSDXAPTID)
    211211        QUIT
    212212        ;
     
    214214        N $ET S $ET="D ^%ZTER HALT"  ; Emergency Error Trap
    215215        D ^%ZTER
     216        ;
    216217        ; Roll back BSDXAPPT;
    217218        ; NB: What if a Mumps error happens inside fileman in BSDXAPI?
    218219        ; I have decided the M errors are out of scope for me to handle.
    219220        D:$G(BSDXAPTID) ROLLBACK(BSDXAPTID)
     221        ;
    220222        ; Log error message and send to client
    221223        I '$D(BSDXI) N BSDXI S BSDXI=0
Note: See TracChangeset for help on using the changeset viewer.