diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 95f9fbb2..987683eb 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -159,8 +159,8 @@ $routes->match(['get','post'],'/itemwise_report_with_payment_method','Invoice::i # Notifications Routes // $routes->get('controller/SubExpdetail/(:num)', 'YourController::SubExpdetail/$1'); -$routes->get("getExpCustomerDetail",'Notifications::getExpCustomerDetail/'); -$routes->get("getExpCustomerDetail/(:any)",'Notifications::getExpCustomerDetail/$1'); +$routes->match(['get','post'],"getExpCustomerDetail",'Notifications::getExpCustomerDetail/'); +$routes->match(['get','post'],"getExpCustomerDetail/(:any)",'Notifications::getExpCustomerDetail/$1'); $routes->get("getExpCustomerDetail/(:any)/(:any)",'Notifications::getExpCustomerDetail/$1/$2'); $routes->get('send_whatsapp_message/', 'Notifications::send_whatsapp_message'); // $routes->post('whatsapp_custom_notifications/', 'Notifications::whatsapp_custom_notifications'); diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index 8f4387aa..643d3849 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -572,12 +572,20 @@ class Notifications extends BaseController ################################################################ public function getExpCustomerDetail($window_time = null,$to_time = null) { + // dd($window_time); + $valid_dates = [0,1,7,15,30]; + if(!in_array($window_time,$valid_dates) ){ + return "Invalid Window Time"; + } $NotificationModel = new NotificationModel(); $this->update_expired_members(); $response ="
";// $response = "
 Hi, Started. 
"; # Step 1: add the days to retrive the data// $providedDate = date('Y-m-d'); - $window_time = $this->request->getGet('params'); + // if ($this->request->getmethod() == 'post') { + // $window_time = $this->request->getGet('params'); + // } + // dd($window_time); if ($window_time!= ''){ if($window_time >= 0){ $newDate = date('Y-m-d', strtotime("$providedDate + $window_time days")); @@ -585,6 +593,8 @@ class Notifications extends BaseController $newDate = date('Y-m-d', strtotime("$providedDate $window_time days")); } $ExpCustomerDetail = $NotificationModel->getExpDate(); // Retrieve the stored query + // echo("Inside If"); + // print_r(''.$ExpCustomerDetail);die(); }else{ $dateData = $this->request->getGet('to_date'); @@ -830,7 +840,12 @@ class Notifications extends BaseController # Loop Closed } $response .= "Process Completed
"; - return $this->response->setBody($response); + if ($this->request->getmethod() == 'get') { + return $response; + }else{ + return $this->response->setBody($response); + + } } diff --git a/app/Models/SubscriptionModel.php b/app/Models/SubscriptionModel.php index c6543c22..6ce52aba 100755 --- a/app/Models/SubscriptionModel.php +++ b/app/Models/SubscriptionModel.php @@ -19,6 +19,9 @@ public function getAllSubscribersWithNames($where) $builder->join('books', 'books.book_id = subscription.scheme_id'); $builder->join('customers', 'customers.customer_id = subscription.customer_id'); $builder->where($where); + + // $query = $this->db->getLastQuery(); + // dd($query); return $builder->get()->getResultArray(); } public function getCustomerNameBySchemeName($schemeName) diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index 12275225..e3a24498 100755 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -861,7 +861,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
- +
diff --git a/app/Views/notify_the_expiry_subscribers.php b/app/Views/notify_the_expiry_subscribers.php index b947f817..5f69d1fb 100755 --- a/app/Views/notify_the_expiry_subscribers.php +++ b/app/Views/notify_the_expiry_subscribers.php @@ -98,7 +98,7 @@ console.log("params 2 is "+ params2); console.log(''); $.ajax({ - type: "GET", + type: "POST", url: `${params}/${params2}`, data: { from_date : from_date,