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