Bug Fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-01-06 17:50:27 +05:30
parent 1d16864533
commit 118f985056
4 changed files with 34 additions and 8 deletions

View File

@ -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);

View File

@ -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 "";
}
}
}

View File

@ -25,7 +25,7 @@
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
<?php endif; ?>
<form class="needs-validation" novalidate method="post" enctype="multipart/form-data" action="<?= base_url() . "insert_books"; ?>">
<form class="needs-validation" novalidate method="post" enctype="multipart/form-data" action="<?= base_url() . "insert_books"; ?>" id="myForm">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">

View File

@ -56,8 +56,8 @@
<tr>
<td hidden><?php echo $row['book_id']; ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['publisher']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo isset($row['author']) ? $row['author'] : ""; ?></td>
<td><?php echo $row['category_name']; ?></td>
<td><?php echo $row['language']; ?></td>
<td><?php echo $formattedPublicationYear ; ?></td>
<!-- <td> <span data-plugin="counterup"><?php echo $row['price']; ?></span></td> -->