bug fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-01-06 00:08:26 +05:30
parent ae98fd368c
commit 1d16864533
6 changed files with 43 additions and 20 deletions

View File

@ -65,6 +65,7 @@ class Books extends BaseController
$session_bid = get_business_id();
$BooksModel = new BooksModel();
$book_id = $requested_details['book_id'];
$requested_details['publication_date'] = (isset($requested_details['publication_date']) && $requested_details['publication_date'] != "") ? $requested_details['publication_date'] : NULL ;
if (empty($book_id )) {
$requested_details['created_by'] = (int)$session_uid;
if ($BooksModel->insert($requested_details)) {
@ -91,7 +92,7 @@ class Books extends BaseController
## book category section.
$category_id = $requested_details['category_id'];
if ($category_id) {
if ($category_id != "") {
$existingRecord = $BooksModel->db->table('book_categories')
->where(['book_id'=> $book_id,'category_id'=> $category_id])

View File

@ -30,11 +30,11 @@ 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, GROUP_CONCAT(category.name SEPARATOR \',\') as name,category.id as category_id');
$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->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);
$builder->where('category.name !=', 'membership'); // Exclude books with the category name "membership"
$builder->where("LOWER(category.name) != 'membership' OR category.id IS NULL");
$builder->groupBy('books.book_id');
$query = $builder->get();

View File

@ -217,17 +217,34 @@ public function InactiveSubscriptionDraftDetails($where,$update_by_id)
public function getCategoryBooks($type)
{
$where = ($type == 1) ? ['LOWER(category.name) !=' => strtolower('Membership')] : ['LOWER(category.name)' => strtolower('Membership')];
// $where = ($type == 1) ? ['LOWER(category.name) !=' => strtolower('Membership')] : ['LOWER(category.name)' => strtolower('Membership')];
// $data = $this->db->table('books')
// ->select('books.book_id,books.business_id,books.wp_api_product_id,books.title,books.publication_date,books.publisher,books.author,books.genre,books.language,books.description,books.short_description,books.page_count,books.price,books.isbn_code,books.tax,books.sku,books.category,books.isactive')
// ->join('book_categories', 'book_categories.book_id= books.book_id', 'left')
// ->join('category','category.id=book_categories.category_id')
// ->where($where)
// ->groupBy('books.book_id')
// ->get()
// ->getResult();
// print_r($this->db->getLastQuery());die;
$data = $this->db->table('books')
->select('books.book_id,books.business_id,books.wp_api_product_id,books.title,books.publication_date,books.publisher,books.author,books.genre,books.language,books.description,books.short_description,books.page_count,books.price,books.isbn_code,books.tax,books.sku,books.category,books.isactive')
->join('book_categories', 'book_categories.book_id= books.book_id', 'left')
->join('category','category.id=book_categories.category_id')
->where($where)
->groupBy('books.book_id')
->get()
->getResult();
// print_r($this->db->getLastQuery());die;
->select('books.book_id,books.business_id,books.wp_api_product_id,books.title,books.publication_date,books.publisher,books.author,books.genre,books.language,books.description,books.short_description,books.page_count,books.price,books.isbn_code,books.tax,books.sku,books.category,books.isactive')
->join('book_categories', 'book_categories.book_id = books.book_id and book_categories.isactive = 1', 'left')
->join('category', 'category.id = book_categories.category_id', 'left');
if ($type == 1) {
$data->where("LOWER(category.name) != 'membership' OR category.id IS NULL");
} else {
$data->where('LOWER(category.name)', 'membership');
}
$data = $data->groupBy('books.book_id')
->get()
->getResult();
return $data;
return $data;
}

View File

@ -278,12 +278,14 @@ public function customerGroupQueryExecution($queries){
notification_history_children.receiving_status,
notification_history_children.result,
notification_history_children.sent_time,
DATE_FORMAT(notification_history_children.sent_time, "%d/%m/%Y %H:%i:%s") AS formatted_sent_time,
DATE_FORMAT(notification_history_children.sent_time, "%d/%m/%Y %h:%i %p") AS formatted_sent_date_time,
DATE_FORMAT(notification_history_children.sent_time, "%d/%m/%Y") AS formatted_sent_date,
notification_history_parents.campaign_id,
notification_campaign.campaign_name,
notification_history_parents.status AS parents_status,
notification_history_parents.start_date_time,
DATE_FORMAT(notification_history_parents.start_date_time, "%d/%m/%Y %H:%i:%s") AS formatted_start_date_time
DATE_FORMAT(notification_history_parents.start_date_time, "%d/%m/%Y %h:%i %p") AS formatted_start_date_time,
DATE_FORMAT(notification_history_parents.start_date_time, "%d/%m/%Y") AS formatted_start_date
');
$query->join('notification_history_parents', 'notification_history_parents.id = notification_history_children.fkid', 'left');

View File

@ -51,6 +51,7 @@
$message = 'In-Active';
}
$edit_page_route = base_url() . "book_page/" . $row['book_id'];
$formattedPublicationYear = ($row['publication_date'] !== null && $row['publication_date'] != '') ? date('Y', strtotime($row['publication_date'])) : "";
?>
<tr>
<td hidden><?php echo $row['book_id']; ?></td>
@ -58,7 +59,7 @@
<td><?php echo $row['publisher']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['language']; ?></td>
<td><?php echo $row['publication_date'] ? date('Y', strtotime($row['publication_date'])) : "" ; ?></td>
<td><?php echo $formattedPublicationYear ; ?></td>
<!-- <td> <span data-plugin="counterup"><?php echo $row['price']; ?></span></td> -->
<td> <?php echo $row['price']; ?></td>
<td>
@ -68,8 +69,10 @@
<?php if($row['wp_api_product_id']){
echo "Online Product";
}else{ ?>
<a href="<?php echo $edit_page_route; ?>" class="edit-button"> <i class="ri-pencil-line"></i></a>
<a href="<?= base_url() . "delete_books/" . $row['book_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
<a href="<?php echo $edit_page_route; ?>" class="edit-button" title="Click to Edit Book"><i class="ri-pencil-line"></i></a>
<?php if((int)$row['isactive'] === 1){ ?>
<a href="<?= base_url() . "delete_books/" . $row['book_id']; ?>" class="delete-button" title="Click to Delete Book"><i class="ri-delete-bin-line"></i></a>
<?php } ?>
<?php } ?>
</td>

View File

@ -11,7 +11,7 @@
<th hidden></th>
<th>Name</th>
<th>Mode</th>
<th>Schedule At</th>
<th>Schedule At (Date)</th>
<th>Sent At</th>
<th>Campaign Name</th>
<th>Status</th>
@ -30,8 +30,8 @@
<td hidden><?= $na['child_id']; ?></td>
<td><?= $na['customers_name']; ?></td>
<td><?= $na['receiving_entity']; ?></td>
<td><?= $na['formatted_start_date_time']; ?></td>
<td><?= $na['formatted_sent_time']; ?></td>
<td><?= $na['formatted_start_date']; ?></td>
<td><?= $na['formatted_sent_date_time']; ?></td>
<td><?= $na['campaign_name']; ?></td>
<td><span class="<?= $class; ?>" title="<?= $result; ?>"><?= $icon; ?></span></td>
<!-- <td><?= $na['receiving_status']; ?></td> -->