From 8994bd58b922243271ec447ca0e9c8571bb0de3f Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 4 Mar 2025 14:31:12 +0530 Subject: [PATCH] ADDED_CC_FOR_EVERY_INVOICE --- app/Controllers/Invoice.php | 1 + app/Helpers/NotificationHelper.php | 8 ++++++++ app/Models/PaymentStatusModel.php | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 6a422131..17317271 100755 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -939,6 +939,7 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_ $params->instance_id = $_ENV['WAAI_INSTANCE']; $params->access_token = $_ENV['WAAI_TOKEN']; } + $records['cc'] = getenv('BuisnessCCMail'); if(isset($contact_method['msg_mail'])){ log_message('info',"Approve notification Email Request data = " . json_encode($records)); diff --git a/app/Helpers/NotificationHelper.php b/app/Helpers/NotificationHelper.php index cbc3afc4..a90f3f2a 100755 --- a/app/Helpers/NotificationHelper.php +++ b/app/Helpers/NotificationHelper.php @@ -28,6 +28,14 @@ class NotificationHelper throw new \Exception("Email and Subject are Must Please Try again.."); } $this->email->setTo($records['recipient_email']); + if (!empty($records['cc'])) { + if (is_array($records['cc'])) { + $this->email->setCC($records['cc']); // Directly use array + } else { + $this->email->setCC(explode(',', $records['cc'])); // Convert string to array + } + } + $this->logger->error('Helper : Email recipient = '.$records['recipient_email']); $this->email->setFrom('web@vijayabharathambooks.com', isset($records['company'])?$records['company']:"VB"); $this->email->setSubject($records['subject']); diff --git a/app/Models/PaymentStatusModel.php b/app/Models/PaymentStatusModel.php index 5a23330e..974358d3 100644 --- a/app/Models/PaymentStatusModel.php +++ b/app/Models/PaymentStatusModel.php @@ -47,7 +47,7 @@ class PaymentStatusModel extends Model $builder->where('payment_status.is_active',1); $data = $builder->get()->getResultArray(); - log_message('error',json_encode($this->db->getLastQuery()->getQuery())); + // log_message('error',json_encode($this->db->getLastQuery()->getQuery())); return $data; // Fetch and return as an array } }