Merge branch 'uat' of bitbucket.org:venbainformationtechnology/vb_book into uat

This commit is contained in:
heama 2023-10-11 18:22:56 +05:30
commit 7e4572b40f

View File

@ -186,7 +186,10 @@ class ApiIntegration extends ResourceController
$basic_message = "";
$book_id = "";
if (count($records) > 0 && !empty($wordpress_book_id)) {
$where = ['wp_api_product_id' => $wordpress_book_id, 'isactive' => 1];
/** Draft status means entry must but inactive. publish means active that's why comment here
* $where = ['wp_api_product_id' => $wordpress_book_id, 'isactive' => $isactive_for_where];
**/
$where = ['wp_api_product_id' => $wordpress_book_id];
$book_details = $api_model->setTable('books')->where($where)->first();
if (isset($book_details['book_id']) && $book_details['book_id'] != "") {
$book_id = $book_details['book_id'];
@ -194,6 +197,7 @@ class ApiIntegration extends ResourceController
} // update means bookid where condition added : else no where condition added.
$countAll = $api_model->countAll('books', $where);
$this->logger->info(($countAll) ? "Api SaveBookDetails : in wordpress product ref ID = ".$wordpress_book_id." is available on Book table and its PrimaryKey = ".$book_id : "Api SaveBookDetails : in wordpress product ref ID = ".$wordpress_book_id." Not available on Book table");
$publisher = NULL;
$language = NULL;
@ -248,11 +252,9 @@ class ApiIntegration extends ResourceController
// $book_data['price'] = (isset($records['sale_price']) && $records['sale_price'] != '') ? $records['sale_price'] : ((isset($records['regular_price']) && $records['regular_price'] != '') ? $records['regular_price'] : NULL);
$book_data['price'] = (isset($records['sale_price']) && $records['sale_price'] != '') ? $records['sale_price'] : ((isset($records['regular_price']) && $records['regular_price'] != '') ? $records['regular_price'] : ((isset($records['price']) && $records['price'] != '') ? $records['price'] : NULL));
$book_data['sku'] = isset($records['sku']) ? $records['sku'] : NULL;
$book_data['isactive'] = (isset($records['status']) && $records['status'] == "publish") ? 1 : 0;
$book_data['isactive'] = (isset($records['status']) && strtolower($records['status']) === "publish") ? 1 : 0;
$book_data['business_id'] = 1;
$images = $records['images'];
if ((int)$countAll == 0) {
$insert_result = $api_model->insertData('books', $book_data);
$last_insert_book_id = $insert_result['info'];
@ -263,7 +265,10 @@ class ApiIntegration extends ResourceController
$insert_result['err'] ? $this->logger->error("Api SaveBookDetails : Err = ".$insert_result['err']):"";
} else {
$last_insert_book_id = $book_id;
$book_where = ['book_id' => $book_id, 'isactive' => 1, 'wp_api_product_id' => $wordpress_book_id];
/** Draft status means entry must but inactive. publish means active that's why comment here
* $book_where = ['book_id' => $book_id, 'isactive' => 1, 'wp_api_product_id' => $wordpress_book_id];
**/
$book_where = ['book_id' => $book_id, 'wp_api_product_id' => $wordpress_book_id];
$update_result = $api_model->updateData('books', $book_data, $book_where);
$extensive_correspondence .= $update_result['info'] ? "Book id : " . $last_insert_book_id . " ( " . $update_result['info'] . ")"
: " ( Err :" . $update_result['err'] . ")";