FIX_in getExpCustomerDetail
This commit is contained in:
parent
5219d10f5c
commit
c5d43763b8
@ -570,7 +570,7 @@ class Notifications extends BaseController
|
|||||||
################################################################
|
################################################################
|
||||||
public function getExpCustomerDetail($window_time = null)
|
public function getExpCustomerDetail($window_time = null)
|
||||||
{
|
{
|
||||||
echo "hi";
|
echo "Hi, ";
|
||||||
# Step 1: add the days to retrive the data//
|
# Step 1: add the days to retrive the data//
|
||||||
$providedDate = date('Y-m-d');
|
$providedDate = date('Y-m-d');
|
||||||
$newDate = date('Y-m-d', strtotime($providedDate . ' + ' . $window_time . ' days'));
|
$newDate = date('Y-m-d', strtotime($providedDate . ' + ' . $window_time . ' days'));
|
||||||
@ -587,7 +587,7 @@ class Notifications extends BaseController
|
|||||||
|
|
||||||
# Step 3: Replace the placeholder WINDOW_TIME with the user-provided value
|
# Step 3: Replace the placeholder WINDOW_TIME with the user-provided value
|
||||||
$modifiedQuery = str_replace('WINDOW_TIME', $window_time, $ExpCustomerDetail);
|
$modifiedQuery = str_replace('WINDOW_TIME', $window_time, $ExpCustomerDetail);
|
||||||
// print_r($modifiedQuery);die;
|
// print_r($modifiedQuery);die;
|
||||||
if (empty($modifiedQuery)) {
|
if (empty($modifiedQuery)) {
|
||||||
$this->logger->error('There is no sub query');
|
$this->logger->error('There is no sub query');
|
||||||
return;
|
return;
|
||||||
@ -619,6 +619,7 @@ class Notifications extends BaseController
|
|||||||
if ($status === 'Approved') {
|
if ($status === 'Approved') {
|
||||||
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL
|
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL
|
||||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||||
|
echo "Person Name :".$fullName." <br>";
|
||||||
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
||||||
$campaign_id = 1;
|
$campaign_id = 1;
|
||||||
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
||||||
@ -627,9 +628,20 @@ class Notifications extends BaseController
|
|||||||
|
|
||||||
# Step 4: Prepare email content based on the template
|
# Step 4: Prepare email content based on the template
|
||||||
$emailContent = $emailTemplateName[0]['message'];
|
$emailContent = $emailTemplateName[0]['message'];
|
||||||
|
if (isset($fullName)) {
|
||||||
$emailContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
$emailContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
||||||
|
}
|
||||||
|
if (isset($schemename)) {
|
||||||
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
||||||
|
}
|
||||||
|
if (isset($expirydate)) {
|
||||||
$emailContent = str_replace("{EXPIRY_DATE}", $expirydate, $emailContent);
|
$emailContent = str_replace("{EXPIRY_DATE}", $expirydate, $emailContent);
|
||||||
|
}
|
||||||
|
if (isset($customerId)) {
|
||||||
|
$emailContent = str_replace("{RENEWAL_LINK}", base_url() . 'subscription_renewal/' . $customerId, $emailContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$emailData = [
|
$emailData = [
|
||||||
'template_name' => 'EXPIRAY_NOTIFY_TEMPLATE_EMAIL',
|
'template_name' => 'EXPIRAY_NOTIFY_TEMPLATE_EMAIL',
|
||||||
@ -637,6 +649,8 @@ class Notifications extends BaseController
|
|||||||
'subject' => 'Your Subscription Expiry Notification',
|
'subject' => 'Your Subscription Expiry Notification',
|
||||||
'description' => $emailContent,
|
'description' => $emailContent,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||||
'customer_id' => $customerId,
|
'customer_id' => $customerId,
|
||||||
'receiving_entity' => $row['email'],
|
'receiving_entity' => $row['email'],
|
||||||
@ -711,10 +725,18 @@ class Notifications extends BaseController
|
|||||||
|
|
||||||
# Step 7: Prepare whatsapp content based on the template
|
# Step 7: Prepare whatsapp content based on the template
|
||||||
$whatsappContent = $whatsappTemplateName[0]['message'];
|
$whatsappContent = $whatsappTemplateName[0]['message'];
|
||||||
$whatsappContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
if (isset($fullName)) {
|
||||||
$whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
$whatsappContent = str_replace("{USER_NAME}", $fullName, $whatsappContent);
|
||||||
$whatsappContent = str_replace("{EXPIRY_DATE}", $expirydate, $emailContent);
|
}
|
||||||
|
if (isset($schemename)) {
|
||||||
|
$whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $whatsappContent);
|
||||||
|
}
|
||||||
|
if (isset($expirydate)) {
|
||||||
|
$whatsappContent = str_replace("{EXPIRY_DATE}", $expirydate, $whatsappContent);
|
||||||
|
}
|
||||||
|
if (isset($customerId)) {
|
||||||
|
$whatsappContent = str_replace("{RENEWAL_LINK}", base_url() . 'subscription_renewal/' . $customerId, $whatsappContent);
|
||||||
|
}
|
||||||
# Step 8: Insertion on History Child for whatsapp
|
# Step 8: Insertion on History Child for whatsapp
|
||||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||||
'customer_id' => $customerId,
|
'customer_id' => $customerId,
|
||||||
@ -867,7 +889,7 @@ class Notifications extends BaseController
|
|||||||
$notification = new NotificationHelper();
|
$notification = new NotificationHelper();
|
||||||
if($single_campaign['mode'] == 'Email')
|
if($single_campaign['mode'] == 'Email')
|
||||||
{
|
{
|
||||||
$email_response = $notification->sendEmail(array('recipient_email' => $customer['email'],'subject' => "ttt ".$template['subject'],'template_name' => $template['template_name'],'description' => $notificationContent));
|
$email_response = $notification->sendEmail(array('recipient_email' => $customer['email'],'subject' => $template['subject'],'template_name' => $template['template_name'],'description' => $notificationContent));
|
||||||
$mail_log = isset($email_response['success']) ? 'Email sent successfully' : 'Failed to send email';
|
$mail_log = isset($email_response['success']) ? 'Email sent successfully' : 'Failed to send email';
|
||||||
$receiving_status = isset($email_response['success']) ? 1 : 0;
|
$receiving_status = isset($email_response['success']) ? 1 : 0;
|
||||||
$this->logger->error("Auto Scheduled Email CID = ".$customer['customer_id']." ".$mail_log);
|
$this->logger->error("Auto Scheduled Email CID = ".$customer['customer_id']." ".$mail_log);
|
||||||
|
|||||||
@ -162,7 +162,7 @@ public function customerGroupQueryExecution($queries){
|
|||||||
{
|
{
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
$query = "SELECT * FROM customer_groups WHERE group_name = 'EXPIRYDATE'";
|
$query = "SELECT * FROM customer_groups WHERE group_name = 'EXPIRYDATE' AND isactive = 1";
|
||||||
|
|
||||||
$result = $db->query($query)->getResultArray();
|
$result = $db->query($query)->getResultArray();
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,9 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $tempinx = 0;
|
<?php $tempinx = 0;
|
||||||
|
// echo "<pre>";
|
||||||
// print_r($expiring_membership);
|
// print_r($expiring_membership);
|
||||||
|
// echo "</pre>";
|
||||||
if(!empty($expiring_membership)):
|
if(!empty($expiring_membership)):
|
||||||
foreach ($expiring_membership as $e) :
|
foreach ($expiring_membership as $e) :
|
||||||
$daysincount = (int)$e['countdays'];
|
$daysincount = (int)$e['countdays'];
|
||||||
@ -163,11 +165,23 @@
|
|||||||
<td><span class="badge badge-success badge-pill"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
|
<td><span class="badge badge-success badge-pill"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
$startDate = date('d/m/Y', strtotime($e['from_subscription']));
|
||||||
|
$endDate = date('d/m/Y', strtotime($e['to_subscription']));
|
||||||
|
|
||||||
$notifications = $e['notifications'];
|
$notifications = $e['notifications'];
|
||||||
$lastNotification = end($notifications);
|
$emailNotifications = array_filter($notifications, function($notification) {
|
||||||
|
return $notification['mode'] === 'Email';
|
||||||
|
});
|
||||||
|
|
||||||
|
$lastNotification = end($emailNotifications);
|
||||||
$lastStartDateTime = ($lastNotification && isset($lastNotification['start_date_time'])) ? $lastNotification['start_date_time'] : '';
|
$lastStartDateTime = ($lastNotification && isset($lastNotification['start_date_time'])) ? $lastNotification['start_date_time'] : '';
|
||||||
$startDateTime = $lastStartDateTime ? $lastStartDateTime : '';
|
$startDateTime = $lastStartDateTime ? date('d/m/Y', strtotime($lastStartDateTime)) : '';
|
||||||
echo ($startDateTime) ? date('d/m/Y', strtotime($startDateTime)) : '';
|
|
||||||
|
if($lastNotification['receiving_status']){
|
||||||
|
if ($startDateTime >= $startDate && $startDateTime <= $endDate) {
|
||||||
|
echo $startDateTime ;
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user