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/BSDX26.m

    r1472 r1479  
    1 BSDX26   ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/25/12 4:29pm
     1BSDX26   ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 7/9/12 2:19pm
    22        ;;1.7T1;BSDX;;Jul 06, 2012;Build 18
    33        ; Licensed under LGPL
     
    88        ;
    99        ; Error Reference:
    10         ; -1: Appt ID is not a number
    11         ; -2: Appt IEN is not in ^BSDXAPPT
    12         ; -3: FM Failure to file WP field in ^BSDXAPPT
    13         ; -4: BSDXAPI reports failure to change note field in ^SC
     10        ; 1: Appt ID is not a number
     11        ; 2: Appt IEN is not in ^BSDXAPPT
     12        ; 3: FM Failure to file WP field in ^BSDXAPPT
     13        ; 4: BSDXAPI reports failure to change note field in ^SC
     14        ; 5: Failure to acquire lock on ^BSDXAPPT(APPTID)
     15        ; 100: Mumps Error
     16        ;
     17        ; NB: Normally I use negative numbers for errors; this routine returns
     18        ;     -1 as a successful result! So I needed to use +ve numbers.
    1419        ;
    1520EDITAPTD(BSDXY,BSDXAPTID,BSDXNOTE)       ;EP
     
    4853        ;
    4954        ; Validate Appointment ID
    50         I '+BSDXAPTID D ERR(BSDXI,"-1~BSDX26: Invalid Appointment ID") QUIT
    51         I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"-2~BSDX26: Invalid Appointment ID") QUIT
     55        I '+BSDXAPTID D ERR(BSDXI,"1~BSDX26: Invalid Appointment ID") QUIT
     56        I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"2~BSDX26: Invalid Appointment ID") QUIT
     57        ;
     58        ; Lock BSDX node, only to synchronize access to the globals.
     59        ; It's not expected that the error will ever happen as no filing
     60        ; is supposed to take 5 seconds.
     61        L +^BSDXAPPT(BSDXAPTID):5 E  D ERR(BSDXI,"5~BSDX08: Appt record is locked. Please contact technical support.") QUIT
    5262        ;
    5363        ; Put the WP in decendant fields from the root to file as a WP field
     
    6575        ;
    6676        ; Error handling. No need for rollback since nothing else changed.
    67         I $D(BSDXMSG) D ERR(BSDXI,"-3~BSDX26: Fileman failure to file data into 9002018.4") QUIT
     77        I $D(BSDXMSG) D ERR(BSDXI,"3~BSDX26: Fileman failure to file data into 9002018.4") QUIT
    6878        ;
    6979        ; Now file in file 44:
     
    7383        N BSDXRES S BSDXRES=0 ; Result
    7484        ; Update Note only if we have a linked hospital location.
    75         I HLIEN S BSDXRES=$$UPDATENT^BSDXAPI(PTIEN,HLIEN,DATE,BSDXNOTE(.5))
     85        I HLIEN S BSDXRES=$$UPDATENT^BSDXAPI1(PTIEN,HLIEN,DATE,BSDXNOTE(.5))
    7686        ; If we get an error (denoted by -1 in BSDXRES), return error to client
    7787        ; AND restore the original note
    78         I BSDXRES<0 D ERR(BSDXI,"-4~BSDX26: BSDXAPI reports an error: "_BSDXRES),ROLLBACK(BSDXAPTID) QUIT
     88        I BSDXRES<0 D ERR(BSDXI,"4~BSDX26: BSDXAPI reports an error: "_BSDXRES),ROLLBACK(BSDXAPTID) QUIT
    7989        ;
    8090        ;Return Recordset indicating success
     91        L -^BSDXAPPT(BSDXAPTID)
    8192        S BSDXI=BSDXI+1
    8293        S ^BSDXTMP($J,BSDXI)="-1"_$C(30)
     
    93104        ;
    94105ERR(BSDXI,BSDXERR)       ;Error processing
     106        ; Unlock first
     107        L:$D(BSDXAPTID) -^BSDXAPPT(BSDXAPTID)
     108        ; If last line is $C(31), we are done. No more errors to send to client.
     109        I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT
    95110        S BSDXI=BSDXI+1
    96111        S BSDXERR=$TR(BSDXERR,"^","~")
     
    103118        N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap
    104119        D ^%ZTER
    105         S $EC=""
     120        ;
    106121        I '$D(BSDXI) N BSDXI S BSDXI=0
    107         D ERR(BSDXI,"-100~BSDX26 Error: "_$G(%ZTERZE))
     122        D ERR(BSDXI,"100~BSDX26 Error: "_$G(%ZTERZE))
    108123        QUIT
Note: See TracChangeset for help on using the changeset viewer.