From 1df1b6321112516b59f1514a2c3db0d87fb5a176 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 19 Nov 2024 12:13:32 +0000 Subject: [PATCH 1/7] FIX_Approve Status changes --- app/Controllers/Subscription.php | 2 +- app/Models/InvoiceModel.php | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Controllers/Subscription.php b/app/Controllers/Subscription.php index 5430400b..fa4de006 100755 --- a/app/Controllers/Subscription.php +++ b/app/Controllers/Subscription.php @@ -20,7 +20,7 @@ class Subscription extends BaseController if (!empty($session_role) && $session_role !== "sadmin") { $this->logger->info("Invoice: Listing In Admin BID = " . $session_bid); - $where = ['I.business_id' => (int)$session_bid, 'I.isactive' => 1,'I.invoice_type'=>2,'S.isactive'=>1]; + $where = ['I.business_id' => (int)$session_bid, 'I.isactive' => 1,'I.invoice_type'=>2]; } else { $this->logger->info("Invoice: Listing In the Super-Admin "); $where = ['I.business_id != ' => NULL, 'I.isactive != ' => NULL,'I.invoice_type'=>2]; diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index a19d9b1f..ce09e642 100755 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -356,10 +356,8 @@ public function insertSubscriptionData($data,$invoice_status) $invoice_id = $data['invoice_id']; $customer_id = $data['customer_id']; $scheme_id = $data['scheme_id']; - // $data['isactive'] = $invoice_status !== 'Draft' ? 0 : 1 ; - + $data['isactive'] = $invoice_status === 'Approved' ? 1 : 0 ; $where = ['invoice_id' => $invoice_id,'customer_id' => $customer_id,'scheme_id' => $scheme_id]; - $query = $this->db->table('subscription')->select('sub_id')->where($where)->get()->getRow(); if (!empty($query)) { From 5fd516972ae6ae2ea108c25fe9c7ad8d10aa4919 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Nov 2024 03:24:05 +0000 Subject: [PATCH 2/7] FIX_reimplement Renew flag copied from old code --- app/Controllers/Invoice.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index c5633380..d7a2ba5c 100755 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -538,6 +538,16 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_ if (count($result)>0){ $membership_id = $this->generate_membership_id(6); } + + $get_exists_subscription_where = ['S.customer_id' => (int)$customer_id, 'S.scheme_id' => $product_id, 'I.status' => 'Approved', 'I.isactive' => 1]; + $get_exists_subscription_dtls = $model->existsSubscriptionDetails($get_exists_subscription_where); + + // the scheme is already exists to the customer + if ($get_exists_subscription_dtls) { + $this->logger->info($msg_flag_name . ": This Scheme Already Existing in this Customer. "); + $renewal = 1; + } + // Prepare subscription data $subscription_data = [ 'customer_id' => $customer_id, From ef96346c5bc7be94d75eac244bba00f41aaedf69 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Nov 2024 04:34:22 +0000 Subject: [PATCH 3/7] FIX_dashboard sql issues fixes --- app/Models/HomeModel.php | 95 +++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 36 deletions(-) diff --git a/app/Models/HomeModel.php b/app/Models/HomeModel.php index a0abddb6..076c5961 100755 --- a/app/Models/HomeModel.php +++ b/app/Models/HomeModel.php @@ -179,42 +179,65 @@ class HomeModel extends Model public function expiring_membership_with_notification_list() { $now = date('Y-m-d'); $last30days = date('Y-m-d', strtotime('+30 days')); - - $membershipList = $this->db->table('subscription as S') - ->join('customers as C', 'C.customer_id = S.customer_id', 'left') - ->join('books as BK', 'BK.book_id = S.scheme_id', 'left') - ->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left') - ->join('category as CM', 'CM.id = BC.category_id', 'left') - ->select('CM.name, CONCAT_WS(" ", C.first_name, C.last_name) as customer_name, - C.email as customer_email, C.mobile_no as customer_mobile, - S.sub_id, S.scheme_id, S.customer_id, S.business_id, - S.to_subscription, S.from_subscription, BK.title, BK.short_code, BK.book_id, - DATEDIFF(S.to_subscription, CURDATE()) as countdays, - DATE_FORMAT(S.to_subscription, "%d/%m/%Y") as to_subscription_date_format, - ( - SELECT MAX(NHP.start_date_time) - FROM notification_campaign as NC - LEFT JOIN notification_history_parents as NHP ON NHP.campaign_id = NC.campaign_id - LEFT JOIN notification_history_children as NHC ON NHC.fkid = NHP.id - WHERE NHC.customer_id = C.customer_id AND NHC.receiving_entity LIKE "%@%" AND NHC.receiving_status = 1 - ) as email_last_notify_on, - ( - SELECT MAX(NHP.start_date_time) - FROM notification_campaign as NC - LEFT JOIN notification_history_parents as NHP ON NHP.campaign_id = NC.campaign_id - LEFT JOIN notification_history_children as NHC ON NHC.fkid = NHP.id - WHERE NHC.customer_id = S.customer_id AND NHC.receiving_entity NOT LIKE "%@%" AND NHC.receiving_status = 1 - AND NHC.receiving_status REGEXP "^[0-9]+$" - ) as whatsapp_last_notify_on') - ->where('S.to_subscription >=', $now) - ->where('S.to_subscription <=', $last30days) - ->where('S.isactive', 1) - ->where('LOWER(CM.name)', strtolower("Membership")) - ->orderBy('S.to_subscription', 'ASC') - ->groupBy('S.sub_id') - ->get() - ->getResultArray(); - return $membershipList; + $sql = "SELECT + `CM`.`name`, + CONCAT_WS(' ', `C`.`first_name`, `C`.`last_name`) AS customer_name, + `C`.`email` AS customer_email, + `C`.`mobile_no` AS customer_mobile, + `S`.`sub_id`, + `S`.`scheme_id`, + `S`.`customer_id`, + `S`.`business_id`, + `S`.`to_subscription`, + `S`.`from_subscription`, + `BK`.`title`, + `BK`.`short_code`, + `BK`.`book_id`, + DATEDIFF(`S`.`to_subscription`, CURDATE()) AS countdays, + DATE_FORMAT(`S`.`to_subscription`, '%d/%m/%Y') AS to_subscription_date_format, + ( + SELECT MAX(`NHP`.`start_date_time`) + FROM `notification_campaign` AS `NC` + LEFT JOIN `notification_history_parents` AS `NHP` ON `NHP`.`campaign_id` = `NC`.`campaign_id` + LEFT JOIN `notification_history_children` AS `NHC` ON `NHC`.`fkid` = `NHP`.`id` + WHERE `NHC`.`customer_id` = `S`.`customer_id` + AND `NHC`.`receiving_entity` LIKE '%@%' + AND `NHC`.`receiving_status` = 1 + AND `NHP`.`start_date_time` >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) + ) AS email_last_notify_on, + ( + SELECT MAX(`NHP`.`start_date_time`) + FROM `notification_campaign` AS `NC` + LEFT JOIN `notification_history_parents` AS `NHP` ON `NHP`.`campaign_id` = `NC`.`campaign_id` + LEFT JOIN `notification_history_children` AS `NHC` ON `NHC`.`fkid` = `NHP`.`id` + WHERE `NHC`.`customer_id` = `S`.`customer_id` + AND `NHC`.`receiving_entity` NOT LIKE '%@%' + AND `NHC`.`receiving_status` = 1 + AND `NHC`.`receiving_status` REGEXP '^[0-9]+$' + AND `NHP`.`start_date_time` >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) + ) AS whatsapp_last_notify_on + FROM + `subscription` AS `S` + LEFT JOIN `customers` AS `C` ON `C`.`customer_id` = `S`.`customer_id` + LEFT JOIN `books` AS `BK` ON `BK`.`book_id` = `S`.`scheme_id` + LEFT JOIN `book_categories` AS `BC` ON `BC`.`book_id` = `S`.`scheme_id` + LEFT JOIN `category` AS `CM` ON `CM`.`id` = `BC`.`category_id` + WHERE + `S`.`to_subscription` >= $now + AND `S`.`to_subscription` <= $last30days + AND `S`.`isactive` = 1 + AND LOWER(`CM`.`name`) = 'membership' + + GROUP BY + `S`.`sub_id` + + ORDER BY + `S`.`to_subscription` ASC; +"; + +$query = $this->db->query($sql); +$membershipList = $query->getResultArray(); +return $membershipList; } From d466bbd1f072f37e171f75887ddb93855373d616 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Nov 2024 04:55:29 +0000 Subject: [PATCH 4/7] FIX_expiring_membership_with_notification_list --- app/Models/HomeModel.php | 97 ++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 59 deletions(-) diff --git a/app/Models/HomeModel.php b/app/Models/HomeModel.php index 076c5961..01930699 100755 --- a/app/Models/HomeModel.php +++ b/app/Models/HomeModel.php @@ -179,65 +179,44 @@ class HomeModel extends Model public function expiring_membership_with_notification_list() { $now = date('Y-m-d'); $last30days = date('Y-m-d', strtotime('+30 days')); - $sql = "SELECT - `CM`.`name`, - CONCAT_WS(' ', `C`.`first_name`, `C`.`last_name`) AS customer_name, - `C`.`email` AS customer_email, - `C`.`mobile_no` AS customer_mobile, - `S`.`sub_id`, - `S`.`scheme_id`, - `S`.`customer_id`, - `S`.`business_id`, - `S`.`to_subscription`, - `S`.`from_subscription`, - `BK`.`title`, - `BK`.`short_code`, - `BK`.`book_id`, - DATEDIFF(`S`.`to_subscription`, CURDATE()) AS countdays, - DATE_FORMAT(`S`.`to_subscription`, '%d/%m/%Y') AS to_subscription_date_format, - ( - SELECT MAX(`NHP`.`start_date_time`) - FROM `notification_campaign` AS `NC` - LEFT JOIN `notification_history_parents` AS `NHP` ON `NHP`.`campaign_id` = `NC`.`campaign_id` - LEFT JOIN `notification_history_children` AS `NHC` ON `NHC`.`fkid` = `NHP`.`id` - WHERE `NHC`.`customer_id` = `S`.`customer_id` - AND `NHC`.`receiving_entity` LIKE '%@%' - AND `NHC`.`receiving_status` = 1 - AND `NHP`.`start_date_time` >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) - ) AS email_last_notify_on, - ( - SELECT MAX(`NHP`.`start_date_time`) - FROM `notification_campaign` AS `NC` - LEFT JOIN `notification_history_parents` AS `NHP` ON `NHP`.`campaign_id` = `NC`.`campaign_id` - LEFT JOIN `notification_history_children` AS `NHC` ON `NHC`.`fkid` = `NHP`.`id` - WHERE `NHC`.`customer_id` = `S`.`customer_id` - AND `NHC`.`receiving_entity` NOT LIKE '%@%' - AND `NHC`.`receiving_status` = 1 - AND `NHC`.`receiving_status` REGEXP '^[0-9]+$' - AND `NHP`.`start_date_time` >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) - ) AS whatsapp_last_notify_on - FROM - `subscription` AS `S` - LEFT JOIN `customers` AS `C` ON `C`.`customer_id` = `S`.`customer_id` - LEFT JOIN `books` AS `BK` ON `BK`.`book_id` = `S`.`scheme_id` - LEFT JOIN `book_categories` AS `BC` ON `BC`.`book_id` = `S`.`scheme_id` - LEFT JOIN `category` AS `CM` ON `CM`.`id` = `BC`.`category_id` - WHERE - `S`.`to_subscription` >= $now - AND `S`.`to_subscription` <= $last30days - AND `S`.`isactive` = 1 - AND LOWER(`CM`.`name`) = 'membership' - - GROUP BY - `S`.`sub_id` - - ORDER BY - `S`.`to_subscription` ASC; -"; - -$query = $this->db->query($sql); -$membershipList = $query->getResultArray(); -return $membershipList; + + $membershipList = $this->db->table('subscription as S') + ->join('customers as C', 'C.customer_id = S.customer_id', 'left') + ->join('books as BK', 'BK.book_id = S.scheme_id', 'left') + ->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left') + ->join('category as CM', 'CM.id = BC.category_id', 'left') + ->select('CM.name, CONCAT_WS(" ", C.first_name, C.last_name) as customer_name, + C.email as customer_email, C.mobile_no as customer_mobile, + S.sub_id, S.scheme_id, S.customer_id, S.business_id, + S.to_subscription, S.from_subscription, BK.title, BK.short_code, BK.book_id, + DATEDIFF(S.to_subscription, CURDATE()) as countdays, + DATE_FORMAT(S.to_subscription, "%d/%m/%Y") as to_subscription_date_format, + ( + SELECT MAX(NHP.start_date_time) + FROM notification_campaign as NC + LEFT JOIN notification_history_parents as NHP ON NHP.campaign_id = NC.campaign_id + LEFT JOIN notification_history_children as NHC ON NHC.fkid = NHP.id + WHERE NHC.customer_id = C.customer_id AND NHC.receiving_entity LIKE "%@%" AND NHC.receiving_status = 1 + AND NHP.start_date_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) + ) as email_last_notify_on, + ( + SELECT MAX(NHP.start_date_time) + FROM notification_campaign as NC + LEFT JOIN notification_history_parents as NHP ON NHP.campaign_id = NC.campaign_id + LEFT JOIN notification_history_children as NHC ON NHC.fkid = NHP.id + WHERE NHC.customer_id = S.customer_id AND NHC.receiving_entity NOT LIKE "%@%" AND NHC.receiving_status = 1 + AND NHC.receiving_status REGEXP "^[0-9]+$" + AND NHP.start_date_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) + ) as whatsapp_last_notify_on') + ->where('S.to_subscription >=', $now) + ->where('S.to_subscription <=', $last30days) + ->where('S.isactive', 1) + ->where('LOWER(CM.name)', strtolower("Membership")) + ->orderBy('S.to_subscription', 'ASC') + ->groupBy('S.sub_id') + ->get() + ->getResultArray(); + return $membershipList; } From aa28271f7469bc5d987f2d77d89091511bd7d99d Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Nov 2024 05:24:13 +0000 Subject: [PATCH 5/7] FIX_Fixes --- app/Controllers/Notifications.php | 141 ++---------------------------- 1 file changed, 6 insertions(+), 135 deletions(-) diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index b341b87b..83d8a40f 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -571,6 +571,7 @@ class Notifications extends BaseController ################################################################ public function getExpCustomerDetail($window_time = null) { + // Email flow only Whatsapp flow Deleted. $this->update_expired_members(); echo "Hi, "; # Step 1: add the days to retrive the data// @@ -606,7 +607,7 @@ class Notifications extends BaseController } $emailTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE EMAIL'); - echo "Started.
Customer expiring. till dated = ".$newDate."
There are ".count($queryResult)." persons
"; + echo "Started.
Customer expiring. till dated = ".date('d-m-Y', strtotime($newDate))."
There are ".count($queryResult)." persons
"; foreach ($queryResult as $inx => $row) { $status = $row['status']; $userFirstName = $row['first_name']; @@ -624,7 +625,7 @@ class Notifications extends BaseController if ($status === 'Approved') { # EXPIRY NOTIFY TEMPLATE EMAIL $emailTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE EMAIL'); - echo "#".$customerId." - Person Name :".$fullName." ----- ( Expiry on ". $expirydate.")
"; + echo ($inx+1).") #".$customerId." - Person Name : ".$fullName." ----- ( Expiry on ". date('d-m-Y', strtotime($expirydate)).")
"; if(empty($row['email'])){ echo ($inx+1).") Email Not Available
"; continue; @@ -654,7 +655,7 @@ class Notifications extends BaseController } if($check_existing){ - echo ($inx+1).") Email already send on - ".$check_date."
"; + echo ($inx+1).") Email already send on - ".date('d-m-Y h:i A', strtotime($check_date))."
"; continue; } @@ -736,140 +737,10 @@ class Notifications extends BaseController else{ $this->logger->error("status is Draft"); } - # EXPIRY NOTIFY TEMPLATE EMAIL Closed - if ($status === 'Approved') { - - - $existingcheck2 = $NotificationModel->checkEmailAlreadyExisting($userMobileNumber,$customerId); - $check_existing2 = 0; - $check_date2 = ""; - $check_diff_days2 = ""; - - if(!empty($existingcheck2)){ - - foreach ($existingcheck2 as $i2 => $r2) { - if($r2['receiving_status'] == 1){ - $check_existing2 = 1; - $check_date2 = $r2['sent_time']; - $sentTimestamp2 = strtotime($r2['sent_time']); - $provedTimestamp2 = strtotime($providedDate); - - - $diffInSeconds2 = abs($provedTimestamp2 - $sentTimestamp2); - $diffInDays2 = $diffInSeconds2 / (60 * 60 * 24); - - $check_diff_days2 = $diffInDays2; - } - } - } - - if($check_existing2){ - echo ($inx+1).") whatsapp already send ".$check_date2."
"; - continue; - } - # EXPIRY NOTIFY TEMPLATE WHATSAPP - $whatsappTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE WHATSAPP'); - // print_r($whatsappTemplateName);die; - if ((count($whatsappTemplateName) > 0) && !empty($whatsappTemplateName)) { - $campaign_id = 2; // hardcoded because static Template. - $history_parents_data = ['campaign_id' => 2,'status' => 0]; - $history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data); - if (empty($userMobileNumber)) { - $history_msg = 'There is no subscriber mobile number'; - $history_child_updatedata = ['receiving_status'=>0,'result'=>$history_msg]; - $history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id]; - $history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where); - $this->logger->error($history_child_statement); - - $history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id); - $this->logger->error($history_parent_statement); - $this->logger->error($history_msg); - echo ($inx+1).") ".$history_msg."
"; - continue; - } - # Insertion on History Whatsapp Means Campaign ID 2 Hardcoded - $history_parents_data = ['campaign_id' => 2,'status' => 0]; - $history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data); - - # Step 7: Prepare whatsapp content based on the template - $whatsappContent = $whatsappTemplateName[0]['message']; - if (isset($fullName)) { - $whatsappContent = str_replace("{USER_NAME}", $fullName, $whatsappContent); - } - if (isset($schemename)) { - $whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $whatsappContent); - } - if (isset($expirydate)) { - $expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : ''; - $whatsappContent = str_replace("{EXPIRY_DATE}", $expiryon, $whatsappContent); - } - if (isset($customerId)) { - $whatsappContent = str_replace("{RENEWAL_LINK}", base_url() . 'subscription_renewal/' . $customerId, $whatsappContent); - } - # Step 8: Insertion on History Child for whatsapp - $history_child_data = [ 'fkid' => $history_parent_id, - 'customer_id' => $customerId, - 'receiving_entity' => $userMobileNumber, - 'receiving_status' => 0, - 'message' => strip_tags(ltrim($whatsappContent))]; - $history_child_id = $NotificationModel->save_notification_history_child($history_child_data); - - - # Step 8: Send Whatsapp using NotificationHelper - $params = (object) Null; - $url = SEND_WAAI_URL; - $params->number = (int)'91' . $userMobileNumber; - $params->type = "text"; - $params->message = strip_tags(ltrim($whatsappContent)); - $params->instance_id = $_ENV['WAAI_INSTANCE']; - $params->access_token = $_ENV['WAAI_TOKEN']; - $this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request = " . json_encode($params)); - $this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request type b4 = " . gettype($params)); - $whatsapp_result = $notification->sendWhatsAppMessage($url, "POST", $params); - $receiving_status = $whatsapp_result['receiving_status']; - $history_msg = strtolower(gettype($whatsapp_result)) == "string" ? $whatsapp_result : json_encode($whatsapp_result['reponse']); - $history_child_updatedata = ['receiving_status'=>$receiving_status,'result'=>$history_msg]; - $history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id]; - $history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where); - $this->logger->error($history_child_statement); - - $history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id); - $this->logger->error($history_parent_statement); - $this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Reponse = " . $history_msg); - - if(strtolower(gettype($whatsapp_result)) == "string"){ - echo ($inx+1).") ".$whatsapp_result."
"; - } - else{ - $result = json_encode($whatsapp_result['reponse']); - $decodedResult = json_decode($result, true); - if ($decodedResult && isset($decodedResult['message']['key']['remoteJid'])) { - $remoteJid = $decodedResult['message']['key']['remoteJid']; - $this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Remote Jid = " . $remoteJid); - echo ($inx+1).") Whatsapp sent successfully
"; - } else { - // echo "Failed to extract remoteJid"; - $this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Failed to extract remoteJid "); - echo ($inx+1).") Failed to send Whatsapp
"; - } - } - } else { - // $receiving_status = 0; - $history_msg = 'There is no Whatsapp template found by the name of EXPIRAY NOTIFY TEMPLATE WHATSAPP '; - $this->logger->error($history_msg); - echo "There is no Whatsapp template
"; - continue; - } - - # EXPIRY NOTIFY TEMPLATE WHATSAPP Closed - } - else{ - $this->logger->error("status is draft"); - } - + # EXPIRY NOTIFY TEMPLATE EMAIL Closed # Loop Closed echo "Process Completed
"; - } + } } From 886884c4fb229a097bf9644496b8be35bddfaa81 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Nov 2024 05:39:05 +0000 Subject: [PATCH 6/7] FIX_Status check --- app/Controllers/Notifications.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index 83d8a40f..2bcb66b3 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -622,10 +622,10 @@ class Notifications extends BaseController $this->logger->error('There is no subcription Name'); continue; } + echo ($inx+1).") #".$customerId." - Person Name : ".$fullName." ----- ( Expiry on ". date('d-m-Y', strtotime($expirydate)).")
"; if ($status === 'Approved') { # EXPIRY NOTIFY TEMPLATE EMAIL $emailTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE EMAIL'); - echo ($inx+1).") #".$customerId." - Person Name : ".$fullName." ----- ( Expiry on ". date('d-m-Y', strtotime($expirydate)).")
"; if(empty($row['email'])){ echo ($inx+1).") Email Not Available
"; continue; @@ -735,6 +735,7 @@ class Notifications extends BaseController } else{ + echo ($inx+1).") Staus = ".$status."
"; $this->logger->error("status is Draft"); } # EXPIRY NOTIFY TEMPLATE EMAIL Closed From c506d3e492c995f893aecdf43402a3eb414808c6 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Nov 2024 07:32:39 +0000 Subject: [PATCH 7/7] FIX_Expries today --- app/Controllers/Notifications.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index 2bcb66b3..b4c6a15e 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -617,6 +617,7 @@ class Notifications extends BaseController $schemename = $row['title']; $expirydate = $row['to_subscription']; $customerId = $row['customer_id']; + $countdays = $row['countdays']; $membership_id = $row['membership_id']; if (empty($fullName)) { $this->logger->error('There is no subcription Name'); @@ -676,6 +677,8 @@ class Notifications extends BaseController if (isset($expirydate)) { $expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : ''; $emailContent = str_replace("{EXPIRY_DATE}", $expiryon, $emailContent); + $replaceContent = (int)$countdays == 0 ? 'expires today, ' : 'expiring on '; + $emailContent = str_replace("expiring on", $replaceContent, $emailContent); } if (isset($membership_id)) { $emailContent = str_replace("{RENEWAL_LINK}", base_url() . 'subscription_renewal/' . $membership_id, $emailContent);