| 1 | TIUFIX2 ; SLC/JER,MAM - Resolve Upload Filing Errors Library Two ;05/06/02
 | 
|---|
| 2 |  ;;1.0;TEXT INTEGRATION UTILITIES;**131**;Jun 20, 1997
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | BUFFER(TIUEVNT) ; Return 8925.2 Upload Buffer IEN
 | 
|---|
| 5 |  ; Gets Buffer for UNRESOLVED upload errors. (Returns error msg
 | 
|---|
| 6 |  ;for resolved filing errors, where buffer is 0.)
 | 
|---|
| 7 |  ; Requires [TIUEVNT] - Upload Log Event IEN (8925.4)
 | 
|---|
| 8 |  N TIUBUF
 | 
|---|
| 9 |  I '$D(^TIU(8925.4,TIUEVNT,0)) S TIUBUF="0^Invalid Upload Log event." G BUFX
 | 
|---|
| 10 |  S TIUBUF=+$P($G(^TIU(8925.4,TIUEVNT,0)),U,5)
 | 
|---|
| 11 |  I TIUBUF'>0 S TIUBUF="0^Upload Buffer record is missing from Upload Log event." G BUFX
 | 
|---|
| 12 |  I '$D(^TIU(8925.2,TIUBUF,0)) S TIUBUF="0^Upload Log event references an invalid Upload Buffer record."
 | 
|---|
| 13 | BUFX Q TIUBUF
 | 
|---|
| 14 |  ;
 | 
|---|
| 15 | LOADHDR(TIUARR,TIUBUF,TIUPRM0,TIUTYPE) ; Load array with header data
 | 
|---|
| 16 |  ;from upload buffer
 | 
|---|
| 17 |  ; Requires [TIUARR] - Array of header data.  Loaded and passed back
 | 
|---|
| 18 |  ;          [TIUBUF] - 8925.2 Upload Buffer IEN
 | 
|---|
| 19 |  ;          [TIUPRM0] - Header signal, etc.  See SETPARM^TIULE
 | 
|---|
| 20 |  ;          [TIUTYPE] - IEN of Docmt Def whose Filing Error
 | 
|---|
| 21 |  ;                      Resolution Code is being invoked
 | 
|---|
| 22 |  ;NOTE: LOADHDR does NOT kill ANY nodes of TIUARR.
 | 
|---|
| 23 |  ;      (LOADTIUX^TIUPEFIX does kill certain nodes.)
 | 
|---|
| 24 |  ;      See warning in MAKE^TIUFIX1 concerning possible
 | 
|---|
| 25 |  ;      need to kill nodes of array.
 | 
|---|
| 26 |  N TIUI,TIUHSIG,TIUBGN,TIULINE
 | 
|---|
| 27 |  S TIUHSIG=$P(TIUPRM0,U,10),TIUBGN=$P(TIUPRM0,U,12)
 | 
|---|
| 28 |  S TIUI=0 F  S TIUI=$O(^TIU(8925.2,+TIUBUF,"TEXT",TIUI)) Q:+TIUI'>0  D
 | 
|---|
| 29 |  . S TIULINE=$G(^TIU(8925.2,+TIUBUF,"TEXT",TIUI,0))
 | 
|---|
| 30 |  . I TIULINE[TIUHSIG D
 | 
|---|
| 31 |  . . F  D  Q:TIULINE[TIUBGN!(+TIUI'>0)
 | 
|---|
| 32 |  . . . N TIUN,TIUCAP,TIUFLD,TIUREQ S TIUREQ=0
 | 
|---|
| 33 |  . . . S TIUI=$O(^TIU(8925.2,+TIUBUF,"TEXT",TIUI)) Q:+TIUI'>0
 | 
|---|
| 34 |  . . . S TIULINE=$G(^TIU(8925.2,+TIUBUF,"TEXT",TIUI,0)) Q:TIULINE[TIUBGN
 | 
|---|
| 35 |  . . . S TIUCAP=$P(TIULINE,":") Q:TIUCAP']""
 | 
|---|
| 36 |  . . . ; -- Get upload header definition data for transcribed
 | 
|---|
| 37 |  . . . ;    caption:
 | 
|---|
| 38 |  . . . S TIUN=$O(^TIU(8925.1,TIUTYPE,"HEAD","B",TIUCAP,0))
 | 
|---|
| 39 |  . . . Q:+TIUN'>0
 | 
|---|
| 40 |  . . . S TIUFLD=$P(^TIU(8925.1,TIUTYPE,"HEAD",+TIUN,0),U,3)
 | 
|---|
| 41 |  . . . ; -- Ignore caption if hdr def does not associate a
 | 
|---|
| 42 |  . . . ;    field number with it:
 | 
|---|
| 43 |  . . . Q:TIUFLD']""
 | 
|---|
| 44 |  . . . S TIUREQ=$P(^TIU(8925.1,TIUTYPE,"HEAD",+TIUN,0),U,7)
 | 
|---|
| 45 |  . . . S TIUARR(TIUFLD)=$$STRIP^TIULS($P(TIULINE,":",2,99))
 | 
|---|
| 46 |  . . . S TIUARR(TIUFLD)=$$TRNSFRM(TIUTYPE,TIUFLD,TIUARR(TIUFLD))
 | 
|---|
| 47 |  . . . ; -- If caption has no data, and hdr def requires data,
 | 
|---|
| 48 |  . . . ;    set node to create missing field msg in FILE^TIUFIX1.
 | 
|---|
| 49 |  . . . ;    For most fields, "** REQUIRED FIELD MISSING FROM
 | 
|---|
| 50 |  . . . ;    UPLOAD**" will be invalid data and will not file.
 | 
|---|
| 51 |  . . . ;    If field is free text so that it does file, at
 | 
|---|
| 52 |  . . . ;    least it's intelligible.
 | 
|---|
| 53 |  . . . I +TIUREQ,TIUARR(TIUFLD)="" S TIUARR(TIUFLD)="** REQUIRED FIELD MISSING FROM UPLOAD **"
 | 
|---|
| 54 |  ; -- Leave missing captions fix til later; TIUPUTC1?? needs
 | 
|---|
| 55 |  ;    same change 4/21/02:
 | 
|---|
| 56 |  ; -- Set nodes for any captions required in upload hdr
 | 
|---|
| 57 |  ;    def but missing from buffer.  Check only captions that
 | 
|---|
| 58 |  ;    do NOT have Lookup variables, since that info is supplied
 | 
|---|
| 59 |  ;    by user and is not a missing field.  Even if set here,
 | 
|---|
| 60 |  ;    message will be created only for nodes not killed before
 | 
|---|
| 61 |  ;    filing.
 | 
|---|
| 62 |  ;N TIUCAP,TIUREQ,TIUFLD,LOOKV
 | 
|---|
| 63 |  ;S TIUCAP=""
 | 
|---|
| 64 |  ;S TIUCAP=$O(^TIU(8925.1,TIUTYPE,"HEAD","B",TIUCAP)) Q:TIUCAP=""  D
 | 
|---|
| 65 |  ;. S TIUN=$O(^TIU(8925.1,TIUTYPE,"HEAD","B",TIUCAP,0))
 | 
|---|
| 66 |  ;. S TIUREQ=$P(^TIU(8925.1,TIUTYPE,"HEAD",+TIUN,0),U,7)
 | 
|---|
| 67 |  ;. Q:'TIUREQ
 | 
|---|
| 68 |  ;. S TIUFLD=$P(^TIU(8925.1,TIUTYPE,"HEAD",+TIUN,0),U,3)
 | 
|---|
| 69 |  ;. Q:'TIUFLD
 | 
|---|
| 70 |  ;. S LOOKV=$P(^TIU(8925.1,TIUTYPE,"HEAD",+TIUN,0),U,4)
 | 
|---|
| 71 |  ;. Q:LOOKV]""
 | 
|---|
| 72 |  ;. I '$D(TIUARR(TIUFLD)) S TIUARR(TIUFLD)="** REQUIRED CAPTION MISSING FROM UPLOAD **"
 | 
|---|
| 73 |  Q
 | 
|---|
| 74 | TRNSFRM(RTYPE,FLD,X) ; Executes Transform code for a given header field
 | 
|---|
| 75 |  N XFORM
 | 
|---|
| 76 |  S FLD=$O(^TIU(8925.1,+RTYPE,"HEAD","D",+FLD,0))
 | 
|---|
| 77 |  I +FLD'>0 G TRNSFRMX
 | 
|---|
| 78 |  S XFORM=$G(^TIU(8925.1,+RTYPE,"HEAD",+FLD,1))
 | 
|---|
| 79 |  I XFORM']"" G TRNSFRMX
 | 
|---|
| 80 |  X XFORM
 | 
|---|
| 81 | TRNSFRMX Q X
 | 
|---|