From d088111becfcba37da57d6c87b1dc751226ec68a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 17 Sep 2024 18:42:18 +0530 Subject: [PATCH 1/9] Fixed: Wrong number of customers in the manage your customer list in the admin office --- controllers/admin/AdminCustomersController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index ae8553e62..c523ffd3c 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -82,7 +82,6 @@ class AdminCustomersControllerCore extends AdminController $this->_join .= ' LEFT JOIN '._DB_PREFIX_.'orders o ON (a.id_customer = o.id_customer)'; $this->_group = 'GROUP BY a.`id_customer`'; - $this->_use_found_rows = false; $this->fields_list = array( 'id_customer' => array( 'title' => $this->l('ID'), From ca0500dbd2c65dfd6fb4d6a4f64286d2db3856a2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 17 Sep 2024 18:51:57 +0530 Subject: [PATCH 2/9] Fixed: wrong customers gender percentage in the admin customer KPI --- controllers/admin/AdminStatsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 325499f8a..800242953 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -362,7 +362,7 @@ class AdminStatsControllerCore extends AdminStatsTabController SELECT SUM(IF(c.id_gender IS NOT NULL, 1, 0)) as total, SUM(IF(type = 0, 1, 0)) as male, SUM(IF(type = 1, 1, 0)) as female, SUM(IF(type = 2, 1, 0)) as neutral FROM `'._DB_PREFIX_.'customer` c LEFT JOIN `'._DB_PREFIX_.'gender` g ON c.id_gender = g.id_gender - WHERE c.active = 1 AND c.deleted = 0 '.Shop::addSqlRestriction()); + WHERE 1 AND c.deleted = 0 '.Shop::addSqlRestriction()); if (!$row['total']) { return false; From 01ce3cb57c4ca537cdc0b6365e4060b7289241b8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 17 Sep 2024 19:18:57 +0530 Subject: [PATCH 3/9] Fixed: Wrong count of the customer messages in the KPI on order detail page in the admin office --- classes/CustomerThread.php | 12 +++++++++++- controllers/admin/AdminOrdersController.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index 70db8c507..cfc1772c0 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -38,6 +38,8 @@ class CustomerThreadCore extends ObjectModel public $token; public $date_add; public $date_upd; + const QLO_CUSTOMER_THREAD_TYPE_SENT = 1; + const QLO_CUSTOMER_THREAD_TYPE_RECEIVED = 2; /** * @see ObjectModel::$definition @@ -120,7 +122,7 @@ class CustomerThreadCore extends ObjectModel return $return; } - public static function getCustomerMessages($id_customer, $read = null, $id_order = null) + public static function getCustomerMessages($id_customer, $read = null, $id_order = null, $threadType = null) { $sql = 'SELECT * FROM '._DB_PREFIX_.'customer_thread ct @@ -135,6 +137,14 @@ class CustomerThreadCore extends ObjectModel $sql .= ' AND ct.`id_order` = '.(int)$id_order; } + if ($threadType != null) { + if (self::QLO_CUSTOMER_THREAD_TYPE_SENT == $threadType) { + $sql .= ' AND cm.`id_employee` != 0'; + } else if (self::QLO_CUSTOMER_THREAD_TYPE_RECEIVED == $threadType) { + $sql .= ' AND cm.`id_employee` = 0'; + } + } + $sql .= ' ORDER BY cm.date_add DESC'; return Db::getInstance()->executeS($sql); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30236549b..faa6183f3 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2431,7 +2431,7 @@ class AdminOrdersControllerCore extends AdminController $helper->title = $this->l('Messages'); $helper->tooltip = $this->l('Messages is the number of customer messages for this order.'); $helper->href = $this->context->link->getAdminLink('AdminCustomerThreads').'&id_order='.$objOrder->id; - $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id)); + $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerThread::QLO_CUSTOMER_THREAD_TYPE_RECEIVED)); $this->kpis[] = $helper; $objHotelBookingDetail = new HotelBookingDetail(); From b42e314d5b37440321619bea9ca496a82d8fe91f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 17 Sep 2024 20:04:43 +0530 Subject: [PATCH 4/9] Optimized the code for the customer messages --- classes/CustomerMessage.php | 2 ++ classes/CustomerThread.php | 10 ++++------ controllers/admin/AdminOrdersController.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index 99522fa0d..3406a60ef 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -37,6 +37,8 @@ class CustomerMessageCore extends ObjectModel public $date_add; public $date_upd; public $read; + const QLO_CUSTOMER_MESSAGE_BY_ADMIN = 1; + const QLO_CUSTOMER_MESSAGE_BY_ADMIN_CUSTOMER = 2; /** * @see ObjectModel::$definition diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index cfc1772c0..ef4d99c4a 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -38,8 +38,6 @@ class CustomerThreadCore extends ObjectModel public $token; public $date_add; public $date_upd; - const QLO_CUSTOMER_THREAD_TYPE_SENT = 1; - const QLO_CUSTOMER_THREAD_TYPE_RECEIVED = 2; /** * @see ObjectModel::$definition @@ -122,7 +120,7 @@ class CustomerThreadCore extends ObjectModel return $return; } - public static function getCustomerMessages($id_customer, $read = null, $id_order = null, $threadType = null) + public static function getCustomerMessages($id_customer, $read = null, $id_order = null, $messageBy = null) { $sql = 'SELECT * FROM '._DB_PREFIX_.'customer_thread ct @@ -137,10 +135,10 @@ class CustomerThreadCore extends ObjectModel $sql .= ' AND ct.`id_order` = '.(int)$id_order; } - if ($threadType != null) { - if (self::QLO_CUSTOMER_THREAD_TYPE_SENT == $threadType) { + if ($messageBy !== null) { + if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN == $messageBy) { $sql .= ' AND cm.`id_employee` != 0'; - } else if (self::QLO_CUSTOMER_THREAD_TYPE_RECEIVED == $threadType) { + } else if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN_CUSTOMER == $messageBy) { $sql .= ' AND cm.`id_employee` = 0'; } } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index faa6183f3..d490e1b9b 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2431,7 +2431,7 @@ class AdminOrdersControllerCore extends AdminController $helper->title = $this->l('Messages'); $helper->tooltip = $this->l('Messages is the number of customer messages for this order.'); $helper->href = $this->context->link->getAdminLink('AdminCustomerThreads').'&id_order='.$objOrder->id; - $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerThread::QLO_CUSTOMER_THREAD_TYPE_RECEIVED)); + $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN)); $this->kpis[] = $helper; $objHotelBookingDetail = new HotelBookingDetail(); From 6f3a8d30f6f29ee1b5ba4869e34cf2395c6ebb70 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 18 Sep 2024 12:04:46 +0530 Subject: [PATCH 5/9] Fixed: customer message constant name --- classes/CustomerThread.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index ef4d99c4a..f624d0e9c 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -138,7 +138,7 @@ class CustomerThreadCore extends ObjectModel if ($messageBy !== null) { if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN == $messageBy) { $sql .= ' AND cm.`id_employee` != 0'; - } else if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN_CUSTOMER == $messageBy) { + } else if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_CUSTOMER == $messageBy) { $sql .= ' AND cm.`id_employee` = 0'; } } From 0c06fc1e8ab585564cc18f06b8fcaf1e57c73eca Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 18 Sep 2024 12:05:21 +0530 Subject: [PATCH 6/9] Fixed: customer message constant name --- classes/CustomerMessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index 3406a60ef..4f03df6a4 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -38,7 +38,7 @@ class CustomerMessageCore extends ObjectModel public $date_upd; public $read; const QLO_CUSTOMER_MESSAGE_BY_ADMIN = 1; - const QLO_CUSTOMER_MESSAGE_BY_ADMIN_CUSTOMER = 2; + const QLO_CUSTOMER_MESSAGE_BY_CUSTOMER = 2; /** * @see ObjectModel::$definition From 68443423614f93c3bf47b10e2854d018d76131e9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 18 Sep 2024 12:36:06 +0530 Subject: [PATCH 7/9] Updated: renamed the customer message by admin const to customer message by employee --- classes/CustomerMessage.php | 2 +- classes/CustomerThread.php | 2 +- controllers/admin/AdminOrdersController.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index 4f03df6a4..b67433fc8 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -37,7 +37,7 @@ class CustomerMessageCore extends ObjectModel public $date_add; public $date_upd; public $read; - const QLO_CUSTOMER_MESSAGE_BY_ADMIN = 1; + const QLO_CUSTOMER_MESSAGE_BY_EMPLOYEE = 1; const QLO_CUSTOMER_MESSAGE_BY_CUSTOMER = 2; /** diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index f624d0e9c..7d5353934 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -136,7 +136,7 @@ class CustomerThreadCore extends ObjectModel } if ($messageBy !== null) { - if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN == $messageBy) { + if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_EMPLOYEE == $messageBy) { $sql .= ' AND cm.`id_employee` != 0'; } else if (CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_CUSTOMER == $messageBy) { $sql .= ' AND cm.`id_employee` = 0'; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index d490e1b9b..8edbaa814 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2431,7 +2431,7 @@ class AdminOrdersControllerCore extends AdminController $helper->title = $this->l('Messages'); $helper->tooltip = $this->l('Messages is the number of customer messages for this order.'); $helper->href = $this->context->link->getAdminLink('AdminCustomerThreads').'&id_order='.$objOrder->id; - $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_ADMIN)); + $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_EMPLOYEE)); $this->kpis[] = $helper; $objHotelBookingDetail = new HotelBookingDetail(); From 3bfd26eb61fd935836a6a6a04df44ea7f41eaa39 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 18 Sep 2024 12:59:58 +0530 Subject: [PATCH 8/9] Fixed the wrong function call for the customer messages in AdminOrdersController, Added definition for the CustomerThread::getCustomerMessages() function --- classes/CustomerMessage.php | 1 + classes/CustomerThread.php | 10 ++++++++++ controllers/admin/AdminOrdersController.php | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index b67433fc8..a4b6c920d 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -37,6 +37,7 @@ class CustomerMessageCore extends ObjectModel public $date_add; public $date_upd; public $read; + const QLO_CUSTOMER_MESSAGE_BY_EMPLOYEE = 1; const QLO_CUSTOMER_MESSAGE_BY_CUSTOMER = 2; diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index 7d5353934..7e1b721af 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -120,6 +120,16 @@ class CustomerThreadCore extends ObjectModel return $return; } + /** + * Retrieves customer messages based on specified conditions. + * + * @param int $id_customer Customer ID. + * @param bool|null $read Return read (true), unread (false), or all messages (null). + * @param int|null $id_order Filter messages by order ID. + * @param int|null $messageBy Filter messages by sender (employees, customer, or both). + * + * @return array List of messages matching the conditions. + */ public static function getCustomerMessages($id_customer, $read = null, $id_order = null, $messageBy = null) { $sql = 'SELECT * diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 8edbaa814..b3a65eac7 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2431,7 +2431,7 @@ class AdminOrdersControllerCore extends AdminController $helper->title = $this->l('Messages'); $helper->tooltip = $this->l('Messages is the number of customer messages for this order.'); $helper->href = $this->context->link->getAdminLink('AdminCustomerThreads').'&id_order='.$objOrder->id; - $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_EMPLOYEE)); + $helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id, CustomerMessage::QLO_CUSTOMER_MESSAGE_BY_CUSTOMER)); $this->kpis[] = $helper; $objHotelBookingDetail = new HotelBookingDetail(); From 11d5f4b20f4061cf15814791688cabe7152cbbee Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 18 Sep 2024 19:17:42 +0530 Subject: [PATCH 9/9] Fixed: Room Pricing issue on checkout page in front-office --- .../classes/HotelRoomTypeFeaturePricing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 6f6400f80..09e1d1236 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -730,9 +730,9 @@ class HotelRoomTypeFeaturePricing extends ObjectModel 0, 0, null, + 1, null, - null, - null, + Product::PRICE_ADDITION_TYPE_WITH_ROOM, $id_room )) { $selectedServices = array_shift($roomServicesServices);