diff --git a/app/Controllers/Notifications.php b/app/Controllers/Notifications.php index 3dac5bfa..85273636 100755 --- a/app/Controllers/Notifications.php +++ b/app/Controllers/Notifications.php @@ -584,10 +584,9 @@ class Notifications extends BaseController $this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request = " . json_encode($params)); $this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request type b4 = " . gettype($params)); $whatsapp_result = $notification->sendWhatsAppMessage($url, "POST", $params); - $this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Reponse = " . $whatsapp_result['message']); - $receiving_status = $whatsapp_result['receiving_status']; $history_msg = strtolower(gettype($whatsapp_result)) == "string" ? $whatsapp_result : json_encode($whatsapp_result['reponse']); + $this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Reponse = " . $history_msg); } else { $receiving_status = 0; $history_msg = 'There is no Whatsapp template found by the name of EXPIRAY NOTIFY TEMPLATE WHATSAPP '; @@ -687,10 +686,11 @@ class Notifications extends BaseController $params->message = $notificationContent; $params->number = (int)'91' . $customer['mobile_no']; $whatsapp_reponse = $notification->sendWhatsAppMessage($url, "POST", $params); - $this->logger->info("Auto Scheduled Whatsapp CID = ".$customer['customer_id']." ".$whatsapp_reponse['message']); + $whatsapp_reponse_msg = strtolower(gettype($whatsapp_reponse)) == "string" ? $whatsapp_reponse : json_encode($whatsapp_reponse['reponse']); + $this->logger->info("Auto Scheduled Whatsapp CID = ".$customer['customer_id']." ".$whatsapp_reponse_msg); $history_child_where = ['fkid' => $single_campaign['history_parent_id'],'id' => (int)$history_child_id]; - $history_child_updatedata = ['receiving_status'=>$whatsapp_reponse['receiving_status'],'result'=>strtolower(gettype($whatsapp_reponse)) == "string" ? $whatsapp_reponse : json_encode($whatsapp_reponse['reponse'])]; + $history_child_updatedata = ['receiving_status'=>$whatsapp_reponse['receiving_status'],'result'=>$whatsapp_reponse_msg]; $history_child_statement = $model->update_notification_history_child($history_child_updatedata,$history_child_where); $this->logger->info($history_child_statement); diff --git a/app/Models/BooksModel.php b/app/Models/BooksModel.php index 3e913a75..2d762339 100644 --- a/app/Models/BooksModel.php +++ b/app/Models/BooksModel.php @@ -30,7 +30,7 @@ class BooksModel extends Model public function getnonMembershiplist($business_id) { $builder = $this->builder(); - $builder->select('books.book_id, books.wp_api_product_id, books.title, books.price, books.duration, books.isactive, books.publisher, books.genre, books.language, books.publication_date, CASE WHEN category.name THEN GROUP_CONCAT(category.name SEPARATOR \',\') ELSE \'\' END as name, category.id as category_id'); + $builder->select('books.book_id,books.author, books.wp_api_product_id, books.title, books.price, books.duration, books.isactive, books.publisher, books.genre, books.language, books.publication_date, CASE WHEN category.name THEN GROUP_CONCAT(category.name SEPARATOR \',\') ELSE \'\' END as name, category.id as category_id'); $builder->join('book_categories', 'book_categories.book_id = books.book_id and book_categories.isactive = 1', 'left'); $builder->join('category', 'category.id = book_categories.category_id', 'left'); $builder->where('books.business_id', $business_id); @@ -48,10 +48,12 @@ class BooksModel extends Model 'isactive'=>$row->isactive, 'book_id'=>$row->book_id, 'publisher'=>$row->publisher, + 'author'=>$row->author, 'genre'=>$row->genre, 'language'=>$row->language, 'publication_date'=>$row->publication_date, 'name'=>$row->name, + 'category_name' => $this->getGroupCategoryName($row->book_id), 'category_id' => $row->category_id, 'wp_api_product_id'=>$row->wp_api_product_id ]; @@ -120,4 +122,28 @@ public function getData($table, $where = null,$whereIn = null) return $query->update($dataToUpdate); } + public function getGroupCategoryName($book_id){ + $query = $this->db->table('category') + ->select('category.name, book_categories.isactive') + ->join('book_categories', 'book_categories.category_id = category.id') + ->where('book_categories.book_id', $book_id) + ->where('book_categories.isactive', 1) + ->get(); + $results = $query->getResult(); + $categoryNames = array(); + if ($results) { + foreach ($results as $result) { + $categoryName = $result->name; + $isActive = $result->isactive; + if ($isActive == 1) { + $categoryNames[] = $categoryName; + } + } + $commaSeparatedNames = implode(', ', $categoryNames); + return $commaSeparatedNames; + } else { + return ""; + } + } + } diff --git a/app/Views/book_form.php b/app/Views/book_form.php index c8226fe2..7bfb9bc5 100644 --- a/app/Views/book_form.php +++ b/app/Views/book_form.php @@ -25,7 +25,7 @@ getFlashdata('success')) : ?>
getFlashdata('success') ?>
-
"> + " id="myForm">
diff --git a/app/Views/book_list.php b/app/Views/book_list.php index e0fe1607..98249518 100644 --- a/app/Views/book_list.php +++ b/app/Views/book_list.php @@ -56,8 +56,8 @@ - - + +