From 8af7f13ac68057abf745cc0de0c6201542c7b0ec Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 10 Oct 2019 14:11:23 +0200 Subject: [PATCH] #1763 insert from procedure --- modules/worker/back/methods/worker-time-control/addTime.js | 7 ++----- modules/worker/front/time-control/index.js | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/addTime.js b/modules/worker/back/methods/worker-time-control/addTime.js index cb639f9af..9864142bf 100644 --- a/modules/worker/back/methods/worker-time-control/addTime.js +++ b/modules/worker/back/methods/worker-time-control/addTime.js @@ -33,10 +33,7 @@ module.exports = Self => { const subordinate = await Worker.findById(data.workerFk); - return Self.create({ - userFk: subordinate.userFk, - timed: data.timed, - manual: 1 - }); + return Self.rawSql('CALL vn.workerTimeControl_add(?, ?, ?, ?)', [ + subordinate.userFk, null, data.timed, true]); }; }; diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index a82fdc63d..feadfc8b3 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -238,9 +238,7 @@ class Controller { if (response === 'ACCEPT') { let data = {workerFk: this.worker.id, timed: this.newTime}; let query = `/api/WorkerTimeControls/addTime`; - this.$http.post(query, data).then(() => { - this.refresh(); - }); + this.$http.post(query, data).then(() => this.refresh()); } } }