From 1a72a65037055b76e3200a8d091f3ab359b101bb Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 10:38:05 +0530 Subject: [PATCH 01/19] Fixed: Name of the guest user is not present on order detail page in backoffice --- .../default/template/controllers/orders/helpers/view/view.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..d875932f1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -542,6 +542,7 @@
+
 {$customer->firstname} {$customer->lastname}
 {$customer->email}
{if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
 {if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}
From b1474bb9b6cdc80ed467191f6f23a77b56dbd9ba Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 24 Apr 2024 11:12:19 +0530 Subject: [PATCH 02/19] Fixed: Unable to send customer request mail from contact us page --- controllers/front/ContactController.php | 172 +++++----- .../hotel-reservation-theme/contact-form.tpl | 311 +++++++++--------- 2 files changed, 243 insertions(+), 240 deletions(-) diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index ba68dd08c..75f4cf868 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -118,96 +118,96 @@ class ContactControllerCore extends FrontController $this->context->smarty->assign('alreadySent', 1); $contact->email = ''; $contact->customer_service = 0; - } - - if ($contact->customer_service) { - if ((int)$id_customer_thread) { - $ct = new CustomerThread($id_customer_thread); - $ct->status = 'open'; - $ct->id_lang = (int)$this->context->language->id; - $ct->id_contact = (int)$id_contact; - $ct->id_order = (int)$id_order; - if ($id_product = (int)Tools::getValue('id_product')) { - $ct->id_product = $id_product; + } else { + if ($contact->customer_service) { + if ((int)$id_customer_thread) { + $ct = new CustomerThread($id_customer_thread); + $ct->status = 'open'; + $ct->id_lang = (int)$this->context->language->id; + $ct->id_contact = (int)$id_contact; + $ct->id_order = (int)$id_order; + if ($id_product = (int)Tools::getValue('id_product')) { + $ct->id_product = $id_product; + } + $ct->update(); + } else { + $ct = new CustomerThread(); + if (isset($customer->id)) { + $ct->id_customer = (int)$customer->id; + } + $ct->id_shop = (int)$this->context->shop->id; + $ct->id_order = (int)$id_order; + if ($id_product = (int)Tools::getValue('id_product')) { + $ct->id_product = $id_product; + } + $ct->id_contact = (int)$id_contact; + $ct->id_lang = (int)$this->context->language->id; + $ct->email = $from; + $ct->status = 'open'; + $ct->token = Tools::passwdGen(12); + $ct->add(); } - $ct->update(); - } else { - $ct = new CustomerThread(); - if (isset($customer->id)) { - $ct->id_customer = (int)$customer->id; - } - $ct->id_shop = (int)$this->context->shop->id; - $ct->id_order = (int)$id_order; - if ($id_product = (int)Tools::getValue('id_product')) { - $ct->id_product = $id_product; - } - $ct->id_contact = (int)$id_contact; - $ct->id_lang = (int)$this->context->language->id; - $ct->email = $from; - $ct->status = 'open'; - $ct->token = Tools::passwdGen(12); - $ct->add(); - } - if ($ct->id) { - $cm = new CustomerMessage(); - $cm->id_customer_thread = $ct->id; - $cm->message = $message; - if (isset($file_attachment['rename']) && !empty($file_attachment['rename']) && rename($file_attachment['tmp_name'], _PS_UPLOAD_DIR_.basename($file_attachment['rename']))) { - $cm->file_name = $file_attachment['rename']; - @chmod(_PS_UPLOAD_DIR_.basename($file_attachment['rename']), 0664); - } - $cm->ip_address = (int)ip2long(Tools::getRemoteAddr()); - $cm->user_agent = $_SERVER['HTTP_USER_AGENT']; - if (!$cm->add()) { - $this->errors[] = Tools::displayError('An error occurred while sending the message.'); - } - } else { - $this->errors[] = Tools::displayError('An error occurred while sending the message.'); - } - } - - if (!count($this->errors)) { - $var_list = array( - '{order_name}' => '-', - '{attached_file}' => '-', - '{message}' => Tools::nl2br(stripslashes($message)), - '{email}' => $from, - '{product_name}' => '', - ); - - if (isset($file_attachment['name'])) { - $var_list['{attached_file}'] = $file_attachment['name']; - } - - $id_product = (int)Tools::getValue('id_product'); - - if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) { - $order = new Order((int)$ct->id_order); - $var_list['{order_name}'] = $order->getUniqReference(); - $var_list['{id_order}'] = (int)$order->id; - } - - if ($id_product) { - $product = new Product((int)$id_product); - if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) { - $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; - } - } - - if (!empty($contact->email)) { - if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', - $var_list, $contact->email, $contact->name, null, null, - $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from)) { + if ($ct->id) { + $cm = new CustomerMessage(); + $cm->id_customer_thread = $ct->id; + $cm->message = $message; + if (isset($file_attachment['rename']) && !empty($file_attachment['rename']) && rename($file_attachment['tmp_name'], _PS_UPLOAD_DIR_.basename($file_attachment['rename']))) { + $cm->file_name = $file_attachment['rename']; + @chmod(_PS_UPLOAD_DIR_.basename($file_attachment['rename']), 0664); + } + $cm->ip_address = (int)ip2long(Tools::getRemoteAddr()); + $cm->user_agent = $_SERVER['HTTP_USER_AGENT']; + if (!$cm->add()) { + $this->errors[] = Tools::displayError('An error occurred while sending the message.'); + } + } else { $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } - } - if (count($this->errors) > 1) { - array_unique($this->errors); - } elseif (!count($this->errors)) { - $this->context->smarty->assign('confirmation', 1); + if (!count($this->errors)) { + $var_list = array( + '{order_name}' => '-', + '{attached_file}' => '-', + '{message}' => Tools::nl2br(stripslashes($message)), + '{email}' => $from, + '{product_name}' => '', + ); + + if (isset($file_attachment['name'])) { + $var_list['{attached_file}'] = $file_attachment['name']; + } + + $id_product = (int)Tools::getValue('id_product'); + + if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) { + $order = new Order((int)$ct->id_order); + $var_list['{order_name}'] = $order->getUniqReference(); + $var_list['{id_order}'] = (int)$order->id; + } + + if ($id_product) { + $product = new Product((int)$id_product); + if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) { + $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; + } + } + + if (!empty($contact->email)) { + if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', + $var_list, $contact->email, $contact->name, null, null, + $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from)) { + $this->errors[] = Tools::displayError('An error occurred while sending the message.'); + } + } + } + + if (count($this->errors) > 1) { + array_unique($this->errors); + } elseif (!count($this->errors)) { + Tools::redirect($this->context->link->getPageLink('contact', null, null, array('confirm' => 1))); + } } } } @@ -312,6 +312,10 @@ class ContactControllerCore extends FrontController } } //End + + if (Tools::getValue('confirm')) { + $this->context->smarty->assign('confirmation', 1); + } $this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl'); } diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl index 6e7cbdc7e..9c16eca35 100644 --- a/themes/hotel-reservation-theme/contact-form.tpl +++ b/themes/hotel-reservation-theme/contact-form.tpl @@ -45,174 +45,173 @@ -{else} - {include file="$tpl_dir./errors.tpl"} -
-
-

{l s='Contact Us'}

-

{l s='Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry`s standard dummy text.'}

-
-
- {if (isset($gblHtlAddress) && $gblHtlAddress) && (isset($gblHtlPhone) && $gblHtlPhone) && (isset($gblHtlEmail) && $gblHtlEmail)} -
-
- {if isset($gblHtlPhone) && $gblHtlPhone } -
-

{l s='Main Branch'}

-

- {$gblHtlAddress} -

-
- {/if} - {if isset($gblHtlPhone) && $gblHtlPhone} -
-

{l s='Phone'}

-

- {$gblHtlPhone} -

-
- {/if} - {if isset($gblHtlEmail) && $gblHtlEmail} -
-

{l s='Mail Us'}

-

- {$gblHtlEmail} -

-
- {/if} -
-
- {/if} -
-
- {if isset($customerThread.id_contact) && $customerThread.id_contact && $contacts|count} - {assign var=flag value=true} - {foreach from=$contacts item=contact} - {if $contact.id_contact == $customerThread.id_contact} - - - {$flag=false} - {/if} - {/foreach} - {if $flag && isset($contacts.0.id_contact)} - - - {/if} - {else} -
-
- - -
+{/if} +{include file="$tpl_dir./errors.tpl"} +
+
+

{l s='Contact Us'}

+

{l s='Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry`s standard dummy text.'}

+
+
+ {if (isset($gblHtlAddress) && $gblHtlAddress) && (isset($gblHtlPhone) && $gblHtlPhone) && (isset($gblHtlEmail) && $gblHtlEmail)} +
+
+ {if isset($gblHtlPhone) && $gblHtlPhone } +
+

{l s='Main Branch'}

+

+ {$gblHtlAddress} +

{/if} -
-
- - {if isset($customerThread.email)} - - {else} - - {/if} + {if isset($gblHtlPhone) && $gblHtlPhone} +
+

{l s='Phone'}

+

+ {$gblHtlPhone} +

-
+ {/if} + {if isset($gblHtlEmail) && $gblHtlEmail} +
+

{l s='Mail Us'}

+

+ {$gblHtlEmail} +

+
+ {/if} +
+
+ {/if} +
+ + {if isset($customerThread.id_contact) && $customerThread.id_contact && $contacts|count} + {assign var=flag value=true} + {foreach from=$contacts item=contact} + {if $contact.id_contact == $customerThread.id_contact} + + + {$flag=false} + {/if} + {/foreach} + {if $flag && isset($contacts.0.id_contact)} + + + {/if} + {else}
- -
-
- {if $fileupload == 1} -
-
- - - +
- {/if} - {hook h='displayGDPRConsent' moduleName='contactform'} -
- - -
- + {/if} +
+
+ + {if isset($customerThread.email)} + + {else} + + {/if} +
+
+
+
+ + +
+
+ {if $fileupload == 1} +
+
+ + + +
+
+ {/if} + {hook h='displayGDPRConsent' moduleName='contactform'} +
+ + + +
+ +
+
+ {if isset($hotelsInfo) && $hotelsInfo} +
+
+ {l s='Our Hotels'} +
+ {foreach $hotelsInfo as $hotel} +
+
+ {$hotel['city']} +
+
+
+ +
+
+

{$hotel['hotel_name']}

+

{$hotel['address']}, {$hotel['city']}, {if {$hotel['state_name']}}{$hotel['state_name']},{/if} {$hotel['country_name']}, {$hotel['postcode']}

+ {if $hotel['latitude'] != 0 || $hotel['longitude'] != 0} +

+ + {l s='View on map'} + +

+ {/if} +

+ {$hotel['phone']} +

+

+ {$hotel['email']} +

+
+
+
+ {/foreach} +
+ {/if} + {if isset($hotelLocationArray)} +
+
+
- {if isset($hotelsInfo) && $hotelsInfo} -
-
- {l s='Our Hotels'} -
- {foreach $hotelsInfo as $hotel} -
-
- {$hotel['city']} -
-
-
- -
-
-

{$hotel['hotel_name']}

-

{$hotel['address']}, {$hotel['city']}, {if {$hotel['state_name']}}{$hotel['state_name']},{/if} {$hotel['country_name']}, {$hotel['postcode']}

- {if $hotel['latitude'] != 0 || $hotel['longitude'] != 0} -

- - {l s='View on map'} - -

- {/if} -

- {$hotel['phone']} -

-

- {$hotel['email']} -

-
-
-
- {/foreach} -
- {/if} - {if isset($hotelLocationArray)} -
-
-
-
-
- {/if} -
-
-{/if} + {/if} +
+
{strip} {addJsDefL name='contact_fileDefaultHtml'}{l s='No file selected' js=1}{/addJsDefL} From 5634a139ce6832c5dc26e6fdd45d0e584d87d2d8 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 14 May 2024 15:39:15 +0530 Subject: [PATCH 03/19] Fixed: Admin refund request page filter issue --- .../AdminOrderRefundRequestsController.php | 282 ++++++++---------- 1 file changed, 131 insertions(+), 151 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index f6eb2fb5f..4c730434e 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -28,15 +28,23 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $this->list_no_link = true; $this->context = Context::getContext(); - $this->_select = ' COUNT(IF(a.`state` = '.(int) Configuration::get('PS_ORS_PENDING').', 1, NULL)) AS total_pending_requests, - ord.`id_currency`, ord.`total_paid_tax_incl` AS total_order, SUM(a.`refunded_amount`) AS refunded_amount, CONCAT(firstname, " ", lastname) AS cust_name, os.`color`, os.`id_order_state`'; + $this->_select = ' ord.`id_currency`, CONCAT(firstname, " ", lastname) AS cust_name'; $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'orders` ord ON (a.`id_order` = ord.`id_order`)'; - $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_state os ON (os.`id_order_state` = ord.`current_state`)'; - $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_state_lang osl ON (osl.`id_order_state` = os.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')'; $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'customer` cust ON (cust.`id_customer` = ord.`id_customer`)'; $this->_orderWay = 'DESC'; - $this->_group = 'GROUP BY ord.`id_order`'; + if ($idOrder = Tools::getValue('id_order')) { + $this->_select .= ', orsl.`name` as `status_name`, ors.`color`'; + $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->_where = ' AND a.`id_order`='. (int)$idOrder; + $this->_group = ''; + } 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`)'; + $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_state_lang osl ON (osl.`id_order_state` = os.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')'; + $this->_group = 'GROUP BY ord.`id_order`'; + } $orderStatuses = OrderState::getOrderStates($this->context->language->id); $ordStatuses = array(); @@ -44,38 +52,85 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $ordStatuses[$status['id_order_state']] = $status['name']; } /*for showing status of booking with badge_danger or success*/ - $this->fields_list = array( - 'id_order' => array( + $this->fields_list = array(); + + if ($idOrder = Tools::getValue('id_order')) { + $refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id); + + $retStatuses = array(); + foreach ($refundStatuses as $status) { + $retStatuses[$status['id_order_return_state']] = $status['name']; + } + $this->fields_list['id_order_return'] = array( + 'title' => $this->l('Request ID'), + 'align' => 'center', + 'class' => 'fixed-width-xs', + ); + $this->fields_list['id_order'] = array( 'title' => $this->l('Order ID'), 'align' => 'center', 'class' => 'fixed-width-xs', 'callback' => 'setOrderLink', 'havingFilter' => true, - ), - 'cust_name' => array( + ); + $this->fields_list['cust_name'] = array( 'title' => $this->l('Customer Name'), 'align' => 'center', 'havingFilter' => true, 'callback' => 'setCustomerLink', - ), - 'total_order' => array( - 'title' => $this->l('Total Order Amount'), - 'align' => 'center', - 'callback' => 'setOrderCurrency', - 'havingFilter' => true, - ), - 'refunded_amount' => array( + ); + $this->fields_list['refunded_amount'] = array( 'title' => $this->l('Refunded Amount'), 'align' => 'center', 'callback' => 'setOrderCurrency', 'havingFilter' => true, - ), - 'total_pending_requests' => array( + ); + $this->fields_list['status_name'] = array( + 'title' => $this->l('Refund Status'), + 'type' => 'select', + 'color' => 'color', + 'list' => $retStatuses, + 'filter_key' => 'ors!id_order_return_state', + 'filter_type' => 'int', + ); + $this->fields_list['date_add'] = array( + 'title' => $this->l('Requested Date'), + 'type' => 'datetime', + 'havingFilter' => true, + 'filter_key' => 'a!date_add', + ); + } else { + $this->fields_list['id_order'] = array( + 'title' => $this->l('Order ID'), + 'align' => 'center', + 'class' => 'fixed-width-xs', + 'callback' => 'setOrderLink', + 'havingFilter' => true, + ); + $this->fields_list['cust_name'] = array( + 'title' => $this->l('Customer Name'), + 'align' => 'center', + 'havingFilter' => true, + 'callback' => 'setCustomerLink', + ); + $this->fields_list['refunded_amount'] = array( + 'title' => $this->l('Refunded Amount'), + 'align' => 'center', + 'callback' => 'setOrderCurrency', + 'havingFilter' => true, + ); + $this->fields_list['total_order'] = array( + 'title' => $this->l('Total Order Amount'), + 'align' => 'center', + 'callback' => 'setOrderCurrency', + 'havingFilter' => true, + ); + $this->fields_list['total_pending_requests'] = array( 'title' => $this->l('Pending Requests'), 'align' => 'center', 'havingFilter' => true, - ), - ); + ); + } $this->addRowAction('view'); $this->identifier = 'id_order_return'; @@ -88,15 +143,20 @@ class AdminOrderRefundRequestsController extends ModuleAdminController parent::__construct(); - // work on renderlist filter on render view page - if (Tools::isSubmit('submitResetorder_return') && Tools::getValue('id_order')) { - Tools::redirectAdmin($this->context->link->getAdminLink('AdminOrderRefundRequests').'&id_order='.Tools::getValue('id_order').'&view'.$this->table); - } $this->_conf[101] = $this->l('Refund request has been denied successfully.'); $this->_conf[102] = $this->l('Refund request has been completed successfully.'); } + public function init() + { + parent::init(); + if ($idOrder = Tools::getValue('id_order')) { + self::$currentIndex = self::$currentIndex.'&id_order='.(int) $idOrder; + } + } + + public function setOrderCurrency($echo, $row) { return Tools::displayPrice($echo, (int) $row['id_currency']); @@ -122,7 +182,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController { if (!Tools::getValue('id_order')) { $objOrderReturn = new OrderReturn($idOrderReturn); - return ' + return ' '.$this->l('View'). ''; } else { @@ -139,137 +199,57 @@ class AdminOrderRefundRequestsController extends ModuleAdminController return; } $refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id); - if ($idOrder = Tools::getValue('id_order')) { - // work on renderlist filter on renderview page - if (!Tools::isSubmit('submitFilterorder_return')) { - $this->processResetFilters(); + $objCustomer = new Customer($objOrderReturn->id_customer); + $objOrder = new Order($objOrderReturn->id_order); + $orderCurrency = new Currency($objOrder->id_currency); + + $objRefundRules = new HotelOrderRefundRules(); + if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($objOrderReturn->id_order, $objOrderReturn->id)){ + foreach ($refundReqBookings as &$booking) { + $bookingCharges = $objRefundRules->getBookingCancellationDetails( + $objOrderReturn->id_order, + $objOrderReturn->id, + $booking['id'] + ); + $booking = array_merge($booking, array_shift($bookingCharges)); } - - $this->table = 'order_return'; - $this->identifier = 'id_order_return'; - - /*for showing status of booking with badge_danger or success*/ - $this->_select = ' CONCAT(cust.`firstname`, " ", cust.`lastname`) AS `cust_name`, ors.`color`, orsl.`name` as `status_name`, ord.`id_currency`'; - $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'customer` cust ON (cust.`id_customer` = a.`id_customer`)'; - $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'orders` ord ON (ord.`id_order` = a.`id_order`)'; - $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->_where = ' AND a.`id_order`='. (int)$idOrder; - $this->_group = ''; - - $retStatuses = array(); - foreach ($refundStatuses as $status) { - $retStatuses[$status['id_order_return_state']] = $status['name']; - } - $this->fields_list = array( - 'id_order_return' => array( - 'title' => $this->l('Request ID'), - 'align' => 'center', - 'class' => 'fixed-width-xs', - ), - 'id_order' => array( - 'title' => $this->l('Order ID'), - 'align' => 'center', - 'class' => 'fixed-width-xs', - 'callback' => 'setOrderLink', - 'havingFilter' => true, - 'filter_key' => 'a!id_order', - 'filter_type' => 'int', - ), - 'cust_name' => array( - 'title' => $this->l('Customer Name'), - 'align' => 'center', - 'havingFilter' => true, - 'callback' => 'setCustomerLink', - ), - 'status_name' => array( - 'title' => $this->l('Refund Status'), - 'type' => 'select', - 'color' => 'color', - 'list' => $retStatuses, - 'filter_key' => 'ors!id_order_return_state', - 'filter_type' => 'int', - ), - 'refunded_amount' => array( - 'title' => $this->l('Refunded Amount'), - 'align' => 'center', - 'callback' => 'setOrderCurrency', - 'havingFilter' => true, - ), - 'date_add' => array( - 'title' => $this->l('Requested Date'), - 'type' => 'datetime', - 'havingFilter' => true, - 'filter_key' => 'a!date_add', - ), - ); - - $this->identifier = 'id_order_return'; - - if (Tools::isSubmit('submitFilterorder_return')) { - $this->processFilter(); - } - - return parent::renderList(); - } else { - $objCustomer = new Customer($objOrderReturn->id_customer); - $objOrder = new Order($objOrderReturn->id_order); - $orderCurrency = new Currency($objOrder->id_currency); - - $objRefundRules = new HotelOrderRefundRules(); - if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($objOrderReturn->id_order, $objOrderReturn->id)){ - foreach ($refundReqBookings as &$booking) { - $bookingCharges = $objRefundRules->getBookingCancellationDetails( - $objOrderReturn->id_order, - $objOrderReturn->id, - $booking['id'] - ); - $booking = array_merge($booking, array_shift($bookingCharges)); - } - } - - $paymentMethods = array(); - foreach (PaymentModule::getInstalledPaymentModules() as $payment) { - $module = Module::getInstanceByName($payment['name']); - if (Validate::isLoadedObject($module) && $module->active) { - $paymentMethods[] = $module->displayName; - } - } - - $this->context->smarty->assign( - array ( - 'orderTotalPaid' => $objOrder->getTotalPaid(), - 'customer_name' => $objCustomer->firstname.' '.$objCustomer->lastname, - 'customer_email' => $objCustomer->email, - 'orderReturnInfo' => (array)$objOrderReturn, - 'refundReqBookings' => $refundReqBookings, - 'orderInfo' => (array) $objOrder, - 'orderCurrency' => (array) $orderCurrency, - 'currentOrderStateInfo' => (array) new OrderState($objOrder->current_state, - $this->context->language->id), - 'currentStateInfo' => (array) new OrderReturnState($objOrderReturn->state, - $this->context->language->id), - 'current_id_lang' => $this->context->language->id, - 'refundStatuses' => $refundStatuses, - 'isRefundCompleted' => $objOrderReturn->hasBeenCompleted(), - 'paymentMethods' => $paymentMethods, - 'name_controller' => Tools::getValue('controller'), - 'info_icon_path' => $this->context->link->getMediaLink(_MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icon-info.svg') - ) - ); - - return parent::renderView(); } + + $paymentMethods = array(); + foreach (PaymentModule::getInstalledPaymentModules() as $payment) { + $module = Module::getInstanceByName($payment['name']); + if (Validate::isLoadedObject($module) && $module->active) { + $paymentMethods[] = $module->displayName; + } + } + + $this->context->smarty->assign( + array ( + 'orderTotalPaid' => $objOrder->getTotalPaid(), + 'customer_name' => $objCustomer->firstname.' '.$objCustomer->lastname, + 'customer_email' => $objCustomer->email, + 'orderReturnInfo' => (array)$objOrderReturn, + 'refundReqBookings' => $refundReqBookings, + 'orderInfo' => (array) $objOrder, + 'orderCurrency' => (array) $orderCurrency, + 'currentOrderStateInfo' => (array) new OrderState($objOrder->current_state, + $this->context->language->id), + 'currentStateInfo' => (array) new OrderReturnState($objOrderReturn->state, + $this->context->language->id), + 'current_id_lang' => $this->context->language->id, + 'refundStatuses' => $refundStatuses, + 'isRefundCompleted' => $objOrderReturn->hasBeenCompleted(), + 'paymentMethods' => $paymentMethods, + 'name_controller' => Tools::getValue('controller'), + 'info_icon_path' => $this->context->link->getMediaLink(_MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icon-info.svg') + ) + ); + + return parent::renderView(); } public function postProcess() { - // for the filteration - if (Tools::isSubmit('submitFilterorder_return') && Tools::isSubmit('order_returnFilter_ors!id_order_return_state')) { - self::$currentIndex .= '&id_order_return=1&id_order=1&vieworder_return'; - } - /*If Admin update the status of the order cancellation request*/ if (Tools::isSubmit('submitRefundReqBookings') || Tools::isSubmit('submitRefundReqBookingsAndStay')) { $idOrderReturn = Tools::getValue('id_order_return'); From 59dca922a4ef692a9063ea977bbf3fca3c77adf5 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 18 May 2024 10:51:14 +0530 Subject: [PATCH 04/19] Fixed:When we set Order status as cancelled the rooms are set is_refunded=1 in the htl_booking_detail table instead of is_cancelled = 1 --- .../hotelreservationsystem/classes/HotelBookingDetail.php | 4 ++-- modules/hotelreservationsystem/hotelreservationsystem.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 047e1de46..e7abb8d20 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1975,10 +1975,10 @@ class HotelBookingDetail extends ObjectModel * * @return [boolean] [true if updated otherwise false] */ - public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1) + public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = 0) { $table = 'htl_booking_detail'; - $data = array('is_refunded' => (int) $is_refunded); + $data = array('is_refunded' => (int) $is_refunded, 'is_cancelled' => (int) $is_cancelled); if ($id_rooms) { foreach ($id_rooms as $key_rm => $val_rm) { diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index bf6473245..bbb1018b5 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -484,7 +484,11 @@ class HotelReservationSystem extends Module // Make rooms available for booking if order status is cancelled, refunded or error if (in_array($params['newOrderStatus']->id, $objHtlBkDtl->getOrderStatusToFreeBookedRoom())) { - if (!$objHtlBkDtl->updateOrderRefundStatus($params['id_order'])) { + $isCancalled = 0; + if ($params['newOrderStatus']->id == Configuration::get('PS_OS_CANCELED')) { + $isCancalled = 1; + } + if (!$objHtlBkDtl->updateOrderRefundStatus($params['id_order'], false, false, array(), 1, $isCancalled)) { $this->context->controller->errors[] = $this->l('Error while making booked rooms available, attached with this order. Please try again !!'); } } From 79061b2442885fed3633d39af22cdeaaa4e937e5 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 20 May 2024 19:27:23 +0530 Subject: [PATCH 05/19] Updated: Room type position update field alert message in back office --- .../controllers/products/informations.tpl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/products/informations.tpl b/admin/themes/default/template/controllers/products/informations.tpl index c68ea9f73..68a6d2d18 100644 --- a/admin/themes/default/template/controllers/products/informations.tpl +++ b/admin/themes/default/template/controllers/products/informations.tpl @@ -446,24 +446,21 @@ {if isset($product->id) && $product->id}
-

{l s='Please note that position numbering starts from 0. A position of 0 means room type will be displayed at the topmost.'}

+

{l s='Please note that position numbering starts from 0. A position of 0 means room type will be displayed at the topmost position.'}

+
+ {l s='You can manage positions of the room types of this hotel from'} + {l s='here.'} +
{/if} - {if isset($product->id) && $product->id} -
- {l s='You can change positions of room types of this hotel from '} - {l s='here.'} -
- {/if} - {*