From 021a003ab334d8f57c1aea1fe9779bcf2579cf11 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Apr 2024 13:09:38 +0530 Subject: [PATCH 01/35] Updated error message for guest account to customer account transformation --- controllers/front/GuestTrackingController.php | 9 +++++++-- controllers/front/OrderOpcController.php | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index ab05a2876..ad2a0cb29 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -95,8 +95,13 @@ class GuestTrackingControllerCore extends FrontController } elseif (!Tools::getValue('password')) { $this->errors[] = Tools::displayError('Invalid password.'); } elseif (!$customer->transformToCustomer($this->context->language->id, Tools::getValue('password'))) { - // @todo clarify error message - $this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.'); + if (!$customer->isGuest()) { + $this->errors[] = Tools::displayError('This account is already registered as a customer.'); + }else if (!Validate::isPasswd(Tools::getValue('password'))) { + $this->errors[] = Tools::displayError('Invalid password.'); + } else { + $this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.'); + } } else { $this->context->smarty->assign('transformSuccess', true); } diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 465c6a7ca..e109721a6 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -176,7 +176,13 @@ class OrderOpcControllerCore extends ParentOrderController if ($customer->transformToCustomer($this->context->language->id, $passwd)) { $this->context->updateCustomer($customer); } else { - $this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.'); + if (!$customer->isGuest()) { + $this->errors[] = Tools::displayError('This account is already registered as a customer.'); + }else if (!Validate::isPasswd($passwd)) { + $this->errors[] = Tools::displayError('Invalid password.'); + } else { + $this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.'); + } } } From a316307c2ea1c6d7250f75b2db5ec6f0ea6e2bd4 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 17 Apr 2024 16:00:52 +0530 Subject: [PATCH 02/35] Fixed: Search panel issue on room type page when hotel is disabled --- .../wkroomsearchblock/classes/WkRoomSearchHelper.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php index 7ab3d7138..dc4ac075c 100644 --- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php +++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php @@ -159,11 +159,13 @@ class WkRoomSearchHelper $searchedData['location'] = $objLocationCategory->name; } else { $locationCategoryId = $objCategory->id_parent; - $searchedData['location'] = $searchedData['htl_dtl']['city']; - if (isset($searchedData['htl_dtl']['state_name'])) { - $searchedData['location'] .= ', '.$searchedData['htl_dtl']['state_name']; + if ($searchedData['htl_dtl']) { + $searchedData['location'] = $searchedData['htl_dtl']['city']; + if (isset($searchedData['htl_dtl']['state_name'])) { + $searchedData['location'] .= ', '.$searchedData['htl_dtl']['state_name']; + } + $searchedData['location'] .= ', '.$searchedData['htl_dtl']['country_name']; } - $searchedData['location'] .= ', '.$searchedData['htl_dtl']['country_name']; } $searchedData['location_category_id'] = $locationCategoryId; From 8d5a26969692d2ab57b75b8c1baaf1a6c66ac6c6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 19 Apr 2024 11:21:25 +0530 Subject: [PATCH 03/35] Fixed: error on checkout if the user choses other lanuage than default language --- classes/order/OrderHistory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index 874171009..1d09988c0 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -449,7 +449,7 @@ class OrderHistoryCore extends ObjectModel ); if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { - $objHotelBranchInformation = new HotelBranchInformation($idHotel, $order->id_lang); + $objHotelBranchInformation = new HotelBranchInformation($idHotel); $fields = array_merge( $objHotelBranchInformation->getFields(), $objHotelBranchInformation->getFieldsLang()[$order->id_lang], From 417d863ea54364afc9fdd17affc824e053af645c Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 11:39:04 +0530 Subject: [PATCH 04/35] Fixed: Invalid customer voucher amount when changing currency --- themes/hotel-reservation-theme/discount.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/hotel-reservation-theme/discount.tpl b/themes/hotel-reservation-theme/discount.tpl index ea4ba715f..b011b1ec2 100644 --- a/themes/hotel-reservation-theme/discount.tpl +++ b/themes/hotel-reservation-theme/discount.tpl @@ -53,7 +53,7 @@ {/if} {if $discountDetail.reduction_amount > 0} {if $discountDetail.reduction_percent > 0} + {/if} - {convertPrice price=$discountDetail.reduction_amount} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) + {displayPrice price=$discountDetail.reduction_amount currency=$discountDetail.reduction_currency} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) {/if} {if $discountDetail.free_shipping} {if $discountDetail.reduction_percent > 0 || $discountDetail.reduction_amount > 0} + {/if} @@ -73,7 +73,7 @@ {if $discountDetail.minimal == 0} {l s='None'} {else} - {convertPrice price=$discountDetail.minimal} ({if $discountDetail.minimum_amount_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) + {displayPrice price=$discountDetail.minimal currency=$discountDetail.reduction_currency} ({if $discountDetail.minimum_amount_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) {/if} From b2e3973e8ae01d5cee4b570819e958c0b719ccf5 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 12:30:44 +0530 Subject: [PATCH 05/35] Fixed: Auto generated advance price rule are visible in room type configuration --- .../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 f4be56fd3..5dbfbd1db 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -794,14 +794,14 @@ class HotelRoomTypeFeaturePricing extends ObjectModel * @param [int] $id_product [id of the product] * @return [array] [returns all feature prices by product] */ - public function getFeaturePricesbyIdProduct($id_product) + public function getFeaturePricesbyIdProduct($id_product, $id_cart = 0, $id_guest = 0, $id_room = 0) { $idLang = Context::getContext()->language->id; return Db::getInstance()->executeS( 'SELECT hrfp.*, hrfpl.`feature_price_name` FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` hrfp LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang` hrfpl ON(hrfp.`id_feature_price` = hrfpl.`id_feature_price` AND hrfpl.`id_lang` = '.(int)$idLang.') - WHERE `id_product` = '.(int)$id_product + WHERE `id_product` = '.(int)$id_product.' AND `id_cart` = '.(int)$id_cart.' AND `id_guest` = '.(int)$id_guest.' AND `id_room` = '.(int)$id_room ); } From 8279b0f64aa2389e6d01347ced03a9d3bfb1f4e2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 19 Apr 2024 16:37:17 +0530 Subject: [PATCH 06/35] Fixed: Creation of to sperate HotelAdvancedPayment for a same room type from two seprates tabs --- controllers/admin/AdminProductsController.php | 6 ++++-- .../hotelreservationsystem/classes/HotelAdvancedPayment.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 811207d39..6988d73bd 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1089,16 +1089,18 @@ class AdminProductsControllerCore extends AdminController } $id_product = Tools::getValue('id_product'); - $id_adv_pmt = Tools::getValue('id_adv_pmt'); if ($id_adv_pmt) { $obj_adv_pmt = new HotelAdvancedPayment($id_adv_pmt); } else { $obj_adv_pmt = new HotelAdvancedPayment(); + if ($id_adv_pmt = $obj_adv_pmt->getIdAdvPaymentByIdProduct($id_product)) { + // To prevent duplication from two separate tabs + $obj_adv_pmt = new HotelAdvancedPayment($id_adv_pmt); + } } $adv_payment_active = Tools::getValue('adv_payment_active'); - $obj_adv_pmt->id_product = $id_product; $obj_adv_pmt->active = $adv_payment_active; diff --git a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php index 1cc539d75..076663010 100644 --- a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php +++ b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php @@ -68,7 +68,7 @@ class HotelAdvancedPayment extends ObjectModel */ public function getIdAdvPaymentByIdProduct($id_product) { - $result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".$id_product); + $result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".(int) $id_product); if ($result) { return $result; From 5bb2378fdaff68feeaa1af65d0dd7727b5198af3 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 10:21:42 +0530 Subject: [PATCH 07/35] Fixed: Getting fatal error on order detail page if entered invalid order ID in URL --- controllers/admin/AdminOrdersController.php | 75 ++++++++++----------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9c6d1fe61..f4165de35 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -482,44 +482,44 @@ class AdminOrdersControllerCore extends AdminController { if ($this->display == 'view') { /** @var Order $order */ - $order = $this->loadObject(); + if (Validate::isLoadedObject($order = $this->loadObject())) { + // hotel link in header + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + $this->toolbar_btn['hotel'] = array( + 'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info', + 'desc' => $this->l('View Hotel'), + 'class' => 'icon-building', + 'target' => true, + ); + } - // hotel link in header - if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { - $this->toolbar_btn['hotel'] = array( - 'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info', - 'desc' => $this->l('View Hotel'), - 'class' => 'icon-building', - 'target' => true, + if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) { + $this->toolbar_btn['file'] = array( + 'short' => $this->l('Invoice'), + 'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id, + 'desc' => $this->l('View invoice'), + 'class' => 'icon-file-text', + 'target' => true, + ); + } + + $this->toolbar_btn['print'] = array( + 'short' => $this->l('Print'), + 'href' => 'javascript:window.print()', + 'desc' => $this->l('Print order'), + 'class' => 'icon-print', ); - } - if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) { - $this->toolbar_btn['file'] = array( - 'short' => $this->l('Invoice'), - 'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id, - 'desc' => $this->l('View invoice'), - 'class' => 'icon-file-text', - 'target' => true, - ); - } - - $this->toolbar_btn['print'] = array( - 'short' => $this->l('Print'), - 'href' => 'javascript:window.print()', - 'desc' => $this->l('Print order'), - 'class' => 'icon-print', - ); - - if (((int) $order->isReturnable()) && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG)) { - $this->toolbar_btn['cancel'] = array( - 'short' => ((float) $order->getTotalPaid()) ? $this->l('Refund') : $this->l('Cancel'), - 'href' => '#refundForm', - 'id' => 'desc-order-standard_refund', - 'desc' => ((float) $order->getTotalPaid()) ? $this->l('Initiate refund') : $this->l('Cancel bookings'), - 'class' => 'icon-exchange', - 'target' => true, - ); + if (((int) $order->isReturnable()) && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG)) { + $this->toolbar_btn['cancel'] = array( + 'short' => ((float) $order->getTotalPaid()) ? $this->l('Refund') : $this->l('Cancel'), + 'href' => '#refundForm', + 'id' => 'desc-order-standard_refund', + 'desc' => ((float) $order->getTotalPaid()) ? $this->l('Initiate refund') : $this->l('Cancel bookings'), + 'class' => 'icon-exchange', + 'target' => true, + ); + } } } @@ -2475,9 +2475,8 @@ class AdminOrdersControllerCore extends AdminController public function renderView() { - $order = new Order(Tools::getValue('id_order')); - if (!Validate::isLoadedObject($order)) { - $this->errors[] = Tools::displayError('The order cannot be found within your database.'); + if (!Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) { + return; } $this->content .= $this->renderKpis(); From 994664c23b67bb90b6f3ecf893676b00e704445d Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 11:58:42 +0530 Subject: [PATCH 08/35] Fixed: Should not allow admin to add rooms if order status is already canceled or refunded. --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..6c4efed72 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -869,7 +869,7 @@
 {l s='Rooms Booking Detail'} {$order_detail_data|@count} - {if !$order->hasBeenDelivered()} + {if !$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')} From 5ce9749d747c939f1a77ae5d4acaf15f2a698b0a Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 13:11:07 +0530 Subject: [PATCH 09/35] Fixed: Validation messages should be present on the same page when invalid text is added in the notes on admin order detail page. --- .../template/controllers/orders/modals/_document_note.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_document_note.tpl b/admin/themes/default/template/controllers/orders/modals/_document_note.tpl index ecb8e98e5..2fbbb25bd 100644 --- a/admin/themes/default/template/controllers/orders/modals/_document_note.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_document_note.tpl @@ -18,7 +18,7 @@ *}