diff --git a/app/Controllers/ApiIntegration.php b/app/Controllers/ApiIntegration.php index 25ac380c..83c390db 100644 --- a/app/Controllers/ApiIntegration.php +++ b/app/Controllers/ApiIntegration.php @@ -388,8 +388,9 @@ class ApiIntegration extends ResourceController $this->logger->info("Api SaveBookDetails : ".$extensive_correspondence); $master_categories = $api_model->getData('category', ['isactive' => 1]); $this->logger->info("Api SaveBookDetails : total master categories count = ".count($master_categories)); - $where = ['book_id' => (int)$last_insert_book_id, 'isactive' => 1 ]; + $where = ['book_categories.book_id' => (int)$last_insert_book_id, 'book_categories.isactive' => 1 ]; $existing_categories = $api_model->getExistingBookCategories($where); + $this->logger->info("Api SaveBookDetails : existing book categories records => ".json_encode($existing_categories)); $this->logger->info("Api SaveBookDetails : existing book categories count = ".count($existing_categories)." Book_id = ".$last_insert_book_id); $request_categories = (array)$categories; $filtering_existing_categories_wpApiId = []; diff --git a/app/Models/ApiIntegrationModel.php b/app/Models/ApiIntegrationModel.php index cf0a1ad2..bf3dbacb 100644 --- a/app/Models/ApiIntegrationModel.php +++ b/app/Models/ApiIntegrationModel.php @@ -113,7 +113,7 @@ class ApiIntegrationModel extends Model public function getExistingBookCategories($where){ $query = $this->db->table('book_categories') ->join('category', 'category.id = book_categories.category_id', 'left') - ->select('category.*,book_categories.book_id,book_categories.category_id as book_categories_id'); + ->select('category.*,book_categories.book_id,book_categories.category_id as book_categories_id, book_categories.isactive as book_categories_isactive'); $query->where($where); return $query->get()->getResult(); } diff --git a/app/Models/HomeModel.php b/app/Models/HomeModel.php index 1e620828..1a19bc86 100644 --- a/app/Models/HomeModel.php +++ b/app/Models/HomeModel.php @@ -93,15 +93,14 @@ class HomeModel extends Model } public function book_published_list(){ - $now = date('Y-m-d'); - $oneMonthAgo = date('Y-m-d', strtotime($now . ' -1 month')); + $oneMonthAgo = date('Y-m-d', strtotime(' -30 days')); return $this->db->table('books as B') ->select("B.book_id, B.title, B.created_on, B.publisher, B.author, B.publication_date, DATE_FORMAT(B.publication_date, '%d/%m/%Y') as publication_date_format, GROUP_CONCAT(CM.name, ',') as categories") ->join('book_categories as BC', 'BC.book_id = B.book_id and BC.isactive = 1', 'left') ->join('category as CM', 'BC.category_id = CM.id', 'left') ->where('B.created_on >=', $oneMonthAgo) - ->where('B.created_on <=', $now) + ->where('B.created_on <= CURDATE() + INTERVAL 1 DAY') ->where('B.isactive', 1) ->orderBy('B.publication_date', 'DESC') ->groupBy('B.book_id') diff --git a/app/Views/business_form.php b/app/Views/business_form.php index bac6d82c..03a22511 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -42,9 +42,9 @@