Notification : ps

This commit is contained in:
VE10-Sanjeev 2024-01-23 16:05:29 +05:30
parent 5de846a77d
commit 8e0d353c8e
5 changed files with 43 additions and 9 deletions

4
.env
View File

@ -147,8 +147,8 @@ APP_TIMEZONE = 'Asia/Kolkata'
# Whatsapp Access Token And Instance ID
#--------------------------------------------------------------------
# for Live Don't delete it
WAAI_TOKEN = '6568739969f28'
WAAI_INSTANCE = '656876690A9FD'
WAAI_TOKEN = '6582950cb468b'
WAAI_INSTANCE = '6582F04394D59'
# Dummy Account by sanjeev created on 14th dec Testing purpose office mail ID (user name - Venba V1 - Krish12345)
# WAAI_TOKEN = '657af9bf8cad1'

View File

@ -293,8 +293,10 @@ class Invoice extends BaseController
];
$get_subscription_draft_dtl_where = ['S.customer_id'=>$customer_id,'I.status'=>$invoice_status];
$get_subscription_draft_dtl_id = $model->InactiveSubscriptionDraftDetails($get_subscription_draft_dtl_where,get_logged_user_id());
$this->logger->info($msg_flag_name.": has been Inactived. Inv ID = ".implode(", ", $get_subscription_draft_dtl_id));
// $get_subscription_draft_dtl_id = $model->InactiveSubscriptionDraftDetails($get_subscription_draft_dtl_where,get_logged_user_id());
// $this->logger->info($msg_flag_name.": has been Inactived. Inv ID = ".implode(", ", $get_subscription_draft_dtl_id));
$get_subscription_draft_dtl_id = $model->deleteSubscriptionDraftDetails($get_subscription_draft_dtl_where,get_logged_user_id());
$this->logger->info($msg_flag_name.": has been Deleted. Inv ID = ".implode(", ", $get_subscription_draft_dtl_id));
$subscriptionModel->insertSubscriptionData($subscription_data);
}
}
@ -361,7 +363,9 @@ class Invoice extends BaseController
if (!empty($missingValues)) {
$where = ['isactive' => 1, 'invoice_id' => (int)$id];
$model->inactiveMissingInvoiceItemDetails($where, $missingValues);
// $model->inactiveMissingInvoiceItemDetails($where, $missingValues);
$model->deleteMissingInvoiceItemDetails($where, $missingValues);
$this->logger->info("Child Item Details : has been Deleted. Inv Child ID = ".implode(", ", $missingValues));
}
}
}

View File

@ -561,7 +561,7 @@ class Notifications extends BaseController
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP
$whatsappTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP);
if (count($whatsappTemplateName) && !empty($whatsappTemplateName)) {
$campaign_id = 2;
$campaign_id = 2; // hardcoded because static Template.
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
if (empty($userMobileNumber)) {
@ -741,8 +741,13 @@ class Notifications extends BaseController
{
$model = new NotificationModel();
$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');
$where = ['scheduled_date'=>$today,'isactive'=>1];
$notification_campaign_result = $model->where($where)->findAll();
return $notification_campaign_result;
}

View File

@ -37,6 +37,13 @@ public function inactiveMissingInvoiceItemDetails($where,$missingValues){
$this->db->table('invoiceitems')->where($where)->whereIn('invoice_child_id',$missingValues)->update($dataToUpdate);
}
public function deleteMissingInvoiceItemDetails($where, $missingValues) {
$this->db->table('invoiceitems')
->where($where)
->whereIn('invoice_child_id', $missingValues)
->delete();
}
public function updateData($table, $data, $where)
{
$this->db->table($table)->update($data, $where);
@ -63,6 +70,21 @@ public function InactiveSubscriptionDraftDetails($where,$update_by_id)
return $inactive_invoice_ids;
}
public function deleteSubscriptionDraftDetails($where,$update_by_id)
{
$result = $this->getJoinedData($where);
$delete_invoice_ids = array();
foreach ($result as $item) {
$delete_invoice_ids[] = $item['invoice_id'];
}
if(count($delete_invoice_ids)>0){
$this->db->table('subscription')
->whereIn('invoice_id', $delete_invoice_ids)
->delete();
}
return $delete_invoice_ids;
}
## check the customer the scheme already Exist
public function existsSubscriptionDetails($where){
$result = $this->getJoinedData($where);

View File

@ -38,14 +38,17 @@
</div>
</div>
<div class="form-group col-md-8">
<label for="scheduled" class="col-form-label">Scheduled Date/Time<span class="text-danger"> *</span></label>
<!-- <label for="scheduled" class="col-form-label">Scheduled Date/Time<span class="text-danger"> *</span></label> -->
<div class="row">
<div class="col-6">
<label for="scheduled_date" class="col-form-label">Scheduled Date<span class="text-danger"> *</span></label>
<input class="form-control" type="date" name="scheduled_date" id="example-date" value="<?= isset($campaign_details['scheduled_date']) ? $campaign_details['scheduled_date'] : '' ?>" required>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="col-6">
<input class="form-control" type="time" name="scheduled_time" id="example-time" value="<?= isset($campaign_details['scheduled_time']) ? $campaign_details['scheduled_time'] : '' ?>">
<label for="scheduled_time" class="col-form-label">Scheduled Time<span class="text-danger"> *</span></label>
<input class="form-control" type="time" name="scheduled_time" id="example-time" value="<?= isset($campaign_details['scheduled_time']) ? $campaign_details['scheduled_time'] : '' ?>" required>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
</div>