From 32b1aa819e08d69731282fdb36df292f557e73da Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 20 Jan 2025 14:53:45 +0530 Subject: [PATCH] Added: Total rooms column in refund request list and detail pag in back-officee --- .../admin/AdminOrderRefundRequestsController.php | 10 ++++++++-- .../admin/order_refund_requests/helpers/view/view.tpl | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 4c889b751..315dfeb1b 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -34,11 +34,12 @@ public function __construct() $this->_orderWay = 'DESC'; if ($idOrder = Tools::getValue('id_order')) { - $this->_select .= ', orsl.`name` as `status_name`, ors.`color`'; + $this->_select .= ', orsl.`name` as `status_name`, ors.`color`, COUNT(ordrd.`id_order_return_detail`) as num_rooms'; $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state ors ON (ors.`id_order_return_state` = a.`state`)'; $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')'; + $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ordrd ON (a.`id_order_return` = ordrd.`id_order_return`)'; $this->_where = ' AND a.`id_order`='. (int)$idOrder; - $this->_group = ''; + $this->_group = 'GROUP BY a.`id_order_return`'; } else { $this->_select .= ', ord.`total_paid_tax_incl` AS total_order, os.`id_order_state`, os.`color`, COUNT(IF(a.`state` = '.(int) Configuration::get('PS_ORS_PENDING').', 1, NULL)) AS total_pending_requests, SUM(a.`refunded_amount`) AS refunded_amount'; $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_state os ON (os.`id_order_state` = ord.`current_state`)'; @@ -79,6 +80,11 @@ public function __construct() 'havingFilter' => true, 'callback' => 'setCustomerLink', ); + $this->fields_list['num_rooms'] = array( + 'title' => $this->l('Total Rooms'), + 'align' => 'center', + 'havingFilter' => true, + ); $this->fields_list['refunded_amount'] = array( 'title' => $this->l('Refunded Amount'), 'align' => 'center', diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index efa12371a..3dae5cd89 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -81,6 +81,14 @@ {displayPrice price=$orderTotalPaid currency=$orderInfo['id_currency']} +
+
+ {l s='Total rooms' mod='hotelreservationsystem'} : +
+
+ {$refundReqBookings|count} +
+
{l s='Way of payment' mod='hotelreservationsystem'} :