FIX_BUG id - 0001097

This commit is contained in:
VE10-Sanjeev 2024-09-19 11:14:31 +00:00
parent 774d3733c3
commit 6794e9d2f3
3 changed files with 47 additions and 11 deletions

View File

@ -19,6 +19,7 @@ class Notifications extends BaseController
if($records['mode'] == 'Email'){ if($records['mode'] == 'Email'){
helper('notification'); helper('notification');
$notification = new NotificationHelper(); $notification = new NotificationHelper();
$records['description'] = $records['maildescription'];
$data = $notification->sendEmail($records); $data = $notification->sendEmail($records);
$parents_status = 0; $parents_status = 0;
$receiving_status = 0; $receiving_status = 0;
@ -67,17 +68,20 @@ class Notifications extends BaseController
$params->group_id = $records['group_id']; $params->group_id = $records['group_id'];
} else { } else {
session()->setFlashdata('error', 'Group Id Missing Please Try again..'); session()->setFlashdata('error', 'Group Id Missing Please Try again..');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
}else if ($records['categories'] == 'SEND_WAAI_URL') { }else if ($records['categories'] == 'SEND_WAAI_URL') {
if ($records['mobile'] == "") { if ($records['mobile'] == "") {
session()->setFlashdata('error', 'Mobile Number Missing Please Try again..'); session()->setFlashdata('error', 'Mobile Number Missing Please Try again..');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
} else { } else {
session()->setFlashdata('error', 'Please Choose your Category..'); session()->setFlashdata('error', 'Please Choose your Category..');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
@ -89,6 +93,7 @@ class Notifications extends BaseController
$params->type = "media"; $params->type = "media";
} else { } else {
session()->setFlashdata('error', 'Media Url Missing Please Try again..'); session()->setFlashdata('error', 'Media Url Missing Please Try again..');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
@ -98,12 +103,14 @@ class Notifications extends BaseController
if (empty($doc_details)) { if (empty($doc_details)) {
session()->setFlashdata('error', 'Please select a file to upload.'); session()->setFlashdata('error', 'Please select a file to upload.');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
if (!$doc_details->isValid() || $doc_details->getClientMimeType() !== 'image/jpeg') { if (!$doc_details->isValid() || $doc_details->getClientMimeType() !== 'image/jpeg') {
session()->setFlashdata('error', 'Please upload a valid JPEG image.'); session()->setFlashdata('error', 'Please upload a valid JPEG image.');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
@ -113,6 +120,7 @@ class Notifications extends BaseController
if ($doc_name === '') { if ($doc_name === '') {
$this->logger->error("Err on upload: name not found"); $this->logger->error("Err on upload: name not found");
session()->setFlashdata('error', 'Document name not found. Please try again.'); session()->setFlashdata('error', 'Document name not found. Please try again.');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
@ -207,22 +215,26 @@ class Notifications extends BaseController
session()->setFlashdata("success","Message : Sent Success (". $sended_number_count." / ".$total_number_count." )"); session()->setFlashdata("success","Message : Sent Success (". $sended_number_count." / ".$total_number_count." )");
$this->logger->error("Whatsapp : Final ==> ".$sended_number_count." Sended out of ".$total_number_count." ( Not sended numbers count ".$not_sended_number_count." ) "); $this->logger->error("Whatsapp : Final ==> ".$sended_number_count." Sended out of ".$total_number_count." ( Not sended numbers count ".$not_sended_number_count." ) ");
} }
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
}else{ }else{
session()->setFlashdata('error', 'Message : Mobile Not Founded'); session()->setFlashdata('error', 'Message : Mobile Not Founded');
$this->logger->error('Message : Mobile Not Founded'); $this->logger->error('Message : Mobile Not Founded');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
}else{ }else{
session()->setFlashdata('error', 'Message : Mobile Field Empty'); session()->setFlashdata('error', 'Message : Mobile Field Empty');
$this->logger->error('Message : Mobile Field Empty'); $this->logger->error('Message : Mobile Field Empty');
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
return; return;
} }
} }
} }
$data['page_name'] = 'Custom Notifications';
$this->render_page('notifications_form', $data); $this->render_page('notifications_form', $data);
} }
@ -803,7 +815,24 @@ class Notifications extends BaseController
{ {
foreach($customer_details as $customer) foreach($customer_details as $customer)
{ {
$customer['customer_name'] = isset($customer['customer_name'])
? $customer['customer_name']
: (isset($customer['first_name']) && isset($customer['last_name'])
? $customer['first_name'] . ' ' . $customer['last_name']
: '');
$customer['scheme_name'] = isset($customer['scheme_name']) ? $customer['scheme_name'] : (isset($customer['title']) ? $customer['title'] : "");
$formatted_due_date = "";
if(isset($customer['to_subscription'])){
$dateObj = date_create($customer['to_subscription']);
$formatted_due_date = date_format($dateObj, 'd-m-Y');
}else{
$formatted_due_date = $customer['formatted_due_date'];
}
$customer['formatted_due_date'] = $formatted_due_date;
#step 4 replace templates palceholders with data points #step 4 replace templates palceholders with data points
$notificationContent = $this->replaceTemplateWithDataPoints($template['message'],$customer); $notificationContent = $this->replaceTemplateWithDataPoints($template['message'],$customer);
$history_child_data = [ $history_child_data = [
@ -879,15 +908,21 @@ class Notifications extends BaseController
function getScheduledNotificationDetails() function getScheduledNotificationDetails()
{ {
$model = new NotificationModel(); $model = new NotificationModel();
$today = date('Y-m-d'); $templateIds = [1, 2];
$currentTime = date('H:i:s');
$endTime = date('H:i:s', strtotime('+30 minutes'));
$where = ['scheduled_date' => $today,'isactive' => 1,
'scheduled_time >=' => $currentTime,
'scheduled_time <=' => $endTime
];
$model->setTable('notification_campaign'); $model->setTable('notification_campaign');
$notification_campaign_result = $model->where($where)->findAll(); $notification_campaign_result = $model->whereIn('template_id', $templateIds)->where('isactive', 1)->findAll();
// $today = date('Y-m-d');
// $currentTime = date('H:i:s');
// $endTime = date('H:i:s', strtotime('+30 minutes'));
// $where = ['scheduled_date' => $today,'isactive' => 1,
// 'scheduled_time >=' => $currentTime,
// 'scheduled_time <=' => $endTime
// ];
// $model->setTable('notification_campaign');
// $notification_campaign_result = $model->where($where)->findAll();
// echo $model->getLastQuery();
return $notification_campaign_result; return $notification_campaign_result;
} }

View File

@ -20,6 +20,7 @@ class NotificationModel extends Model
// ->findAll(); // ->findAll();
// } // }
/** This Function used for due_date_notifications routes */
public function getSubscriptionDueDetail($date){ public function getSubscriptionDueDetail($date){
// $now = date('Y-m-d'); // $now = date('Y-m-d');
// $lastWeek = date('Y-m-d', strtotime('+7 days')); // $lastWeek = date('Y-m-d', strtotime('+7 days'));

View File

@ -76,7 +76,7 @@
<div class="form-group row"> <div class="form-group row">
<label for="body" class="col-3 col-form-label">Body<span class="text-danger"> *</span></label> <label for="body" class="col-3 col-form-label">Body<span class="text-danger"> *</span></label>
<div class="col-9"> <div class="col-9">
<textarea id="summernote-basic" name="description" class="form-control" rows="7"> <textarea id="summernote-basic" name="maildescription" class="form-control" rows="7">
<h5>Hello {USER_NAME}, </h5> <h5>Hello {USER_NAME}, </h5>
<p>We create simple, flat & responsive custom mail template.</p> <p>We create simple, flat & responsive custom mail template.</p>
<p>Please, write text here!</p> <p>Please, write text here!</p>