Log cancel and send actions to one_lab_log.t_send_email_log via db_log
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ class Done extends MY_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
$this->db_log = $this->load->database("one_lab_log", true);
|
||||
}
|
||||
|
||||
public function search()
|
||||
@@ -329,7 +330,7 @@ class Done extends MY_Controller
|
||||
$this->db_onedev->trans_commit();
|
||||
|
||||
// ================= INSERT LOG (DB ONE_LAB_LOG) =================
|
||||
$sql_log = "INSERT INTO one_lab_log.t_send_email_log (
|
||||
$sql_log = "INSERT INTO t_send_email_log (
|
||||
T_SendEmailLogT_OrderHeaderID,
|
||||
T_SendEmailLogRecepient,
|
||||
T_SendEmailLogStatus,
|
||||
@@ -340,7 +341,7 @@ class Done extends MY_Controller
|
||||
T_SendEmailLogCreatedUserID
|
||||
) VALUES (?, ?, ?, ?, ?, ?, NOW(), ?)";
|
||||
|
||||
$this->db_onedev->query($sql_log, array(
|
||||
$this->db_log->query($sql_log, array(
|
||||
$order_header_id,
|
||||
$recepient_email,
|
||||
$status,
|
||||
@@ -350,7 +351,7 @@ class Done extends MY_Controller
|
||||
$userid
|
||||
));
|
||||
|
||||
if ($this->db_onedev->affected_rows() == 0) {
|
||||
if ($this->db_log->affected_rows() == 0) {
|
||||
throw new Exception("Insert log gagal");
|
||||
}
|
||||
|
||||
@@ -418,6 +419,20 @@ class Done extends MY_Controller
|
||||
WHERE T_SendEmailID = ?
|
||||
", [$userid, $check['T_SendEmailID']]);
|
||||
|
||||
$this->db_log->query("
|
||||
INSERT INTO t_send_email_log
|
||||
(T_SendEmailLogT_OrderHeaderID, T_SendEmailLogRecepient,
|
||||
T_SendEmailLogStatus, T_SendEmailLogResponse,
|
||||
T_SendEmailLogGroup_ResultName, T_SendEmailLogJson,
|
||||
T_SendEmailLogCreated, T_SendEmailLogCreatedUserID)
|
||||
VALUES (?, ?, 'C', NULL, '', ?, NOW(), ?)
|
||||
", [
|
||||
$order_header_id,
|
||||
$recepient_email,
|
||||
json_encode($prm),
|
||||
$userid,
|
||||
]);
|
||||
|
||||
$this->sys_ok([
|
||||
"status" => "OK",
|
||||
"message" => "Email berhasil dicancel"
|
||||
|
||||
Reference in New Issue
Block a user