FSCRPCEC ;SLC/STAFF-NOIS RPC Edit Call ;9/6/98 21:56
;;1.1;NOIS;;Sep 06, 1998
;
EDIT(IN,OUT) ; from FSCRPX (RPCEditCall)
N CALL,EDITED,FIELDS K FIELDS
K ^TMP("FSC WP",$J)
D PROCESS^FSCRPCNC(.FIELDS)
S CALL=+$G(FIELDS("CALL"))
I 'CALL Q
I $O(^TMP("FSCRPC",$J,"INPUT",1)) D
.D FIELDS(CALL,.FIELDS,.EDITED)
.I EDITED D MRE^FSCMR(DUZ,CALL),UPDATE^FSCAUDIT(CALL)
S ^TMP("FSCRPC",$J,"OUTPUT",1)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
K ^TMP("FSC WP",$J)
Q
;
FIELDS(CALL,FIELDS,EDITED) ; from FSCRPCEN
N DR,OK,STATUS,WOLDV,WNEWV K WOLDV,WNEWV
S EDITED=0
I $O(^TMP("FSC WP",$J,"DESC",0)) D
.D DESC^FSCRPCNC(CALL)
.S WOLDV("DESC")=1,WNEWV("DESC")=2
.D DESC^FSCAUDIT(CALL,.WOLDV,.WNEWV) ; forces audit update
D NOTE^FSCRPCNC(CALL)
S DR=""
I $L($G(FIELDS("SUBJECT"))) S DR=DR_";1///"_$$FIX(FIELDS("SUBJECT"))
I $D(FIELDS("SUBJECT")),FIELDS("SUBJECT")="" S DR=DR_";1///@"
I $L($G(FIELDS("PHONE"))) S DR=DR_";2.2///"_$$FIX(FIELDS("PHONE"))
I $D(FIELDS("PHONE")),FIELDS("PHONE")="" S DR=DR_";2.2///@"
I $L($G(FIELDS("PATCH"))) S DR=DR_";7///"_$$FIX(FIELDS("PATCH"))
I $D(FIELDS("PATCH")),FIELDS("PATCH")="" S DR=DR_";7///@"
I $L($G(FIELDS("KEYWORDS"))) S DR=DR_";1.5///"_$$FIX(FIELDS("KEYWORDS"))
I $D(FIELDS("KEYWORDS")),FIELDS("KEYWORDS")="" S DR=DR_";1.5///@"
I $L(DR)>100 D SETUP(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
I $G(FIELDS("MOD")) S DR=DR_";3///`"_+FIELDS("MOD")
I $D(FIELDS("MOD")),FIELDS("MOD")="" S DR=DR_";3///@"
I $G(FIELDS("IRM")) S DR=DR_";2.1///`"_+FIELDS("IRM")
I $D(FIELDS("IRM")),FIELDS("IRM")="" S DR=DR_";2.1///@"
I $G(FIELDS("PRI")) S DR=DR_";6///`"_+FIELDS("PRI")
I $D(FIELDS("PRI")),FIELDS("PRI")="" S DR=DR_";6///@"
I $G(FIELDS("SPEC")) S DR=DR_";5///`"_+FIELDS("SPEC")
I $D(FIELDS("SPEC")),FIELDS("SPEC")="" S DR=DR_";5///@"
I $G(FIELDS("SPECD")) S DR=DR_";5.1///`"_+FIELDS("SPECD")
I $D(FIELDS("SPECD")),FIELDS("SPECD")="" S DR=DR_";5.1///@"
I $G(FIELDS("DEVSUB")) S DR=DR_";3.2///`"_+FIELDS("DEVSUB")
I $D(FIELDS("DEVSUB")),FIELDS("DEVSUB")="" S DR=DR_";3.2///@"
D SETUP(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
S STATUS=+$G(FIELDS("STATUS"))
I STATUS=2 D I 'OK Q
.S OK=1
.S DR="81///`"_DUZ
.I $G(FIELDS("FUNC")) S DR=DR_";8///`"_+FIELDS("FUNC")
.I $G(FIELDS("TASK")) S DR=DR_";9///`"_+FIELDS("TASK")
.I $L($G(FIELDS("DATEC"))) S DR=DR_";82///"_FIELDS("DATEC")
.I $L(DR) D I 'OK Q
..N DA,DIE,X,Y
..I $E(DR)=";" S DR=$E(DR,2,245)
..S DA=CALL,DIE="^FSCD(""CALL"","
..L +^FSCD("CALL",DA):30 I '$T S OK=0 Q ; *** needs ok
..D ^DIE
..L -^FSCD("CALL",DA)
..D PICKUP^FSCES(DA)
..S DR=""
.D RES^FSCRPCNC(CALL)
D STATUS(CALL,STATUS,.EDITED)
Q
;
FIX(VALUE) ; $$(input) -> correct for invalid characters
N NEWVALUE
S NEWVALUE=$TR(VALUE,";""^","~~~")
I $E(NEWVALUE)="-" S NEWVALUE="~"_$E(NEWVALUE,2,245)
I VALUE="?" S NEWVALUE="@"
Q NEWVALUE
;
SETUP(DA,DIE,DR,EDITED) ; from FSCRPCEF
N ABBREV,CALLNUM,NEWV,OLDV,X,Y K NEWV,OLDV
S CALLNUM=DA
I '$L(DR),$O(^TMP("FSC WP",$J,"NOTE",0)) D Q
.D UPDATE^FSCTASK(CALLNUM) S EDITED=1
I '$L(DR) Q
I $E(DR)=";" S DR=$E(DR,2,245)
F ABBREV="SUBJECT","IRM","PHONE","MOD","SPEC","SPECD","PRI","PATCH","DEVSUB","KEYWORDS" S OLDV(ABBREV)=""
D GET^FSCGET("CUSTOM",CALLNUM,.OLDV)
L +^FSCD("CALL",DA):30 I '$T Q ; *** needs ok
D ^DIE
L -^FSCD("CALL",DA)
D PICKUP^FSCES(DA)
M NEWV=OLDV D GET^FSCGET("CUSTOM",CALLNUM,.NEWV)
D AUDIT^FSCAUDIT(CALLNUM,.OLDV,.NEWV)
D UPDATE^FSCTASK(CALLNUM) S EDITED=1
S DR=""
Q
;
STATUS(CALL,STATUS,EDITED) ; from FSCRPCEF
I 'STATUS Q
N PREVSTAT
S PREVSTAT=+$P(^FSCD("CALL",+CALL,0),U,17)
I PREVSTAT<2 S PREVSTAT=+$P(^FSCD("CALL",+CALL,0),U,2)
I PREVSTAT=0 D Q
.D STATUS^FSCES(CALL,"",1)
.D UPDATE^FSCTASK(CALL) S EDITED=1
.I STATUS'=1 D
..D STATUS^FSCES(CALL,1,STATUS)
..D UPDATE^FSCTASK(CALL) S EDITED=1
I STATUS,PREVSTAT=STATUS Q
D STATUS^FSCES(CALL,PREVSTAT,STATUS)
D UPDATE^FSCTASK(CALL) S EDITED=1
Q
;
REOPEN(IN,OUT) ; from FSCRPX (RPCReopenCall)
N CALL,OLDSTAT
S CALL=+$G(^TMP("FSCRPC",$J,"INPUT",1))
I 'CALL Q
S OLDSTAT=+$P($G(^FSCD("CALL",CALL,0)),U,2)
I '(OLDSTAT=2!(OLDSTAT=99)) Q
D STATUS^FSCES(CALL,OLDSTAT,1,1)
D UPDATE^FSCTASK(CALL)
D MRE^FSCMR(DUZ,CALL)
D UPDATE^FSCAUDIT(CALL)
S ^TMP("FSCRPC",$J,"OUTPUT",1)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPCEC 4353 printed Dec 13, 2024@02:19:17 Page 2
FSCRPCEC ;SLC/STAFF-NOIS RPC Edit Call ;9/6/98 21:56
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
EDIT(IN,OUT) ; from FSCRPX (RPCEditCall)
+1 NEW CALL,EDITED,FIELDS
KILL FIELDS
+2 KILL ^TMP("FSC WP",$JOB)
+3 DO PROCESS^FSCRPCNC(.FIELDS)
+4 SET CALL=+$GET(FIELDS("CALL"))
+5 IF 'CALL
QUIT
+6 IF $ORDER(^TMP("FSCRPC",$JOB,"INPUT",1))
Begin DoDot:1
+7 DO FIELDS(CALL,.FIELDS,.EDITED)
+8 IF EDITED
DO MRE^FSCMR(DUZ,CALL)
DO UPDATE^FSCAUDIT(CALL)
End DoDot:1
+9 SET ^TMP("FSCRPC",$JOB,"OUTPUT",1)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
+10 KILL ^TMP("FSC WP",$JOB)
+11 QUIT
+12 ;
FIELDS(CALL,FIELDS,EDITED) ; from FSCRPCEN
+1 NEW DR,OK,STATUS,WOLDV,WNEWV
KILL WOLDV,WNEWV
+2 SET EDITED=0
+3 IF $ORDER(^TMP("FSC WP",$JOB,"DESC",0))
Begin DoDot:1
+4 DO DESC^FSCRPCNC(CALL)
+5 SET WOLDV("DESC")=1
SET WNEWV("DESC")=2
+6 ; forces audit update
DO DESC^FSCAUDIT(CALL,.WOLDV,.WNEWV)
End DoDot:1
+7 DO NOTE^FSCRPCNC(CALL)
+8 SET DR=""
+9 IF $LENGTH($GET(FIELDS("SUBJECT")))
SET DR=DR_";1///"_$$FIX(FIELDS("SUBJECT"))
+10 IF $DATA(FIELDS("SUBJECT"))
IF FIELDS("SUBJECT")=""
SET DR=DR_";1///@"
+11 IF $LENGTH($GET(FIELDS("PHONE")))
SET DR=DR_";2.2///"_$$FIX(FIELDS("PHONE"))
+12 IF $DATA(FIELDS("PHONE"))
IF FIELDS("PHONE")=""
SET DR=DR_";2.2///@"
+13 IF $LENGTH($GET(FIELDS("PATCH")))
SET DR=DR_";7///"_$$FIX(FIELDS("PATCH"))
+14 IF $DATA(FIELDS("PATCH"))
IF FIELDS("PATCH")=""
SET DR=DR_";7///@"
+15 IF $LENGTH($GET(FIELDS("KEYWORDS")))
SET DR=DR_";1.5///"_$$FIX(FIELDS("KEYWORDS"))
+16 IF $DATA(FIELDS("KEYWORDS"))
IF FIELDS("KEYWORDS")=""
SET DR=DR_";1.5///@"
+17 IF $LENGTH(DR)>100
DO SETUP(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
+18 IF $GET(FIELDS("MOD"))
SET DR=DR_";3///`"_+FIELDS("MOD")
+19 IF $DATA(FIELDS("MOD"))
IF FIELDS("MOD")=""
SET DR=DR_";3///@"
+20 IF $GET(FIELDS("IRM"))
SET DR=DR_";2.1///`"_+FIELDS("IRM")
+21 IF $DATA(FIELDS("IRM"))
IF FIELDS("IRM")=""
SET DR=DR_";2.1///@"
+22 IF $GET(FIELDS("PRI"))
SET DR=DR_";6///`"_+FIELDS("PRI")
+23 IF $DATA(FIELDS("PRI"))
IF FIELDS("PRI")=""
SET DR=DR_";6///@"
+24 IF $GET(FIELDS("SPEC"))
SET DR=DR_";5///`"_+FIELDS("SPEC")
+25 IF $DATA(FIELDS("SPEC"))
IF FIELDS("SPEC")=""
SET DR=DR_";5///@"
+26 IF $GET(FIELDS("SPECD"))
SET DR=DR_";5.1///`"_+FIELDS("SPECD")
+27 IF $DATA(FIELDS("SPECD"))
IF FIELDS("SPECD")=""
SET DR=DR_";5.1///@"
+28 IF $GET(FIELDS("DEVSUB"))
SET DR=DR_";3.2///`"_+FIELDS("DEVSUB")
+29 IF $DATA(FIELDS("DEVSUB"))
IF FIELDS("DEVSUB")=""
SET DR=DR_";3.2///@"
+30 DO SETUP(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
+31 SET STATUS=+$GET(FIELDS("STATUS"))
+32 IF STATUS=2
Begin DoDot:1
+33 SET OK=1
+34 SET DR="81///`"_DUZ
+35 IF $GET(FIELDS("FUNC"))
SET DR=DR_";8///`"_+FIELDS("FUNC")
+36 IF $GET(FIELDS("TASK"))
SET DR=DR_";9///`"_+FIELDS("TASK")
+37 IF $LENGTH($GET(FIELDS("DATEC")))
SET DR=DR_";82///"_FIELDS("DATEC")
+38 IF $LENGTH(DR)
Begin DoDot:2
+39 NEW DA,DIE,X,Y
+40 IF $EXTRACT(DR)=";"
SET DR=$EXTRACT(DR,2,245)
+41 SET DA=CALL
SET DIE="^FSCD(""CALL"","
+42 ; *** needs ok
LOCK +^FSCD("CALL",DA):30
IF '$TEST
SET OK=0
QUIT
+43 DO ^DIE
+44 LOCK -^FSCD("CALL",DA)
+45 DO PICKUP^FSCES(DA)
+46 SET DR=""
End DoDot:2
IF 'OK
QUIT
+47 DO RES^FSCRPCNC(CALL)
End DoDot:1
IF 'OK
QUIT
+48 DO STATUS(CALL,STATUS,.EDITED)
+49 QUIT
+50 ;
FIX(VALUE) ; $$(input) -> correct for invalid characters
+1 NEW NEWVALUE
+2 SET NEWVALUE=$TRANSLATE(VALUE,";""^","~~~")
+3 IF $EXTRACT(NEWVALUE)="-"
SET NEWVALUE="~"_$EXTRACT(NEWVALUE,2,245)
+4 IF VALUE="?"
SET NEWVALUE="@"
+5 QUIT NEWVALUE
+6 ;
SETUP(DA,DIE,DR,EDITED) ; from FSCRPCEF
+1 NEW ABBREV,CALLNUM,NEWV,OLDV,X,Y
KILL NEWV,OLDV
+2 SET CALLNUM=DA
+3 IF '$LENGTH(DR)
IF $ORDER(^TMP("FSC WP",$JOB,"NOTE",0))
Begin DoDot:1
+4 DO UPDATE^FSCTASK(CALLNUM)
SET EDITED=1
End DoDot:1
QUIT
+5 IF '$LENGTH(DR)
QUIT
+6 IF $EXTRACT(DR)=";"
SET DR=$EXTRACT(DR,2,245)
+7 FOR ABBREV="SUBJECT","IRM","PHONE","MOD","SPEC","SPECD","PRI","PATCH","DEVSUB","KEYWORDS"
SET OLDV(ABBREV)=""
+8 DO GET^FSCGET("CUSTOM",CALLNUM,.OLDV)
+9 ; *** needs ok
LOCK +^FSCD("CALL",DA):30
IF '$TEST
QUIT
+10 DO ^DIE
+11 LOCK -^FSCD("CALL",DA)
+12 DO PICKUP^FSCES(DA)
+13 MERGE NEWV=OLDV
DO GET^FSCGET("CUSTOM",CALLNUM,.NEWV)
+14 DO AUDIT^FSCAUDIT(CALLNUM,.OLDV,.NEWV)
+15 DO UPDATE^FSCTASK(CALLNUM)
SET EDITED=1
+16 SET DR=""
+17 QUIT
+18 ;
STATUS(CALL,STATUS,EDITED) ; from FSCRPCEF
+1 IF 'STATUS
QUIT
+2 NEW PREVSTAT
+3 SET PREVSTAT=+$PIECE(^FSCD("CALL",+CALL,0),U,17)
+4 IF PREVSTAT<2
SET PREVSTAT=+$PIECE(^FSCD("CALL",+CALL,0),U,2)
+5 IF PREVSTAT=0
Begin DoDot:1
+6 DO STATUS^FSCES(CALL,"",1)
+7 DO UPDATE^FSCTASK(CALL)
SET EDITED=1
+8 IF STATUS'=1
Begin DoDot:2
+9 DO STATUS^FSCES(CALL,1,STATUS)
+10 DO UPDATE^FSCTASK(CALL)
SET EDITED=1
End DoDot:2
End DoDot:1
QUIT
+11 IF STATUS
IF PREVSTAT=STATUS
QUIT
+12 DO STATUS^FSCES(CALL,PREVSTAT,STATUS)
+13 DO UPDATE^FSCTASK(CALL)
SET EDITED=1
+14 QUIT
+15 ;
REOPEN(IN,OUT) ; from FSCRPX (RPCReopenCall)
+1 NEW CALL,OLDSTAT
+2 SET CALL=+$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
+3 IF 'CALL
QUIT
+4 SET OLDSTAT=+$PIECE($GET(^FSCD("CALL",CALL,0)),U,2)
+5 IF '(OLDSTAT=2!(OLDSTAT=99))
QUIT
+6 DO STATUS^FSCES(CALL,OLDSTAT,1,1)
+7 DO UPDATE^FSCTASK(CALL)
+8 DO MRE^FSCMR(DUZ,CALL)
+9 DO UPDATE^FSCAUDIT(CALL)
+10 SET ^TMP("FSCRPC",$JOB,"OUTPUT",1)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
+11 QUIT