From 07336466a2328cdb9b0518e43610cc6b7c97c4bb Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 12 Apr 2021 17:57:59 +0000 Subject: [PATCH] --- ayanova/src/views/svc-workorder.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index fbe8342d..03176c30 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -419,7 +419,16 @@ export default { //mostly via workorderitem //######################################################## let noProblem = true; - let isNew = this.obj.concurrency == 0; + + //HEADER MUST BE SAVED FIRST IF IT's NEW + //(otherwise there's nothing to hang the other things off of) + let headerSaved = false; + if (this.obj.concurrency == 0) { + console.log("concurrency 0, saving header"); + + noProblem = await saveHeader(vm); + headerSaved = true; + } //### STATE first if unlocking only //if moving to another locked state this will block further updates below but we're accepting that @@ -445,7 +454,7 @@ export default { //############ SAVE GRAPH ############### //HEADER - if (noProblem) { + if (noProblem && !headerSaved) { noProblem = await saveHeader(vm); } @@ -610,6 +619,7 @@ async function saveHeader(vm) { } let isPost = o.id == 0; let res = await window.$gz.api.upsert(`${API_BASE_URL}`, o); + console.log("result of saving header is ", res); if (res.error) { displayResError(vm, res); return false;