diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js index 579a83112..7aff9e790 100644 --- a/modules/worker/back/methods/worker-time-control/sendMail.js +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -131,20 +131,10 @@ module.exports = Self => { JOIN business b ON b.id = tb.businessFk LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated LEFT JOIN worker w ON w.id = u.id - JOIN (SELECT tb.userFk, - SUM(IF(tb.type IS NULL, - IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)), - TRUE))isTeleworkingWeek - FROM tmp.timeBusinessCalculate tb - LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk - AND tc.dated = tb.dated - GROUP BY tb.userFk - HAVING isTeleworkingWeek > 0 - )sub ON sub.userFk = u.id - WHERE d.hasToRefill - AND IFNULL(?, u.id) = u.id + WHERE IFNULL(?, u.id) = u.id AND b.companyCodeFk = 'VNL' AND w.businessFk + AND d.isTeleworking ORDER BY u.id, tb.dated `, [args.workerId]); const index = stmts.push(stmt) - 1; diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 9ed454d31..3e4aeaa5c 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -379,6 +379,20 @@ class Controller extends Section { }); } + isSended() { + const params = { + workerId: this.worker.id, + year: this.date.getFullYear(), + week: this.weekNumber, + state: 'SENDED' + }; + const query = `WorkerTimeControls/updateWorkerTimeControlMail`; + this.$http.post(query, params).then(() => { + this.getMailStates(this.date); + this.getWeekData(); + }); + } + changeState(state, reason) { this.state = state; this.reason = reason; @@ -412,6 +426,7 @@ class Controller extends Section { }; this.$http.post(`WorkerTimeControls/weekly-hour-hecord-email`, params) .then(() => { + this.isSended(); this.vnApp.showSuccess(this.$t('Email sended')); }); }