diff --git a/adapter/justificationadapter.js b/adapter/justificationadapter.js index 8abd80d..9579af4 100644 --- a/adapter/justificationadapter.js +++ b/adapter/justificationadapter.js @@ -390,7 +390,9 @@ class JustificationAdapter extends Adapter{ // apires.meta.message = "Record Not Found"; // } callback(null, apires); - emailNotif.notifyOnSubmit(idxjustification); + if (parseInt(status) !== -1) { + emailNotif.notifyOnSubmit(idxjustification); + } } }); } catch (err) { diff --git a/emailnotif.js b/emailnotif.js index 024d43e..ec7ff79 100644 --- a/emailnotif.js +++ b/emailnotif.js @@ -69,7 +69,7 @@ function notifyOnSubmit(idxjustification) { select t.nik, e.fullname from tbl_justificationttd t join dbssotcel.tbl_employee e on e.nik = t.nik - where t.idxjustification = '${idxjustification}' and t.category = 'APR' and t.issigned = 0 and t.isdeleted = 0 + where t.idxjustification = '${idxjustification}' and t.issigned = 0 and t.isdeleted = 0 order by t._idx asc limit 1 `; db.query(qryApprover, [], function(err2, rows2) {