From 07bd2983d6bda70d8696c15c2d4cdf6184ae4f57 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 7 Oct 2024 15:28:09 +0530 Subject: [PATCH 001/143] Added: occupancy in hook 'actionRoomTypeTotalPriceModifier' in functions HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(), HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay() and in the calls. --- classes/Cart.php | 18 +++++++++-- classes/PaymentModule.php | 32 ++++++++++++++----- controllers/admin/AdminOrdersController.php | 19 +++++++++-- controllers/front/ProductController.php | 32 +++++++++++++------ modules/blockcart/blockcart.php | 2 +- .../classes/HotelAdvancedPayment.php | 9 +++++- .../classes/HotelBookingDetail.php | 14 ++++++-- .../classes/HotelRoomTypeFeaturePricing.php | 16 +++++++--- .../AdminHotelRoomsBookingController.php | 11 +++++-- .../classes/WkPaypalCommerceHelper.php | 10 +++++- .../wkhotelfilterblock/wkhotelfilterblock.php | 4 +-- 11 files changed, 132 insertions(+), 35 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index 6fef5ee79..ed44f01b6 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -733,11 +733,18 @@ class CartCore extends ObjectModel $totalPriceByProductTaxExcl = 0; $priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id); foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) { + $occupancy = array( + array( + 'adults' => $cartRoomInfo['adults'], + 'children' => $cartRoomInfo['children'], + 'child_ages' => json_decode($cartRoomInfo['child_ages']) + ) + ); $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $cartRoomInfo['id_product'], $cartRoomInfo['date_from'], $cartRoomInfo['date_to'], - 0, + $occupancy, Group::getCurrent()->id, $cartRoomInfo['id_cart'], $cartRoomInfo['id_guest'], @@ -1782,12 +1789,19 @@ class CartCore extends ObjectModel $totalPriceByProduct = 0; $priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id); foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) { + $occupancy = array( + array( + 'adults' => $cartRoomInfo['adults'], + 'children' => $cartRoomInfo['children'], + 'child_ages' => json_decode($cartRoomInfo['child_ages']) + ) + ); // get the real price of the room type $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $cartRoomInfo['id_product'], $cartRoomInfo['date_from'], $cartRoomInfo['date_to'], - 0, + $occupancy, Group::getCurrent()->id, $cartRoomInfo['id_cart'], $cartRoomInfo['id_guest'], diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index a41e558b0..1e1326d96 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -808,11 +808,18 @@ abstract class PaymentModuleCore extends Module $objBookingDetail->is_back_order = $objCartBookingData->is_back_order; $objBookingDetail->comment = $objCartBookingData->comment; + $occupancy = array( + array( + 'adults' => $objCartBookingData->adults, + 'children' => $objCartBookingData->children, + 'child_ages' => json_decode($objCartBookingData->child_ages) + ) + ); $total_price = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idProduct, $objCartBookingData->date_from, $objCartBookingData->date_to, - 0, + $occupancy, Group::getCurrent()->id, $objCartBookingData->id_cart, $objCartBookingData->id_guest, @@ -1694,6 +1701,7 @@ abstract class PaymentModuleCore extends Module } else { $cart_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); } + if ($cart_bk_data) { $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); @@ -1714,11 +1722,20 @@ abstract class PaymentModuleCore extends Module $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; + $occupancy = array( + array( + 'adults' => $data_v['adults'], + 'children' => $data_v['children'], + 'child_ages' => json_decode($data_v['child_ages']) + ) + ); - - - $roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($type_value['id_product'], $data_v['date_from'], $data_v['date_to']); - + $roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $type_value['id_product'], + $data_v['date_from'], + $data_v['date_to'], + $occupancy + ); $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $roomTypeDateRangePrice['total_price_tax_incl']*$vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; @@ -1739,9 +1756,7 @@ abstract class PaymentModuleCore extends Module $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; - - - // extra demands prices + // extra demands prices $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( $order->id, $type_value['product_id'], @@ -1825,6 +1840,7 @@ abstract class PaymentModuleCore extends Module } $result['cart_htl_data'] = $cart_htl_data; } + return $result; } } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index d2dc4d1fe..57395c897 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4536,11 +4536,19 @@ class AdminOrdersControllerCore extends AdminController $objBookingDetail->children = $objCartBookingData->children; $objBookingDetail->child_ages = $objCartBookingData->child_ages; + $occupancy = array( + array( + 'adults' => $objCartBookingData->adults, + 'children' => $objCartBookingData->children, + 'child_ages' => json_decode($objCartBookingData->child_ages) + ) + ); + $total_price = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idProduct, $objCartBookingData->date_from, $objCartBookingData->date_to, - 0, + $occupancy, Group::getCurrent()->id, $this->context->cart->id, $this->context->cookie->id_guest, @@ -4781,7 +4789,7 @@ class AdminOrdersControllerCore extends AdminController $id_product, $new_date_from, $new_date_to, - 0, + array($occupancy), Group::getCurrent()->id, $cart->id, $cart->id_guest, @@ -7202,6 +7210,13 @@ class AdminOrdersControllerCore extends AdminController // set context currency So that we can get prices in the order currency $objOrder = new Order($objHotelBooking->id_order); $this->context->currency = new Currency($objOrder->id_currency); + $occupancy = array( + array( + 'adults' => $objHotelBooking->adults, + 'children' => $objHotelBooking->children, + 'child_ages' => json_decode($objHotelBooking->child_ages) + ) + ); $newRoomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idNewRoomType, $objHotelBooking->date_from, diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index d9222203d..105d9e5b0 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -419,7 +419,7 @@ class ProductControllerCore extends FrontController ) ); - $occupancy_value = array(); + $occupancy_value = Tools::getValue('occupancy', array()); if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY) { $occupancy_value = 1; } else { @@ -450,10 +450,10 @@ class ProductControllerCore extends FrontController // product price after imposing feature prices... if ($useTax) { $priceProduct = Product::getPriceStatic($this->product->id, true); - $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true); + $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true, 0, 0, 0, 0, 1, 1, $occupancy_value); } else { $priceProduct = Product::getPriceStatic($this->product->id, false); - $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false); + $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false, 0, 0, 0, 0, 1, 1, $occupancy_value); } $productPriceWithoutReduction = $this->product->getPriceWithoutReduct(!$useTax); $feature_price_diff = (float)($productPriceWithoutReduction - $feature_price); @@ -649,7 +649,7 @@ class ProductControllerCore extends FrontController $idProduct, $dateFrom, $dateTo, - 0, + $occupancy, 0, 0, 0, @@ -660,7 +660,8 @@ class ProductControllerCore extends FrontController $roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idProduct, $dateFrom, - $dateTo + $dateTo, + $occupancy ); $featurePrice = 0; @@ -669,7 +670,14 @@ class ProductControllerCore extends FrontController $idProduct, $dateFrom, $dateTo, - true + true, + 0, + 0, + 0, + 0, + 1, + 1, + $occupancy ); $roomTypeDateRangePrice = $roomTypeDateRangePrice['total_price_tax_incl']; $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl']; @@ -679,14 +687,20 @@ class ProductControllerCore extends FrontController $idProduct, $dateFrom, $dateTo, - false + false, + 0, + 0, + 0, + 0, + 1, + 1, + $occupancy ); $roomTypeDateRangePrice = $roomTypeDateRangePrice['total_price_tax_excl']; $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl']; } - $totalPriceWithoutDiscount *= $quantity; - $totalRoomPrice = $roomTypeDateRangePrice * $quantity; + $totalRoomPrice = $roomTypeDateRangePrice; // calculate demand price now $demandsPricePerRoom = 0; $roomTypeDemands = $objHRTDemand->getRoomTypeDemands($idProduct); diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index eb4edfc71..deb0ab0d8 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -241,7 +241,7 @@ class Blockcart extends Module $objProduct->id, $addedProduct['date_from'], $addedProduct['date_to'], - $addedProduct['req_rm'] + $addedProduct['occupancy'] ); if ($priceDisplayMethod == PS_TAX_EXC) { $addedProduct['price'] = Tools::displayPrice($price['total_price_tax_excl']); diff --git a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php index 076663010..b2702b310 100644 --- a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php +++ b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php @@ -105,11 +105,18 @@ class HotelAdvancedPayment extends ObjectModel $objHtlCartBook = new HotelCartBookingData(); if ($roomTypesByIdProduct = $objHtlCartBook->getCartInfoIdCartIdProduct((int) $idCart, (int)$idProduct)) { foreach ($roomTypesByIdProduct as $cartRoomInfo) { + $occupancy = array( + array( + 'adults' => $cartRoomInfo['adults'], + 'children' => $cartRoomInfo['children'], + 'child_ages' => json_decode($cartRoomInfo['child_ages']) + ) + ); $roomTotalPrices = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $cartRoomInfo['id_product'], $cartRoomInfo['date_from'], $cartRoomInfo['date_to'], - 0, + $occupancy, 0, $idCart, $cartRoomInfo['id_guest'], diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 5686dad65..9e830293a 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1699,14 +1699,14 @@ class HotelBookingDetail extends ObjectModel continue; } } - $productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax()); + $productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 1, $bookingParams['occupancy']); if (!empty($price) && ($price['from'] > $productFeaturePrice || $price['to'] < $productFeaturePrice)) { unset($bookingData['rm_data'][$key]); continue; } if (count($value['data']['available'])) { $prod_price = Product::getPriceStatic($value['id_product'], self::useTax()); - $productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 0); + $productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 0, $bookingParams['occupancy']); $cover_image_arr = Product::getCover($value['id_product']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($value['link_rewrite'], $value['id_product'].'-'.$cover_image_arr['id_image'], 'home_default'); @@ -2061,11 +2061,19 @@ class HotelBookingDetail extends ObjectModel $objBookingDetail->children = $objCartBookingData->children; $objBookingDetail->child_ages = $objCartBookingData->child_ages; + $occupancy = array( + array( + 'adults' => $objCartBookingData->adults, + 'children' => $objCartBookingData->children, + 'child_ages' => json_decode($objCartBookingData->child_ages) + ) + ); + $totalRoomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idNewRoomType, $objCartBookingData->date_from, $objCartBookingData->date_to, - 0, + $occupancy, Group::getCurrent()->id, $this->context->cart->id, $this->context->cookie->id_guest, diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index fd1ef9d93..4e6267382 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -638,7 +638,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $id_product, $date_from, $date_to, - $quantity = 0, + $occupancy = null, $id_group = 0, $id_cart = 0, $id_guest = 0, @@ -659,6 +659,12 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $taxRate = 0; } + if (is_array($occupancy) && count($occupancy)) { + $quantity = count($occupancy); + } else { + $quantity = 1; + } + // Initializations if (!$id_group) { $id_group = (int)Group::getCurrent()->id; @@ -728,7 +734,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel 'id_guest' => $id_guest, 'id_group' => $id_group, 'use_reduc' => $use_reduc, - 'tax_rate' => $taxRate + 'tax_rate' => $taxRate, + 'occupancy' => $occupancy ) ); if ($with_auto_room_services) { @@ -807,7 +814,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $id_guest = 0, $id_room = 0, $with_auto_room_services = 1, - $use_reduc = 1 + $use_reduc = 1, + $occupancy = array() ) { $dateFrom = date('Y-m-d H:i:s', strtotime($date_from)); $dateTo = date('Y-m-d H:i:s', strtotime($date_to)); @@ -815,7 +823,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $id_product, $dateFrom, $dateTo, - 0, + $occupancy, $id_group, $id_cart, $id_guest, diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index 04d0dc8a6..b13a3037b 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -198,7 +198,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $this->errors[] = $this->l('Selected room is not available for reallocation.'); } elseif (!in_array($idRoomToReallocate, array_column($availableRooms, 'id_room'))) { $this->errors[] = $this->l('Selected room is not available for reallocation.'); - } elseif (!Validate::isFloat($priceDiff)) { + } elseif (!Validate::isPrice($priceDiff)) { $this->errors[] = $this->l('Invalid price difference of the room types.'); } } else { @@ -874,11 +874,18 @@ class AdminHotelRoomsBookingController extends ModuleAdminController // if room is changing in the reallocation if ($objHotelBooking->id_product != $idNewRoomType) { $result['has_room_type_change'] = 1; + $occupancy = array( + array( + 'adults' => $objHotelBooking->adults, + 'children' => $objHotelBooking->children, + 'child_ages' => json_decode($objHotelBooking->child_ages) + ) + ); $newRoomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idNewRoomType, $objHotelBooking->date_from, $objHotelBooking->date_to, - 0, + $occupancy, 0, 0, 0, diff --git a/modules/qlopaypalcommerce/classes/WkPaypalCommerceHelper.php b/modules/qlopaypalcommerce/classes/WkPaypalCommerceHelper.php index 46e32a741..389bd3107 100644 --- a/modules/qlopaypalcommerce/classes/WkPaypalCommerceHelper.php +++ b/modules/qlopaypalcommerce/classes/WkPaypalCommerceHelper.php @@ -351,10 +351,18 @@ class WkPaypalCommerceHelper $idProduct )) { foreach ($roomTypeBookings as $cartRoomInfo) { + $occupancy = array( + array( + 'adults' => $cartRoomInfo['adults'], + 'children' => $cartRoomInfo['children'], + 'child_ages' => json_decode($cartRoomInfo['child_ages']) + ) + ); $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( $idProduct, $cartRoomInfo['date_from'], - $cartRoomInfo['date_to'] + $cartRoomInfo['date_to'], + $occupancy ); $roomTotalPriceTE = $roomTotalPrice['total_price_tax_excl']; $roomTotalPriceTI = $roomTotalPrice['total_price_tax_incl']; diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php index c4208f16b..98dab011d 100644 --- a/modules/wkhotelfilterblock/wkhotelfilterblock.php +++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php @@ -195,16 +195,16 @@ class wkhotelfilterblock extends Module $obj_rm_type = new HotelRoomType(); $room_types = $obj_rm_type->getIdProductByHotelId($id_hotel, 0, 1, 1); + $occupancy = Tools::getValue('occupancy'); $prod_price = array(); if ($room_types) { foreach ($room_types as $key => $value) { - $prod_price[] = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, HotelBookingDetail::useTax()); + $prod_price[] = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, HotelBookingDetail::useTax(), 0, 0, 0, 0, 1, 1, $occupancy); } } // Create URL of category - $occupancy = Tools::getValue('occupancy'); $urlData = array ( 'date_from' => $date_from, 'date_to' => $date_to, From f861e10115160c768c6bc65bd71adfac9e12970a Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 8 Nov 2024 14:50:41 +0530 Subject: [PATCH 002/143] show correct pricing on checkout page --- controllers/admin/AdminOrdersController.php | 2 +- .../classes/HotelCartBookingData.php | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 80a65ee7d..5eb4c8496 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4826,7 +4826,7 @@ class AdminOrdersControllerCore extends AdminController $id_product, $new_date_from, $new_date_to, - array($occupancy), + 0, Group::getCurrent()->id, $cart->id, $cart->id_guest, diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 0cd9c678d..3038bb9b3 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1557,7 +1557,13 @@ class HotelCartBookingData extends ObjectModel 1 ); $totalAdditionalServicePrice = $demandPrice + $serviceProductPrice; - + $occupancy = array( + array( + 'adults' => $data_v['adults'], + 'children' => $data_v['children'], + 'child_ages' => json_decode($data_v['child_ages']) + ) + ); if (isset($cartHotelData[$prodKey]['date_diff'][$dateJoin])) { $numDays = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] += $totalAdditionalServicePrice; @@ -1573,7 +1579,7 @@ class HotelCartBookingData extends ObjectModel $product['id_product'], $data_v['date_from'], $data_v['date_to'], - 0, + $occupancy, 0, $context->cart->id, $context->cart->id_guest, @@ -1583,7 +1589,7 @@ class HotelCartBookingData extends ObjectModel $product['id_product'], $data_v['date_from'], $data_v['date_to'], - 0, + $occupancy, 0, $context->cart->id, $context->cart->id_guest, @@ -1594,7 +1600,7 @@ class HotelCartBookingData extends ObjectModel $product['id_product'], $data_v['date_from'], $data_v['date_to'], - 0, + $occupancy, 0, $context->cart->id, $context->cart->id_guest, @@ -1635,7 +1641,7 @@ class HotelCartBookingData extends ObjectModel $product['id_product'], $data_v['date_from'], $data_v['date_to'], - 0, + $occupancy, 0, $context->cart->id, $context->cart->id_guest, @@ -1645,7 +1651,7 @@ class HotelCartBookingData extends ObjectModel $product['id_product'], $data_v['date_from'], $data_v['date_to'], - 0, + $occupancy, 0, $context->cart->id, $context->cart->id_guest, @@ -1656,7 +1662,7 @@ class HotelCartBookingData extends ObjectModel $product['id_product'], $data_v['date_from'], $data_v['date_to'], - 0, + $occupancy, 0, $context->cart->id, $context->cart->id_guest, From cd18dd90af15b29e8d9a055f2c9cdc557597d993 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 11 Nov 2024 13:09:58 +0530 Subject: [PATCH 003/143] Fixed incorrect price in admin book now page --- .../classes/HotelCartBookingData.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 3038bb9b3..3ee7aad41 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1114,7 +1114,13 @@ class HotelCartBookingData extends ObjectModel $cart_detail_data[$key]['date_to'] = $value['date_to']; $cart_detail_data[$key]['child_ages'] = json_decode($value['child_ages']); - + $occupancy = array( + array( + 'adults' => $value['adults'], + 'children' => $value['children'], + 'child_ages' => json_decode($value['child_ages']) + ) + ); $unit_price = Product::getPriceStatic($value['id_product'], true); $unit_price_tax_excl = Product::getPriceStatic($value['id_product'], false); $productPriceWithoutReduction = $productObj->getPriceWithoutReduct(false); @@ -1127,7 +1133,9 @@ class HotelCartBookingData extends ObjectModel $id_cart, $value['id_guest'], $value['id_room'], - 0 + 0, + 1, + $occupancy ); $feature_price_tax_excl = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( $value['id_product'], @@ -1138,7 +1146,9 @@ class HotelCartBookingData extends ObjectModel $id_cart, $value['id_guest'], $value['id_room'], - 0 + 0, + 1, + $occupancy ); $feature_price_diff = (float)($productPriceWithoutReduction - $feature_price); $cart_detail_data[$key]['product_price'] = $unit_price; @@ -1240,7 +1250,7 @@ class HotelCartBookingData extends ObjectModel $value['id_product'], $value['date_from'], $value['date_to'], - 0, + $occupancy, 0, $id_cart, $value['id_guest'], From 5f64bc6a96407db27be7f3f751d844cad0aabbb7 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 15 Nov 2024 16:25:33 +0530 Subject: [PATCH 004/143] added feature to update ajax data using hook --- classes/controller/Controller.php | 4 ++-- controllers/admin/AdminOrdersController.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/controller/Controller.php b/classes/controller/Controller.php index e9628c6a8..8908d6159 100644 --- a/classes/controller/Controller.php +++ b/classes/controller/Controller.php @@ -649,8 +649,8 @@ abstract class ControllerCore $method = $bt[1]['function']; } - Hook::exec('actionBeforeAjaxDie', array('controller' => $controller, 'method' => $method, 'value' => $value)); - Hook::exec('actionBeforeAjaxDie'.$controller.$method, array('value' => $value)); + Hook::exec('actionBeforeAjaxDie', array('controller' => $controller, 'method' => $method, 'value' => &$value)); + Hook::exec('actionBeforeAjaxDie'.$controller.$method, array('value' => &$value)); die($value); } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 5eb4c8496..feca42832 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3501,7 +3501,7 @@ class AdminOrdersControllerCore extends AdminController } } } - $this->content = json_encode($to_return); + $this->ajaxDie(json_encode($to_return)); } // public function ajaxProcessSearchProducts() From 4d739bf63dc27a054e7e5378bbb958f8628c2878 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 13 Dec 2024 15:26:05 +0530 Subject: [PATCH 005/143] fixed price issue when booking is donewithout occupancy --- .../classes/HotelRoomTypeFeaturePricing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 4e6267382..97b60fcc5 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -662,7 +662,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel if (is_array($occupancy) && count($occupancy)) { $quantity = count($occupancy); } else { - $quantity = 1; + $quantity = $occupancy; } // Initializations From d702733134dcb231dc97dc229efbe8224780d814 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 20 Jan 2025 13:23:41 +0530 Subject: [PATCH 006/143] Fixed: The same feature price is applied to same room for different dates --- .../classes/HotelCartBookingData.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 0cd9c678d..5585364d8 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1359,10 +1359,11 @@ class HotelCartBookingData extends ObjectModel $id_room = 0 ) { if ($id_cart && $id_room) { - if ($featurePrice = Db::getInstance()->getRow( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp + if ($featurePrice = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp WHERE fp.`id_product` = '.(int) $id_product.' AND fp.`id_cart` = '.(int) $id_cart.' - AND fp.`id_guest` = '.(int) $id_guest.' AND fp.`id_room` = '.(int) $id_room.' AND fp.`active` = 1') + AND fp.`id_guest` = '.(int) $id_guest.' AND fp.`id_room` = '.(int) $id_room.' + AND fp.`active` = 1 AND fp.`date_from` <= \''.pSQL($date).'\' + AND fp.`date_to` > \''.pSQL($date).'\'') ) { return $featurePrice; } From f12690c8d671f0b2c1f1deba9f1b35e90722dafc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 20 Jan 2025 13:24:52 +0530 Subject: [PATCH 007/143] Updated: the date to is now exclusive while calulating feature price of a room in a date range --- .../hotelreservationsystem/classes/HotelCartBookingData.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 5585364d8..db97413d9 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1391,7 +1391,7 @@ class HotelCartBookingData extends ObjectModel ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.')' : '').' WHERE fp.`id_cart` = 0 AND fp.`id_product`='.(int) $id_product.' AND fp.`is_special_days_exists`=1 AND fp.`active`=1 AND fp.`date_from` <= \''.pSQL($date).'\' - AND fp.`date_to` >= \''.pSQL($date).'\'' + AND fp.`date_to` > \''.pSQL($date).'\'' )) { foreach ($featurePrice as $fRow) { $specialDays = json_decode($fRow['special_days']); @@ -1407,7 +1407,7 @@ class HotelCartBookingData extends ObjectModel ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.')' : '').' WHERE fp.`id_cart` = 0 AND fp.`id_product`='.(int) $id_product.' AND fp.`date_selection_type` = '.(int) HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE.' AND `is_special_days_exists`=0 AND `active`=1 - AND fp.`date_from` <= \''.pSQL($date).'\' AND fp.`date_to` >= \''.pSQL($date).'\'' + AND fp.`date_from` <= \''.pSQL($date).'\' AND fp.`date_to` > \''.pSQL($date).'\'' )) { return $featurePrice; } From 67daa65ace1ba8feb3f7788115835e0a5b9158fb Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 21 Jan 2025 17:07:05 +0530 Subject: [PATCH 008/143] Added: feature to create Advanced price rules for multiple room types at once --- .../admin/AdminHotelFeaturePricesSettings.php | 230 +++++++++++++++++- .../helpers/form/form.tpl | 62 +++-- 2 files changed, 261 insertions(+), 31 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index 0652f90c7..e05c8b43f 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -189,8 +189,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController )) { - $this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this - plan. Please select a different date range.'); + $this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this plan. Please select a different date range.'); return ; } } @@ -202,17 +201,52 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController public function initToolbar() { parent::initToolbar(); - $this->page_header_toolbar_btn['new'] = array( - 'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token, - 'desc' => $this->l('Add new rule'), - 'imgclass' => 'new' - ); + if (empty($this->display) || $this->display == 'list') { + $this->page_header_toolbar_btn['bulk_add'] = array( + 'href' => self::$currentIndex.'&add'.$this->table.'&bulkAdd'.$this->table.'=1&token='.$this->token, + 'desc' => $this->l('Bulk create rules'), + 'imgclass' => 'new' + ); + $this->page_header_toolbar_btn['new'] = array( + 'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token, + 'desc' => $this->l('Add new rule'), + 'imgclass' => 'new' + ); + } + $this->toolbar_btn = array(); + } + + public function initToolbarTitle() + { + parent::initToolbarTitle(); + if (Tools::getValue('bulkAdd'.$this->table)) { + $this->toolbar_title[] = $this->l('Bulk Create', null, null, false); + $this->addMetaTitle($this->l('Bulk Create', null, null, false)); + } + } + + public function initProcess() + { + parent::initProcess(); + if (Tools::getValue('bulkAdd'.$this->table)) { + self::$currentIndex = self::$currentIndex.'&bulkAdd'.$this->table.'=1'; + } + + if (Tools::isSubmit('submitBulkAdd'.$this->table)) { + if ($this->tabAccess['add'] === '1') { + $this->action = 'bulkSave'; + $this->display = 'list'; + } else { + $this->errors[] = Tools::displayError('You do not have permission to add this.'); + } + } } public function renderList() { $this->addRowAction('edit'); $this->addRowAction('delete'); + return parent::renderList(); } @@ -246,10 +280,28 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $smartyVars['feature_price_groups'] = $objFeaturePrice->getGroups($idFeaturePrice); } + $smartyVars['defaultcurrency_sign'] = $currencySign; $smartyVars['date_from'] = $dateFrom; $smartyVars['date_to'] = $dateTo; $smartyVars['groups'] = Group::getGroups($this->context->language->id); + $smartyVars['bulk_add'] = Tools::getValue('bulkAdd'.$this->table); + + if ($smartyVars['bulk_add']) { + $tree = new HelperTree('hotels-tree'); + $tree->setData(HotelHelper::generateTreeData([ + 'rootNode' => HotelHelper::NODE_HOTEL, + 'leafNode' => HotelHelper::NODE_ROOM_TYPE, + 'selectedElements' => array( + 'room_type' => Tools::getValue('room_type_box', array()) + ) + ])) + ->setUseCheckBox(true) + ->setAutoSelectChildren(true) + ->setUseBulkActions(true) + ->setUseSearch(true); + $smartyVars['hotel_tree'] = $tree->render(); + } $this->context->smarty->assign($smartyVars); $this->fields_form = array( 'submit' => array( @@ -374,8 +426,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController ); } if ($isPlanTypeExists) { - $this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this - plan. Please select a different date range.'); + $this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this plan. Please select a different date range.'); } else { if (!$roomTypeId) { $this->errors[] = $this->l('Room is not selected. Please try again.'); @@ -497,6 +548,167 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } } + public function processBulkSave() + { + $enableFeaturePrice = Tools::getValue('enable_feature_price'); + $roomTypeIds = Tools::getValue('room_type_box'); + $dateFrom = Tools::getValue('date_from'); + $dateTo = Tools::getValue('date_to'); + $isSpecialDaysExists = Tools::getValue('is_special_days_exists'); + $specialDays = Tools::getValue('special_days'); + $priceImpactWay = Tools::getValue('price_impact_way'); + $priceImpactType = Tools::getValue('price_impact_type'); + $impactValue = Tools::getValue('impact_value'); + $dateSelectionType = Tools::getValue('date_selection_type'); + $specificDate = date('Y-m-d', strtotime(Tools::getValue('specific_date'))); + $groups = Tools::getValue('groupBox'); + $jsonSpecialDays = json_encode($specialDays); + $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); + + $objFeaturePricing = new HotelRoomTypeFeaturePricing(); + + if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) { + $priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE; + } + + $languages = Language::getLanguages(false); + $objDefaultLang = new language($defaultLangId); + $featurePricingName = array(); + + if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) { + $dateFrom = $specificDate; + $dateTo = date('Y-m-d', strtotime("+1 day", strtotime($specificDate))); + } + $isPlanTypeExists = 0; + + if (empty($roomTypeIds)) { + $this->errors[] = $this->l('Please select at least one room type for bulk creation.'); + } else { + if ($isSpecialDaysExists && $jsonSpecialDays == 'false') { + $this->errors[] = $this->l('Please select at least one day for week days restriction.'); + } else { + foreach ($roomTypeIds as $roomTypeId) { + $isPlanTypeExists = $this->validateExistingFeaturePrice( + $dateSelectionType, + $roomTypeId, + $dateFrom, + $dateTo, + $groups, + 0, + $isSpecialDaysExists, + $jsonSpecialDays + ); + + if ($isPlanTypeExists) { + $objProduct = new Product((int) $roomTypeId, false, $this->context->language->id); + $this->errors[] = sprintf($this->l('An advanced price rule already exists for "%s" for the selected date range. Please select a different date range.'), $objProduct->name); + } + } + } + + if (!Tools::getValue('feature_price_name_'.$defaultLangId)) { + $this->errors[] = sprintf( + $this->l('Advanced price rule name is required at least in %s'), + $objDefaultLang->name + ); + } + + $validateRules = call_user_func( + array('HotelRoomTypeFeaturePricing', 'getValidationRules'), + 'HotelRoomTypeFeaturePricing' + ); + foreach ($languages as $language) { + if (!Validate::isCatalogName(Tools::getValue('feature_price_name_'.$language['id_lang']))) { + $this->errors[] = $this->l('Advanced price rule name is invalid in ').$language['name']; + } elseif (Tools::strlen(Tools::getValue('feature_price_name_'.$language['id_lang'])) > $validateRules['sizeLang']['feature_price_name']) { + sprintf( + $this->l('Advanced price rule Name field is too long (%2$d chars max).'), + $validateRules['sizeLang']['feature_price_name'] + ); + } + + if (Tools::getValue('feature_price_name_'.$language['id_lang'])) { + $featurePricingName[$language['id_lang']] = Tools::getValue('feature_price_name_'.$language['id_lang']); + } else { + $featurePricingName[$language['id_lang']] = Tools::getValue('feature_price_name_'.$defaultLangId); + } + } + + if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) { + if ($dateFrom == '') { + $this->errors[] = $this->l('Please choose Date from for the advanced price rule.'); + } + if ($dateTo == '') { + $this->errors[] = $this->l('Please choose Date to for the advanced price rule.'); + } + $dateFrom = date('Y-m-d', strtotime($dateFrom)); + $dateTo = date('Y-m-d', strtotime($dateTo)); + if (!Validate::isDate($dateFrom)) { + $this->errors[] = $this->l('Invalid Date From.'); + } + if (!Validate::isDate($dateTo)) { + $this->errors[] = $this->l('Invalid Date To.'); + } + if ($dateTo < $dateFrom) { + $this->errors[] = $this->l('Date To must be a date after Date From.'); + } + if ($isSpecialDaysExists) { + if (!isset($specialDays) || !$specialDays) { + $this->errors[] = $this->l('Please select at least one day for week days restriction.'); + } + } + } else { + if ($specificDate == '') { + $this->errors[] = $this->l('Please choose Date from for the advanced price rule.'); + } + $specificDate = date('Y-m-d', strtotime($specificDate)); + if (!Validate::isDate($specificDate)) { + $this->errors[] = $this->l('Invalid Date From.'); + } + } + + if (!$impactValue) { + $this->errors[] = $this->l('Please enter a valid impact value.'); + } else { + if (!Validate::isPrice($impactValue)) { + $this->errors[] = $this->l('Invalid value of impact value.'); + } + } + + if (!(bool)$groups) { + $this->errors[] = $this->l('Please select at least one group for the group access'); + } + + if (empty($this->errors)) { + $res = true; + foreach ($roomTypeIds as $roomTypeId) { + $objFeaturePricing = new HotelRoomTypeFeaturePricing(); + $objFeaturePricing->id_product = $roomTypeId; + $objFeaturePricing->feature_price_name = $featurePricingName; + $objFeaturePricing->date_selection_type = $dateSelectionType; + $objFeaturePricing->date_from = $dateFrom; + $objFeaturePricing->date_to = $dateTo; + $objFeaturePricing->impact_way = $priceImpactWay; + $objFeaturePricing->is_special_days_exists = $isSpecialDaysExists; + $objFeaturePricing->special_days = $jsonSpecialDays; + $objFeaturePricing->impact_type = $priceImpactType; + $objFeaturePricing->impact_value = $impactValue; + $objFeaturePricing->active = $enableFeaturePrice; + + // set the values of the groups for this feature price + $objFeaturePricing->groupBox = $groups; + $res &= $objFeaturePricing->save(); + } + + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + } + } + + if (!empty($this->errors)) { + $this->display = 'add'; + } + } + public function ajaxProcessSearchProductByName() { $productName = Tools::getValue('room_type_name'); diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index d1191997d..e40b26f10 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -19,7 +19,9 @@
- {if isset($edit)} + {if isset($bulk_add) && $bulk_add} +  {l s='Bulk Create Advanced Price Rule' mod='hotelreservationsystem'} + {else if isset($edit)}  {l s='Edit Advanced Price Rule' mod='hotelreservationsystem'} {else}  {l s='Add New Advanced Price Rule' mod='hotelreservationsystem'} @@ -57,23 +59,33 @@ {/if}
-
- -
- - - - -
- {l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'} + {if isset($bulk_add) && $bulk_add} +
+ +
+ {$hotel_tree}
- -
+ {else} +
+ +
+ + + + +
+ {l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'} +
+
+
+ {/if}
From c22186b8db2e1f1f61373d0dea2bbb1ae3bb9824 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 22 Jan 2025 16:11:53 +0530 Subject: [PATCH 009/143] Added: New restrictions to the admin while updating the booking from the back office --- .../controllers/orders/modals/_edit_room_tab_content.tpl | 4 ++-- controllers/admin/AdminOrdersController.php | 4 ++++ modules/hotelreservationsystem/classes/HotelBookingDetail.php | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index 1bb98114b..70129171d 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -37,7 +37,7 @@ {if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded} {dateFormat date=$data.date_from} {else} - +
{/if}
@@ -49,7 +49,7 @@ {if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded} {dateFormat date=$data.date_to} {else} - +
{/if}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 6dfcdaced..6d8d22f65 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -7172,6 +7172,10 @@ class AdminOrdersControllerCore extends AdminController || (strtotime($statusDate) > strtotime($dateTo)) ) { $this->errors[] = Tools::displayError('Date should be between booking from date and to date.'); + } else if (date('Y-m-d', strtotime($objHotelBookingDetail->check_out)) != date('Y-m-d', strtotime($objHotelBookingDetail->date_to)) + && ($booked = $objHotelBookingDetail->chechRoomBooked($objHotelBookingDetail->id_room, $objHotelBookingDetail->check_out, $objHotelBookingDetail->date_to)) + ) { + $this->errors[] = Tools::displayError('You cannot update this room\'s booking status as a new booking has been created for this room. Please change the room to update the status.'); } } if ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT) { diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 5686dad65..dfecd3d73 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1427,6 +1427,10 @@ class HotelBookingDetail extends ObjectModel pSQL($date_to).'\' AND date_to >= \''.pSQL($date_to).'\') OR (date_from < \''.pSQL($date_from). '\' AND date_to > \''.pSQL($date_to).'\'))'; + if ($this->id) { + $sql .= ' AND `id` !='.(int) $this->id; + } + return Db::getInstance()->getRow($sql); } From b2f13339acec1019a079640b65c193e2356625c4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 23 Jan 2025 11:17:07 +0530 Subject: [PATCH 010/143] Updated: Changed the max order date with maximum booking offset --- controllers/admin/AdminImportController.php | 24 ++--- .../admin/AdminOrderPreferencesController.php | 40 ++++--- controllers/front/CategoryController.php | 8 +- controllers/front/ProductController.php | 10 +- docs/csv_import/hotels_import.csv | 2 +- .../classes/HotelBranchInformation.php | 77 +++++++------ .../classes/HotelCartBookingData.php | 6 +- .../classes/HotelHelper.php | 12 +-- .../classes/HotelOrderRestrictDate.php | 51 ++++++--- .../classes/HotelReservationSystemDb.php | 8 +- .../admin/AdminAddHotelController.php | 101 +++++++++--------- .../hotelreservationsystem.php | 9 -- .../views/css/HotelReservationAdmin.css | 6 -- .../views/js/HotelReservationAdmin.js | 35 ++---- .../admin/add_hotel/helpers/form/form.tpl | 34 +++--- .../classes/WkRoomSearchHelper.php | 12 +-- .../controllers/front/autocompletesearch.php | 4 +- .../views/js/wk-room-search-block.js | 20 ++-- .../views/templates/front/hotel-options.tpl | 2 +- .../views/templates/hook/searchForm.tpl | 6 +- themes/hotel-reservation-theme/js/product.js | 8 +- themes/hotel-reservation-theme/product.tpl | 2 +- 22 files changed, 231 insertions(+), 246 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 761b3459a..2ff4032ea 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -148,8 +148,8 @@ class AdminImportControllerCore extends AdminController 'policies' => array('label' => $this->l('Hotel Policies')), 'active_refund' => array('label' => $this->l('Allow Refund (0 = No, 1 = Yes)')), 'refund_ids' => array('label' => $this->l('Refund IDs (x,y,z...)')), - 'max_order_date' => array('label' => $this->l('Max Order Date')), - 'preparation_time' => array('label' => $this->l('Prepration Time')), + 'max_booking_offset' => array('label' => $this->l('Max booking offset')), + 'min_booking_offset' => array('label' => $this->l('Min booking offset')), 'image' => array('label' => $this->l('Image URLs (x,y,z...)')), 'delete_existing_images' => array( 'label' => $this->l('Delete existing images (0 = No, 1 = Yes)') @@ -1410,19 +1410,19 @@ class AdminImportControllerCore extends AdminController } $objHotelOrderRestrictDate->id_hotel = $objHotelBranch->id; - $objHotelOrderRestrictDate->use_global_max_order_date = true; - if (isset($info['max_order_date']) - && strtotime('now') < strtotime($info['max_order_date']) + $objHotelOrderRestrictDate->use_global_max_booking_offset = true; + if (isset($info['max_booking_offset']) + && strtotime('now') < strtotime($info['max_booking_offset']) ) { - $objHotelOrderRestrictDate->use_global_max_order_date = false; - $date = date('Y-m-d', strtotime($info['max_order_date'])); - $objHotelOrderRestrictDate->max_order_date = $date; + $objHotelOrderRestrictDate->use_global_max_booking_offset = false; + $date = date('Y-m-d', strtotime($info['max_booking_offset'])); + $objHotelOrderRestrictDate->max_booking_offset = $date; } - $objHotelOrderRestrictDate->use_global_preparation_time = true; - if (isset($info['preparation_time']) && $info['preparation_time']) { - $objHotelOrderRestrictDate->use_global_preparation_time = false; - $objHotelOrderRestrictDate->preparation_time = $info['preparation_time']; + $objHotelOrderRestrictDate->use_global_min_booking_offset = true; + if (isset($info['min_booking_offset']) && $info['min_booking_offset']) { + $objHotelOrderRestrictDate->use_global_min_booking_offset = false; + $objHotelOrderRestrictDate->min_booking_offset = $info['min_booking_offset']; } $objHotelOrderRestrictDate->save(); diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 241ed1c29..23c9e2996 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -82,22 +82,19 @@ class AdminOrderPreferencesControllerCore extends AdminController ) ); - $maxOrderDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE', Configuration::get('MAX_GLOBAL_BOOKING_DATE')); $this->fields_options = array( 'order_restrict' => array( 'title' => $this->l('Order Restrict'), 'icon' => 'icon-cogs', 'fields' => array( - 'MAX_GLOBAL_BOOKING_DATE' => array( - 'title' => $this->l('Maximum Global Check-out Date to book a room'), - 'hint' => $this->l('Maximum date of check-out for which rooms of your hotels can be booked.'), + 'GLOBAL_MAX_BOOKING_OFFSET' => array( + 'title' => $this->l('Maximum booking offset'), + 'hint' => $this->l('The maximum booking offset defines the number of days from today till which bookings can be made. It is used to limiting how far in advance reservations are allowed to the guest.'), 'type' => 'text', - 'id' => 'max_global_book_date', - 'auto_value' => false, - 'value' => date('d-m-Y', strtotime($maxOrderDate)), - 'class' => 'fixed-width-xxl readonly', + 'class' => 'fixed-width-xl', + 'suffix' => $this->l('day(s)'), ), - 'GLOBAL_PREPARATION_TIME' => array( + 'GLOBAL_MIN_BOOKING_OFFSET' => array( 'title' => $this->l('Minimum booking offset'), 'hint' => $this->l('The minimum booking offset is the minimum number of days before the check-in date that a guest must book a room. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'), 'desc' => $this->l('Set to 0 to disable this feature.'), @@ -332,24 +329,23 @@ class AdminOrderPreferencesControllerCore extends AdminController $this->errors[] = Tools::displayError('Please assign a valid CMS page for Terms and Conditions.'); } - $_POST['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Tools::getValue('MAX_GLOBAL_BOOKING_DATE'))); - $maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE'); - $globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME'); - $maxGlobalBookingDateFormatted = date('Y-m-d', strtotime($maxGlobalBookingDate)); - - if ($maxGlobalBookingDate == '') { - $this->errors[] = Tools::displayError('Field \'Maximum Global Check-out Date to book a room\' can not be empty.'); - } elseif (!Validate::isDate($maxGlobalBookingDateFormatted)) { - $this->errors[] = Tools::displayError('Field \'Maximum Global Check-out Date to book a room\' is invalid.'); - } elseif (strtotime($maxGlobalBookingDateFormatted) < strtotime(date('Y-m-d'))) { - $this->errors[] = Tools::displayError('Field \'Maximum Global Check-out Date to book a room\' can not be a past date. Please use a future date.'); + $maxBookingOffset = Tools::getValue('GLOBAL_MAX_BOOKING_OFFSET'); + $minBookingOffset = Tools::getValue('GLOBAL_MIN_BOOKING_OFFSET'); + if ($maxBookingOffset === '') { + $this->errors[] = Tools::displayError('Field \'Maximum booking offset\' can not be empty.'); + } elseif (!$maxBookingOffset || !Validate::isUnsignedInt($maxBookingOffset)) { + $this->errors[] = Tools::displayError('Field \'Maximum booking offset\' is invalid.'); } - if ($globalPreparationTime === '') { + if ($minBookingOffset === '') { $this->errors[] = Tools::displayError('Field \'Minimum booking offset\' can not be empty.'); - } elseif ($globalPreparationTime !== '0' && !Validate::isUnsignedInt($globalPreparationTime)) { + } elseif ($minBookingOffset != 0 && !Validate::isUnsignedInt($minBookingOffset)) { $this->errors[] = Tools::displayError('Field \'Minimum booking offset\' is invalid.'); } + + if ($maxBookingOffset && $maxBookingOffset <= $minBookingOffset) { + $this->errors[] = Tools::displayError('Field \'Maximum booking offset\' cannot be be less than or equal to \'Minimum booking offset\'.'); + } } public function setMedia() diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 10d9a0ae0..e35124b33 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -156,11 +156,11 @@ class CategoryControllerCore extends FrontController $currency = new Currency($this->context->currency->id); if ($id_hotel = HotelBranchInformation::getHotelIdByIdCategory($id_category)) { - $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($id_hotel); - if ($preparationTime - && strtotime(date('Y-m-d', strtotime('+'. ($preparationTime) .' days'))) > strtotime($date_from) + $minBookingOffset = (int) HotelOrderRestrictDate::getMinBookingOffset($id_hotel); + if ($minBookingOffset + && strtotime(date('Y-m-d', strtotime('+'. ($minBookingOffset) .' days'))) > strtotime($date_from) ) { - $date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day')); + $date_from = date('Y-m-d', strtotime('+ '.$minBookingOffset.' day')); if (strtotime($date_from) >= strtotime($date_to)) { $date_to = date('Y-m-d', strtotime($date_from) + 86400); } diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 83d3bb857..a5ca5fe85 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -334,15 +334,15 @@ class ProductControllerCore extends FrontController $date_from = Tools::getValue('date_from'); $date_to = Tools::getValue('date_to'); - $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); + $minBookingOffset = (int) HotelOrderRestrictDate::getMinBookingOffset($hotel_id); if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); } - if ($preparationTime - && strtotime(date('Y-m-d', strtotime('+'. ($preparationTime) .' days'))) > strtotime($date_from) + if ($minBookingOffset + && strtotime(date('Y-m-d', strtotime('+'. ($minBookingOffset) .' days'))) > strtotime($date_from) ) { - $date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day')); + $date_from = date('Y-m-d', strtotime('+ '.$minBookingOffset.' day')); } if (!($date_to = Tools::getValue('date_to'))) { @@ -392,7 +392,7 @@ class ProductControllerCore extends FrontController 'room_type_info' => $room_info_by_product_id, 'isHotelRefundable' => $hotel_branch_obj->isRefundable(), 'max_order_date' => $max_order_date, - 'preparation_time' => $preparationTime, + 'min_booking_offset' => $minBookingOffset, 'warning_num' => Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'), 'ratting_img_path' => _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png', 'product_controller_url' => $this->context->link->getPageLink('product'), diff --git a/docs/csv_import/hotels_import.csv b/docs/csv_import/hotels_import.csv index 5225073f8..f3c5962fa 100644 --- a/docs/csv_import/hotels_import.csv +++ b/docs/csv_import/hotels_import.csv @@ -1,3 +1,3 @@ -Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Max Order Date;Prepration Time;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes) +Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Max booking offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes) 2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;2024-01-01;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0 3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0 diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index c2779a01e..d8e24647e 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -71,10 +71,10 @@ class HotelBranchInformation extends ObjectModel public $zipcode; public $address; public $phone; - public $use_global_max_order_date = 1; - public $max_order_date = '0000-00-00'; - public $use_global_preparation_time = 1; - public $preparation_time = '0000-00-00'; + public $use_global_max_booking_offset = 1; + public $max_booking_offset = '1000'; + public $use_global_min_booking_offset = 1; + public $min_booking_offset = '0'; protected $webserviceParameters = array( 'objectsNodeName' => 'hotels', @@ -106,10 +106,10 @@ class HotelBranchInformation extends ObjectModel 'subResourceName' => 'hotels' ) ), - 'use_global_max_order_date' => array(), - 'max_order_date' => array(), - 'use_global_preparation_time' => array(), - 'preparation_time' => array(), + 'use_global_max_booking_offset' => array(), + 'max_booking_offset' => array(), + 'use_global_min_booking_offset' => array(), + 'min_booking_offset' => array(), ), 'associations' => array( 'room_types' => array( @@ -149,10 +149,10 @@ class HotelBranchInformation extends ObjectModel } if ($hotelRestrictions = HotelOrderRestrictDate::getDataByHotelId($id)) { - $this->use_global_max_order_date = $hotelRestrictions['use_global_max_order_date']; - $this->max_order_date = $hotelRestrictions['max_order_date']; - $this->use_global_preparation_time = $hotelRestrictions['use_global_preparation_time']; - $this->preparation_time = $hotelRestrictions['preparation_time']; + $this->use_global_max_booking_offset = $hotelRestrictions['use_global_max_booking_offset']; + $this->max_booking_offset = $hotelRestrictions['max_booking_offset']; + $this->use_global_min_booking_offset = $hotelRestrictions['use_global_min_booking_offset']; + $this->min_booking_offset = $hotelRestrictions['min_booking_offset']; } } } @@ -1072,13 +1072,13 @@ class HotelBranchInformation extends ObjectModel } $objHotelRestrictDate->id_hotel = $this->id; - $objHotelRestrictDate->use_global_max_order_date = $this->use_global_max_order_date; - if (!$this->use_global_max_order_date) { - $objHotelRestrictDate->max_order_date = $this->max_order_date; + $objHotelRestrictDate->use_global_max_booking_offset = $this->use_global_max_booking_offset; + if (!$this->use_global_max_booking_offset) { + $objHotelRestrictDate->max_booking_offset = $this->max_booking_offset; } - $objHotelRestrictDate->use_global_preparation_time = $this->use_global_preparation_time; - if (!$this->use_global_preparation_time) { - $objHotelRestrictDate->preparation_time = $this->preparation_time; + $objHotelRestrictDate->use_global_min_booking_offset = $this->use_global_min_booking_offset; + if (!$this->use_global_min_booking_offset) { + $objHotelRestrictDate->min_booking_offset = $this->min_booking_offset; } return $objHotelRestrictDate->save(); @@ -1111,23 +1111,34 @@ class HotelBranchInformation extends ObjectModel $message = Tools::displayError('City is required field.'); } elseif (!Validate::isCityName($this->city)) { $message = Tools::displayError('Enter a Valid City Name.'); - } elseif (!Validate::isBool($this->use_global_max_order_date)) { - $message = Tools::displayError('invalid value for use_global_max_order_date.'); - } elseif (!Validate::isBool($this->use_global_preparation_time)) { - $message = Tools::displayError('invalid value for use_global_preparation_time.'); - } elseif (!$this->use_global_max_order_date && $this->max_order_date == '') { - $message = Tools::displayError('Maximum date to book a room is required.'); - } elseif (!$this->use_global_max_order_date && !Validate::isDate($this->max_order_date)) { - $message = Tools::displayError('Maximum date to book a room is invalid.'); - } elseif (!$this->use_global_max_order_date - && ($maxOrderDateFormatted = date('Y-m-d', strtotime($this->max_order_date))) - && strtotime($maxOrderDateFormatted) < strtotime(date('Y-m-d')) - ) { - $message = Tools::displayError('Maximum Global Date to book a room can not be a past date. Please use a future date.'); - } elseif (!$this->use_global_preparation_time && $this->preparation_time === '') { + } elseif (!Validate::isBool($this->use_global_max_booking_offset)) { + $message = Tools::displayError('invalid value for use_global_max_booking_offset.'); + } elseif (!Validate::isBool($this->use_global_min_booking_offset)) { + $message = Tools::displayError('invalid value for use_global_min_booking_offset.'); + } elseif (!$this->use_global_max_booking_offset && $this->max_booking_offset == '') { + $message = Tools::displayError('Maximum booking offset is required.'); + } elseif (!$this->use_global_max_booking_offset && (!$this->max_booking_offset || !Validate::isUnsignedInt($this->max_booking_offset))) { + $message = Tools::displayError('Maximum booking offset is invalid.'); + } elseif (!$this->use_global_min_booking_offset && $this->min_booking_offset === '') { $message = Tools::displayError('Minimum booking offset is a required.'); - } elseif (!$this->use_global_preparation_time && $this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) { + } elseif (!$this->use_global_min_booking_offset && !Validate::isUnsignedInt($this->min_booking_offset)) { $message = Tools::displayError('Minimum booking offset is invalid.'); + } else if (!$this->use_global_min_booking_offset + && !$this->use_global_max_booking_offset + && $this->max_booking_offset + && $this->max_booking_offset <= $this->min_booking_offset + ) { + $message = Tools::displayError('Maximum booking cannot be less than or equal to Minimum booking offset.'); + } else if (!$this->use_global_max_booking_offset + && $this->use_global_min_booking_offset + && $this->max_booking_offset <= Configuration::get('GLOBAL_MIN_BOOKING_OFFSET') + ) { + $message = Tools::displayError('Maximum booking cannot be less than or equal to Global Minimum booking offset.'); + } else if ($this->use_global_max_booking_offset + && !$this->use_global_min_booking_offset + && $this->min_booking_offset >= Configuration::get('GLOBAL_MAX_BOOKING_OFFSET') + ) { + $message = Tools::displayError('Minimum booking offset cannot be be greater than or equal to Global Maximum booking offset.'); } elseif (!Validate::isLoadedObject($objCountry = new Country($this->id_country))) { $message = Tools::displayError('country is invalid.'); } elseif ($this->id_state diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 0cd9c678d..7dbe1b494 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1029,9 +1029,9 @@ class HotelCartBookingData extends ObjectModel } } - $preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']); - if ($preparationTime !== false) { - $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days')); + $minBookingOffset = HotelOrderRestrictDate::getMinBookingOffset($roomData['id_hotel']); + if ($minBookingOffset !== false) { + $minOrderDate = date('Y-m-d', strtotime('+'. ($minBookingOffset) .' days')); if (strtotime($minOrderDate) > strtotime($roomData['date_from']) || strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to']) ) { diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 137697e46..e0d5ef41c 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -1063,12 +1063,8 @@ class HotelHelper Configuration::updateValue('WK_GLOBAL_CHILD_MAX_AGE', 15); Configuration::updateValue('WK_GLOBAL_MAX_CHILD_IN_ROOM', 0); - Configuration::updateValue( - 'MAX_GLOBAL_BOOKING_DATE', - date('Y-m-d', strtotime(date('Y-m-d', time()).' + 1 year')) - ); - - Configuration::updateValue('GLOBAL_PREPARATION_TIME', 0); + Configuration::updateValue('GLOBAL_MAX_BOOKING_OFFSET', 1000); + Configuration::updateValue('GLOBAL_MIN_BOOKING_OFFSET', 0); Configuration::updateValue('HTL_FEATURE_PRICING_PRIORITY', 'specific_date;special_day;date_range'); Configuration::updateValue('WK_GOOGLE_ACTIVE_MAP', 0); @@ -2502,8 +2498,8 @@ class HotelHelper public static function validateDateRangeForHotel($dateFrom, $dateTo, $idHotel) { $validStartDateTimeStamp = strtotime(date('Y-m-d')); - if ($preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($idHotel)) { - $validStartDateTimeStamp = strtotime(date('Y-m-d', strtotime('+ '.$preparationTime.' day'))); + if ($minBookingOffset = (int) HotelOrderRestrictDate::getMinBookingOffset($idHotel)) { + $validStartDateTimeStamp = strtotime(date('Y-m-d', strtotime('+ '.$minBookingOffset.' day'))); } $dateFromTimestamp = strtotime($dateFrom); diff --git a/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php b/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php index d623d8bf6..89dc9cb4a 100644 --- a/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php +++ b/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php @@ -22,10 +22,10 @@ class HotelOrderRestrictDate extends ObjectModel { public $id; public $id_hotel; - public $use_global_max_order_date; - public $max_order_date; - public $use_global_preparation_time; - public $preparation_time; + public $use_global_max_booking_offset; + public $max_booking_offset; + public $use_global_min_booking_offset; + public $min_booking_offset; public $date_add; public $date_upd; @@ -34,10 +34,10 @@ class HotelOrderRestrictDate extends ObjectModel 'primary' => 'id', 'fields' => array( 'id_hotel' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), - 'use_global_max_order_date' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), - 'max_order_date' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), - 'use_global_preparation_time' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), - 'preparation_time' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'use_global_max_booking_offset' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'max_booking_offset' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'use_global_min_booking_offset' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'min_booking_offset' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ), @@ -54,12 +54,12 @@ class HotelOrderRestrictDate extends ObjectModel public static function getMaxOrderDate($idHotel) { $result = self::getDataByHotelId($idHotel); - if (is_array($result) && count($result) && !$result['use_global_max_order_date']) { - return $result['max_order_date']; + if (is_array($result) && count($result) && !$result['use_global_max_booking_offset']) { + return date('Y-m-d', strtotime('+ '.$result['max_booking_offset'].' days')); } - if ($globalBookingDate = Configuration::get('MAX_GLOBAL_BOOKING_DATE')) { - return $globalBookingDate; + if ($globalBookingDate = Configuration::get('GLOBAL_MAX_BOOKING_OFFSET')) { + return date('Y-m-d', strtotime('+ '.$globalBookingDate.' days')); } return 0; @@ -69,14 +69,33 @@ class HotelOrderRestrictDate extends ObjectModel * @param int $id_hotel * @return int|false */ - public static function getPreparationTime($idHotel) + public static function getMaxBookingOffset($idHotel) { $result = self::getDataByHotelId($idHotel); - if (is_array($result) && count($result) && !$result['use_global_preparation_time']) { - return (int) $result['preparation_time']; + if (is_array($result) && count($result) && !$result['use_global_max_booking_offset']) { + return $result['max_booking_offset']; } - $globalPreparationTime = Configuration::get('GLOBAL_PREPARATION_TIME'); + if ($globalBookingDate = Configuration::get('GLOBAL_MAX_BOOKING_OFFSET')) { + return $globalBookingDate; + } + + return 0; + } + + + /** + * @param int $id_hotel + * @return int|false + */ + public static function getMinBookingOffset($idHotel) + { + $result = self::getDataByHotelId($idHotel); + if (is_array($result) && count($result) && !$result['use_global_min_booking_offset']) { + return (int) $result['min_booking_offset']; + } + + $globalPreparationTime = Configuration::get('GLOBAL_MIN_BOOKING_OFFSET'); if ($globalPreparationTime != '0') { return (int) $globalPreparationTime; } diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index 484311892..cc053d515 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -267,10 +267,10 @@ class HotelReservationSystemDb "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_order_restrict_date` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_hotel` int(11) NOT NULL, - `use_global_max_order_date` tinyint(1) NOT NULL, - `max_order_date` date NOT NULL, - `use_global_preparation_time` tinyint(1) NOT NULL, - `preparation_time` int(11) NOT NULL, + `use_global_max_booking_offset` tinyint(1) NOT NULL, + `max_booking_offset` int(11) NOT NULL, + `use_global_min_booking_offset` tinyint(1) NOT NULL, + `min_booking_offset` int(11) NOT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id`) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 19223bf00..4d6d65673 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -168,15 +168,7 @@ class AdminAddHotelController extends ModuleAdminController } } - $restrictDateInfo = HotelOrderRestrictDate::getDataByHotelId($idHotel); - if ($restrictDateInfo) { - if ($restrictDateInfo['max_order_date'] == '0000-00-00') { - $restrictDateInfo['max_order_date'] = date('d-m-Y', strtotime('1 year')); - } else { - $restrictDateInfo['max_order_date'] = date('d-m-Y', strtotime($restrictDateInfo['max_order_date'])); - } - } - $smartyVars['order_restrict_date_info'] = $restrictDateInfo; + $smartyVars['order_restrict_date_info'] = HotelOrderRestrictDate::getDataByHotelId($idHotel); $objHotelFeatures = new HotelFeatures(); $hotelFeatures = $this->object->getFeaturesOfHotelByHotelId($this->object->id); if ($features = $objHotelFeatures->HotelBranchSelectedFeaturesArray($hotelFeatures)) { @@ -220,8 +212,8 @@ class AdminAddHotelController extends ModuleAdminController $smartyVars['state_var'] = $stateOptions; $smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP'); $smartyVars['ps_img_dir'] = _PS_IMG_.'l/'; - $smartyVars['MAX_GLOBAL_BOOKING_DATE'] = (Configuration::get('MAX_GLOBAL_BOOKING_DATE')); - $smartyVars['GLOBAL_PREPARATION_TIME'] = Configuration::get('GLOBAL_PREPARATION_TIME'); + $smartyVars['GLOBAL_MAX_BOOKING_OFFSET'] = Configuration::get('GLOBAL_MAX_BOOKING_OFFSET'); + $smartyVars['GLOBAL_MIN_BOOKING_OFFSET'] = Configuration::get('GLOBAL_MIN_BOOKING_OFFSET'); $this->context->smarty->assign($smartyVars); @@ -241,6 +233,10 @@ class AdminAddHotelController extends ModuleAdminController public function processSave() { + if (!$this->loadObject(true)) { + return false; + } + $idHotel = Tools::getValue('id'); $phone = Tools::getValue('phone'); $email = Tools::getValue('email'); @@ -254,10 +250,10 @@ class AdminAddHotelController extends ModuleAdminController $address = Tools::getValue('address'); $active = Tools::getValue('ENABLE_HOTEL'); $activeRefund = Tools::getValue('active_refund'); - $enableUseGlobalMaxOrderDate = Tools::getValue('enable_use_global_max_order_date'); - $maximumBookingDate = Tools::getValue('maximum_booking_date'); - $enableUseGlobalPreparationTime = Tools::getValue('enable_use_global_preparation_time'); - $preparationTime = Tools::getValue('preparation_time'); + $enableUseGlobalMaxBookingOffset = Tools::getValue('enable_use_global_max_booking_offset'); + $maxBookingOffset = trim(Tools::getValue('max_booking_offset')); + $enableUseGlobalMinBookingOffset = Tools::getValue('enable_use_global_min_booking_offset'); + $minBookingOffset = trim(Tools::getValue('min_booking_offset')); $latitude = Tools::getValue('loclatitude'); $longitude = Tools::getValue('loclongitude'); $map_formated_address = Tools::getValue('locformatedAddr'); @@ -427,24 +423,35 @@ class AdminAddHotelController extends ModuleAdminController } if ($idHotel) { - if (!$enableUseGlobalMaxOrderDate) { - $maximumBookingDateFormatted = date('Y-m-d', strtotime($maximumBookingDate)); - if ($maximumBookingDate == '') { - $this->errors[] = $this->l('Maximum Check-out Date to book a room is a required field.'); - } elseif (!Validate::isDate($maximumBookingDateFormatted)) { - $this->errors[] = $this->l('Maximum Check-out Date to book a room is invalid.'); - } elseif (strtotime($maximumBookingDateFormatted) < strtotime(date('Y-m-d'))) { - $this->errors[] = $this->l('Maximum Check-out Date to book a room can not be a past date. Please use a future date.'); + if (!$enableUseGlobalMaxBookingOffset) { + if ($maxBookingOffset === '') { + $this->errors[] = $this->l('Maximum booking offset is a required field.'); + } elseif (!$maxBookingOffset || !Validate::isUnsignedInt($maxBookingOffset)) { + $this->errors[] = $this->l('Maximum booking offset is invalid.'); } } - if (!$enableUseGlobalPreparationTime) { - if ($preparationTime === '') { + if (!$enableUseGlobalMinBookingOffset) { + if ($minBookingOffset === '') { $this->errors[] = $this->l('Minimum booking offset is a required field.'); - } elseif ($preparationTime !== '0' && !Validate::isUnsignedInt($preparationTime)) { + } elseif (!Validate::isUnsignedInt($minBookingOffset)) { $this->errors[] = $this->l('Minimum booking offset is invalid.'); } } + + if (empty($this->errors)) { + if (!$enableUseGlobalMaxBookingOffset && !$enableUseGlobalMinBookingOffset) { + if ($maxBookingOffset && $maxBookingOffset <= $minBookingOffset) { + $this->errors[] = $this->l('Field Maximum booking offset cannot be be less than or equal to Minimum booking offset.'); + } + } else { + if (!$enableUseGlobalMaxBookingOffset && $maxBookingOffset <= Configuration::get('GLOBAL_MIN_BOOKING_OFFSET')) { + $this->errors[] = $this->l('Field Maximum booking offset cannot be be less than or equal to global Minimum booking offset.'); + } else if (!$enableUseGlobalMinBookingOffset && $minBookingOffset >= Configuration::get('GLOBAL_MAX_BOOKING_OFFSET')) { + $this->errors[] = $this->l('Field Minimum booking offset cannot be be greater than or equal to Global Maximum booking offset.'); + } + } + } } if (!count($this->errors)) { @@ -734,19 +741,20 @@ class AdminAddHotelController extends ModuleAdminController $restrictDateInfo = HotelOrderRestrictDate::getDataByHotelId($newIdHotel); if ($restrictDateInfo) { $objHotelOrderRestrictDate = new HotelOrderRestrictDate($restrictDateInfo['id']); - } else { - $objHotelOrderRestrictDate = new HotelOrderRestrictDate(); } $objHotelOrderRestrictDate->id_hotel = $newIdHotel; - $objHotelOrderRestrictDate->use_global_max_order_date = $enableUseGlobalMaxOrderDate; - if (!$enableUseGlobalMaxOrderDate) { - $objHotelOrderRestrictDate->max_order_date = $maximumBookingDateFormatted; + $objHotelOrderRestrictDate->use_global_max_booking_offset = $enableUseGlobalMaxBookingOffset; + $objHotelOrderRestrictDate->use_global_min_booking_offset = $enableUseGlobalMinBookingOffset; + + if (!$enableUseGlobalMaxBookingOffset) { + $objHotelOrderRestrictDate->max_booking_offset = $maxBookingOffset; } - $objHotelOrderRestrictDate->use_global_preparation_time = $enableUseGlobalPreparationTime; - if (!$enableUseGlobalPreparationTime) { - $objHotelOrderRestrictDate->preparation_time = $preparationTime; + + if (!$enableUseGlobalMinBookingOffset) { + $objHotelOrderRestrictDate->min_booking_offset = $minBookingOffset; } + $objHotelOrderRestrictDate->save(); $objHotelFeatures = new HotelBranchFeatures(); @@ -756,32 +764,25 @@ class AdminAddHotelController extends ModuleAdminController } } + $conf = 3; + if ($idHotel) { + $con = 4; + } + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { - if ($idHotel) { - Tools::redirectAdmin( - self::$currentIndex.'&id='.(int) $newIdHotel.'&update'.$this->table.'&conf=4&token='. - $this->token - ); - } else { - Tools::redirectAdmin( - self::$currentIndex.'&id='.(int) $newIdHotel.'&update'.$this->table.'&conf=3&token='. - $this->token - ); - } + Tools::redirectAdmin(self::$currentIndex.'&id='.(int) $newIdHotel.'&update'.$this->table.'&conf='.$conf.'&token='.$this->token ); } else { - if ($idHotel) { - Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); - } else { - Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token); - } + Tools::redirectAdmin(self::$currentIndex.'&conf='.$conf.'&token='.$this->token); } } + if ($idHotel) { $this->display = 'edit'; } else { $this->display = 'add'; } } + public function processStatus() { parent::processStatus(); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index f41549ee8..3c7e27ced 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -65,15 +65,6 @@ class HotelReservationSystem extends Module public function hookDisplayHeader() { - // check max global order_restriction date is set - if (!Configuration::get('MAX_GLOBAL_BOOKING_DATE') - || (strtotime(date('Y-m-d')) > strtotime(Configuration::get('MAX_GLOBAL_BOOKING_DATE'))) - ) { - Configuration::updateValue( - 'MAX_GLOBAL_BOOKING_DATE', - date('Y-m-d', strtotime(date('Y-m-d', time()).' + 1 year')) - ); - } if (!Configuration::get('PS_CATALOG_MODE')) { /*To remove room from cart before todays date*/ if (isset($this->context->cart->id) && $this->context->cart->id) { diff --git a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css index 147403354..6b2ee3587 100644 --- a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css +++ b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css @@ -426,12 +426,6 @@ p.room_cat_data } /*AdminHotelConfigurationSetting controller*/ - -#max_global_book_date -{ - width: 30%; -} - .htl_all_setting .btn.btn-default { margin: 20px!important; } diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index 1e3bc80b5..1253a45d2 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -551,22 +551,6 @@ $(document).ready(function() { $("#conf_id_WK_BO_MESSAGE").hide(); }); - /*For OrderRestrict Functionality*/ - $("#max_htl_book_date").datepicker({ - defaultDate: new Date(), - dateFormat: 'dd-mm-yy', - minDate: 0, - }); - - $("#max_global_book_date").datepicker({ - defaultDate: new Date(), - dateFormat: 'dd-mm-yy', - minDate: 0, - }); - - //$( "#max_global_book_date" ).datepicker( "option", "maxDate", '20 Mar 2020'); - /*END*/ - /* ---- AdminHotelFeaturePricesSettingsController Admin ---- */ $('#date_selection_type').on('change', function() { @@ -805,26 +789,19 @@ $(document).ready(function() { }); } - // manage hotel page - $('#maximum_booking_date').datepicker({ - defaultDate: new Date(), - dateFormat: 'dd-mm-yy', - minDate: 0, - }); - - $('input[name="enable_use_global_max_order_date"]').on('change', function () { + $('input[name="enable_use_global_max_booking_offset"]').on('change', function () { if (parseInt($(this).val())) { - $('input[name="maximum_booking_date"]').closest('.form-group').hide(200); + $('input[name="max_booking_offset"]').closest('.form-group').hide(200); } else { - $('input[name="maximum_booking_date"]').closest('.form-group').show(200); + $('input[name="max_booking_offset"]').closest('.form-group').show(200); } }); - $('input[name="enable_use_global_preparation_time"]').on('change', function () { + $('input[name="enable_use_global_min_booking_offset"]').on('change', function () { if (parseInt($(this).val())) { - $('input[name="preparation_time"]').closest('.form-group').hide(200); + $('input[name="min_booking_offset"]').closest('.form-group').hide(200); } else { - $('input[name="preparation_time"]').closest('.form-group').show(200); + $('input[name="min_booking_offset"]').closest('.form-group').show(200); } }); diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index abe5510d2..074d62a93 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -427,23 +427,23 @@ {if isset($hotel_info.id) && $hotel_info.id}
- - - - + + + + -
{l s='Global max order date:' mod='hotelreservationsystem'} {dateFormat date=$MAX_GLOBAL_BOOKING_DATE}
+
{l s='Global maximum booking offset:' mod='hotelreservationsystem'} {$GLOBAL_MAX_BOOKING_OFFSET}
-
- +
From 259d99351a6a6e98d74ee4fa2bde465ebca38ec7 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 13 Mar 2025 15:05:49 +0530 Subject: [PATCH 042/143] Added max order date validation in the validate date range for hotel function --- .../hotelreservationsystem/classes/HotelHelper.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index e0d5ef41c..8e36af8c5 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -2495,15 +2495,25 @@ class HotelHelper return $daysDifference; } + /** + * Validate the date range for a hotel booking. + * + * @param string $dateFrom Start date (format: 'Y-m-d H:i:s') + * @param string $dateTo End date (format: 'Y-m-d H:i:s') + * @param int $idHotel Hotel ID + * @return bool True if the date range is valid, otherwise false + */ public static function validateDateRangeForHotel($dateFrom, $dateTo, $idHotel) { $validStartDateTimeStamp = strtotime(date('Y-m-d')); if ($minBookingOffset = (int) HotelOrderRestrictDate::getMinBookingOffset($idHotel)) { - $validStartDateTimeStamp = strtotime(date('Y-m-d', strtotime('+ '.$minBookingOffset.' day'))); + $validStartDateTimeStamp = strtotime('+ '.$minBookingOffset.' day', $validStartDateTimeStamp); } + $maxOrderDateTimestamp = strtotime(HotelOrderRestrictDate::getMaxOrderDate($idHotel)); $dateFromTimestamp = strtotime($dateFrom); $dateToTimestamp = strtotime($dateTo); + $isValid = true; if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $validStartDateTimeStamp))) { $isValid = false; @@ -2511,6 +2521,8 @@ class HotelHelper $isValid = false; } else if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) { $isValid = false; + } else if ($dateToTimestamp > $maxOrderDateTimestamp) { + $isValid = false; } Hook::exec('actionValidateDateRangeForHotel', array( From a4ef6e60cd4faebf6f60546dc7ff866c92314b80 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 13 Mar 2025 16:34:40 +0530 Subject: [PATCH 043/143] Added validation for impact value when impact type is percentage for the advance price rule --- .../controllers/admin/AdminHotelFeaturePricesSettings.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index 7cd48a1ee..830d1a635 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -480,6 +480,10 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } else { if (!Validate::isPrice($impactValue)) { $this->errors[] = $this->l('Invalid value of impact value.'); + } else if ($priceImpactType == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE + && $impactValue > 100 // check if percentage added is greater then 100 + ) { + $this->errors[] = $this->l('Invalid value of impact value.'); } } @@ -651,6 +655,10 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } else { if (!Validate::isPrice($impactValue)) { $this->errors[] = $this->l('Invalid value of impact value.'); + } else if ($priceImpactType == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE + && $impactValue > 100 // check if percentage added is greater then 100 + ) { + $this->errors[] = $this->l('Invalid value of impact value.'); } } From 6d507c9cffe952db86d913b4e9d14c52b14c4b0f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 17 Mar 2025 11:13:17 +0530 Subject: [PATCH 044/143] Fixed: The feature price not being deleted on the room delete --- controllers/admin/AdminOrdersController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b852574d7..fbc984de9 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -6138,7 +6138,6 @@ class AdminOrdersControllerCore extends AdminController $obj_hotel_cart_detail = new HotelCartBookingData(); $deleted = $obj_hotel_cart_detail->deleteRowById($del_id); if ($deleted) { - HotelRoomTypeFeaturePricing::deleteByIdCart($cart_id, $id_product, $room_id, $dt_frm, $dt_to ); $obj_product_process = new HotelCartBookingData(); $num_cart_rooms = 0; if ($rooms = $obj_hotel_cart_detail->getCartCurrentDataByCartId($cart_id)) { @@ -6146,6 +6145,8 @@ class AdminOrdersControllerCore extends AdminController } $numDays = HotelHelper::getNumberOfDays($dt_frm, $dt_to); + $dt_to = date('Y-m-d H:i:s', strtotime($dt_to) - _TIME_1_DAY_); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($cart_id, $id_product, $room_id, $dt_frm, $dt_to); $changed = $obj_product_process->changeProductDataByRoomId($room_id, $id_product, $numDays, $cart_id); if ($changed) { $result['status'] = 'deleted'; From cbd927ffa50260dab3c91a4ace6fb0231f66eff4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Mar 2025 17:27:30 +0530 Subject: [PATCH 045/143] Updated the flow, changed the customer guest detail database, save update and delete process --- .../customers/helpers/view/view.tpl | 32 +++++ .../customers/modals/_customer_guest_form.tpl | 53 ++++++++ .../controllers/customers/modals/index.php | 29 ++++ classes/Customer.php | 28 ++-- ...uestDetail.php => CustomerGuestDetail.php} | 94 ++++++++----- classes/PaymentModule.php | 14 +- .../CheckoutCustomerDetailsStep.php | 4 +- .../AdminCustomerPreferencesController.php | 9 ++ .../admin/AdminCustomersController.php | 118 +++++++++++++++-- controllers/front/AuthController.php | 2 +- controllers/front/IdentityController.php | 3 +- controllers/front/OrderOpcController.php | 3 +- install/data/db_structure.sql | 10 +- install/data/xml/configuration.xml | 3 + js/admin/customers.js | 125 ++++++++++++++++++ .../hotel-reservation-theme/js/order-opc.js | 45 ++++--- themes/hotel-reservation-theme/order-opc.tpl | 15 ++- 17 files changed, 489 insertions(+), 98 deletions(-) create mode 100644 admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl create mode 100644 admin/themes/default/template/controllers/customers/modals/index.php rename classes/{CartCustomerGuestDetail.php => CustomerGuestDetail.php} (58%) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 8213ed88d..432be8ad9 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -664,6 +664,38 @@ {/if}
+ {if $customer_guests && count($customer_guests)} +
+
+ + {l s='Customer Guests'} + {count($customer_guests)} +
+ + + + + + + + + + + + {foreach $customer_guests AS $key => $customer_guest} + + + + + + + + + {/foreach} + +
{l s='Email'}{l s='First name'}{l s='Last name'}{l s='phone'}{l s='Actions'}
{$customer_guest['email']}{$customer_guest['firstname']}{$customer_guest['lastname']}{$customer_guest['phone']}
+
+ {/if} diff --git a/admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl b/admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl new file mode 100644 index 000000000..12e9baa32 --- /dev/null +++ b/admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl @@ -0,0 +1,53 @@ +{* +* Since 2010 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*} + + diff --git a/admin/themes/default/template/controllers/customers/modals/index.php b/admin/themes/default/template/controllers/customers/modals/index.php new file mode 100644 index 000000000..ccbf6cb72 --- /dev/null +++ b/admin/themes/default/template/controllers/customers/modals/index.php @@ -0,0 +1,29 @@ + +* @copyright 2010-2020 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../'); +exit; diff --git a/classes/Customer.php b/classes/Customer.php index 2983aa607..6b84f07bd 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -207,7 +207,7 @@ class CustomerCore extends ObjectModel parent::__construct($id); if ($this->email) { - $this->phone = CartCustomerGuestDetail::getCustomerPhone($this->email); + $this->phone = CustomerGuestDetail::getCustomerPhone($this->email, false); } if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { @@ -264,7 +264,7 @@ class CustomerCore extends ObjectModel } $success = parent::add($autodate, $null_values); $this->updateGroup($this->groupBox); - $this->updateCustomerAdditionalDetails(CartCustomerGuestDetail::getIdCustomerGuest($this->email)); + $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); return $success; } @@ -289,20 +289,20 @@ class CustomerCore extends ObjectModel $objOldCustomer = new Customer($this->id); $success = parent::update(true); - $this->updateCustomerAdditionalDetails(CartCustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email)); + $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email, false)); return $success; } public function updateCustomerAdditionalDetails($idCustomerGuest) { - $objCartCustomerGuestDetail = new CartCustomerGuestDetail($idCustomerGuest); - $objCartCustomerGuestDetail->id_cart = 0; - $objCartCustomerGuestDetail->id_gender = $this->id_gender; - $objCartCustomerGuestDetail->firstname = $this->firstname; - $objCartCustomerGuestDetail->lastname = $this->lastname; - $objCartCustomerGuestDetail->email = $this->email; - $objCartCustomerGuestDetail->phone = $this->phone; - return $objCartCustomerGuestDetail->save(); + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest); + $objCustomerGuestDetail->id_customer = 0; + $objCustomerGuestDetail->id_gender = $this->id_gender; + $objCustomerGuestDetail->firstname = $this->firstname; + $objCustomerGuestDetail->lastname = $this->lastname; + $objCustomerGuestDetail->email = $this->email; + $objCustomerGuestDetail->phone = $this->phone; + return $objCustomerGuestDetail->save(); } public function delete() @@ -343,8 +343,8 @@ class CustomerCore extends ObjectModel CartRule::deleteByIdCustomer((int)$this->id); // delete customer data from customerGuest table - $objCartCustomerGuestDetail = new CartCustomerGuestDetail(CartCustomerGuestDetail::getIdCustomerGuest($this->email)); - $objCartCustomerGuestDetail->delete(); + $objCustomerGuestDetail = new CustomerGuestDetail(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); + $objCustomerGuestDetail->delete(); return parent::delete(); } @@ -542,7 +542,7 @@ class CustomerCore extends ObjectModel return Db::getInstance()->getValue( 'SELECT cgd.`phone` FROM `'._DB_PREFIX_.'customer` c - INNER JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd + INNER JOIN `'._DB_PREFIX_.'customer_guest_detail` cgd ON (cgd.`email` = c.`email`) WHERE `id_cart` = 0 AND c.`id_customer` = '.(int)($id_customer) ); diff --git a/classes/CartCustomerGuestDetail.php b/classes/CustomerGuestDetail.php similarity index 58% rename from classes/CartCustomerGuestDetail.php rename to classes/CustomerGuestDetail.php index f26e4c795..32f3eb63b 100644 --- a/classes/CartCustomerGuestDetail.php +++ b/classes/CustomerGuestDetail.php @@ -18,10 +18,10 @@ * @license https://store.webkul.com/license.html */ -class CartCustomerGuestDetailCore extends ObjectModel +class CustomerGuestDetailCore extends ObjectModel { public $id_customer_guest_detail; - public $id_cart; + public $id_customer; public $id_gender; public $firstname; public $lastname; @@ -31,10 +31,10 @@ class CartCustomerGuestDetailCore extends ObjectModel public $date_upd; public static $definition = array( - 'table' => 'cart_customer_guest_detail', + 'table' => 'customer_guest_detail', 'primary' => 'id_customer_guest_detail', 'fields' => array( - 'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32), @@ -49,48 +49,67 @@ class CartCustomerGuestDetailCore extends ObjectModel { return Db::getInstance()->getValue(' SELECT `id_customer_guest_detail` - FROM `'._DB_PREFIX_.'cart_customer_guest_detail` + FROM `'._DB_PREFIX_.'cart_customer_guest` WHERE `id_cart` = '.(int)$id_cart ); } - public function add($auto_date = true, $null_values = false) + public static function saveCartCustomerGuest($idCart, $idCustomerGuestDetail) { - if ($res = parent::add($auto_date, $null_values)) { - $objCart = new Cart($this->id_cart); - Db::getInstance()->insert('customer_guest_detail_mapping', array( - 'id_customer' => (int) $objCart->id_customer, - 'id_customer_guest_detail' => (int)$this->id - )); - } + return Db::getInstance()->insert('cart_customer_guest', array( + 'id_cart' => (int) $idCart, + 'id_customer_guest_detail' => (int) $idCustomerGuestDetail + )); + } - return $res; + public static function deleteCartCustomerGuest($idCart) + { + return Db::getInstance()->delete('cart_customer_guest', + ' `id_cart`='.(int) $idCart + ); + } + + public function deleteCartCustomerGuestByIdGuest() + { + return Db::getInstance()->delete('cart_customer_guest', + ' `id_customer_guest_detail`='.(int) $this->id + ); } public function delete() { - if ($res = parent::delete()) { - $objCart = new Cart($this->id_cart); - Db::getInstance()->delete('customer_guest_detail_mapping', - '`id_customer` = '.(int) $objCart->id_customer.' - AND `id_customer_guest_detail`='.(int) $this->id - ); + $this->deleteCartCustomerGuestByIdGuest(); + + return parent::delete(); + } + + public function deleteCartCustomerGuestByIdCustomer($idCustomer, $offset = 0) + { + $res = true; + if ($guests = $this->getCustomerRelatedGuestDetails($idCustomer, false, false, false, $offset)) { + foreach ($guests as $guest) { + $objCustomerGuestDetail = new CustomerGuestDetail((int) $guest['id_customer_guest_detail']); + $objCustomerGuestDetail->delete(); + } } return $res; } - public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false) + public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) { return Db::getInstance()->executeS(' - SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone`, cgd.`id_cart` - FROM `'._DB_PREFIX_.'customer_guest_detail_mapping` cgdm - LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd - ON (cgdm.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`) - WHERE cgdm.`id_customer` = '.(int)$idCustomer. + SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone` + FROM `'._DB_PREFIX_.'customer_guest_detail` cgd + LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest` ccg + ON (ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`) + WHERE cgd.`id_customer` = '.(int)$idCustomer. (($firstname !== false && $firstname != '') ? ' AND cgd.`firstname` LIKE "%'.$firstname.'%"' : ' '). (($lastname !== false && $lastname != '') ? ' AND cgd.`lastname` LIKE "%'.$lastname.'%"' : ' '). - (($email !== false && $email != '') ? ' AND cgd.`email` LIKE "%'.$email.'%"' : ' ') + (($email !== false && $email != '') ? ' AND cgd.`email` LIKE "%'.$email.'%"' : ' '). + 'GROUP BY cgd.`id_customer_guest_detail`'. + ' Order BY date_add DESC '. + (($offset) ? ' LIMIT 999999 OFFSET '.(int) $offset : ' ') ); } @@ -98,24 +117,29 @@ class CartCustomerGuestDetailCore extends ObjectModel { return Db::getInstance()->getRow(' SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone` - FROM `'._DB_PREFIX_.'cart_customer_guest_detail` + FROM `'._DB_PREFIX_.'customer_guest_detail` WHERE `id_customer_guest_detail` = '.(int)$id_customer_guest_detail ); } - public static function getIdCustomerGuest($email) + public static function getIdCustomerGuest($email, $idCustomer = null, $idCart = 0) { return Db::getInstance()->getValue( - 'SELECT `id_customer_guest_detail` FROM `'._DB_PREFIX_.'cart_customer_guest_detail` - WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"' + 'SELECT cgd.`id_customer_guest_detail` FROM `'._DB_PREFIX_.'customer_guest_detail` as cgd + LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest` ccg + ON ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail` + WHERE cgd.`email` = "'.pSQL($email).'"'. + (!is_null($idCart) ? ' AND (ccg.`id_cart` = '.(int) $idCart.' '. (($idCart) ? ')' : ' OR ISNULL(ccg.`id_cart`)) ') : ' '). + (!is_null($idCustomer) ? ' AND cgd.`id_customer` = '.(int) $idCustomer : ' ') ); } - public static function getCustomerPhone($email) + public static function getCustomerPhone($email, $idCustomer = null) { return Db::getInstance()->getValue( - 'SELECT `phone` FROM `'._DB_PREFIX_.'cart_customer_guest_detail` - WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"' + 'SELECT `phone` FROM `'._DB_PREFIX_.'customer_guest_detail` + WHERE 1 AND `email` = "'.pSQL($email).'"'. + (!is_null($idCustomer) ? ' AND `id_customer` ='.(int) $idCustomer: ' ') ); } @@ -135,7 +159,7 @@ class CartCustomerGuestDetailCore extends ObjectModel $isValid = false; } - $className = 'CartCustomerGuestDetail'; + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if (isset($rules['size']['firstname'])) { diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 516a755ab..7b4dcb80c 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -400,16 +400,16 @@ abstract class PaymentModuleCore extends Module } // save customer guest information - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { - if (Validate::isLoadedObject($objCartCustomerGuestDetail = new CartCustomerGuestDetail( + if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail( $id_customer_guest_detail ))) { $objOrderCustomerGuestDetail = new OrderCustomerGuestDetail(); - $objOrderCustomerGuestDetail->id_gender = $objCartCustomerGuestDetail->id_gender; - $objOrderCustomerGuestDetail->firstname = $objCartCustomerGuestDetail->firstname; - $objOrderCustomerGuestDetail->lastname = $objCartCustomerGuestDetail->lastname; - $objOrderCustomerGuestDetail->email = $objCartCustomerGuestDetail->email; - $objOrderCustomerGuestDetail->phone = $objCartCustomerGuestDetail->phone; + $objOrderCustomerGuestDetail->id_gender = $objCustomerGuestDetail->id_gender; + $objOrderCustomerGuestDetail->firstname = $objCustomerGuestDetail->firstname; + $objOrderCustomerGuestDetail->lastname = $objCustomerGuestDetail->lastname; + $objOrderCustomerGuestDetail->email = $objCustomerGuestDetail->email; + $objOrderCustomerGuestDetail->phone = $objCustomerGuestDetail->phone; $objOrderCustomerGuestDetail->id_order = (int)$order->id; $objOrderCustomerGuestDetail->save(); } diff --git a/classes/checkoutProcess/CheckoutCustomerDetailsStep.php b/classes/checkoutProcess/CheckoutCustomerDetailsStep.php index 6bccd6e83..a51cb3169 100644 --- a/classes/checkoutProcess/CheckoutCustomerDetailsStep.php +++ b/classes/checkoutProcess/CheckoutCustomerDetailsStep.php @@ -39,9 +39,9 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore } } elseif (Tools::getValue('proceed_to_payment')) { $guestInfoComplete = true; - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { $guestInfoComplete = false; - $objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail); + $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); if ($objCustomerGuestDetail->validateGuestInfo()) { $guestInfoComplete = true; } diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index 0526cc277..14d091f91 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -121,6 +121,15 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'bool' ), + 'PS_CUSTOMER_GUEST_MAX_NUM' => array( + 'title' => $this->l('Maximum Customers guests'), + 'hint' => $this->l('Maximum number of guests a customer can add using the "booking for someone else" feature. Set as 0 for no limit.'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'size' => 5, + 'type' => 'text', + 'class' => 'fixed-width-xl', + ), ), 'submit' => array( 'title' => $this->l('Save'), diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index c8e20a62e..381a7cde2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -939,6 +939,9 @@ class AdminCustomersControllerCore extends AdminController $customerLanguage = new Language($customer->id_lang); $shop = new Shop($customer->id_shop); + + $objCustomerGuestDetail = new CustomerGuestDetail(); + $customerGuests = $objCustomerGuestDetail->getCustomerRelatedGuestDetails($customer->id); $this->tpl_view_vars = array( 'customer' => $customer, 'gender' => $gender, @@ -985,7 +988,8 @@ class AdminCustomersControllerCore extends AdminController 'connections' => $connections, // Referrers 'referrers' => $referrers, - 'show_toolbar' => true + 'show_toolbar' => true, + 'customer_guests' => $customerGuests, ); return parent::renderView(); } @@ -1002,11 +1006,11 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer'); return; } else { - if ($idCustomerGuest = CartCustomerGuestDetail::getIdCustomerGuest($customerEmail)) { - $objCartCustomerGuestDetail = new CartCustomerGuestDetail($idCustomerGuest); - $objCartCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone); - $objCartCustomerGuestDetail->email = $objCustomer->email; - $objCartCustomerGuestDetail->save(); + if ($idCustomerGuest = CustomerGuestDetail::getIdCustomerGuest($customerEmail, false)) { + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest); + $objCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone); + $objCustomerGuestDetail->email = $objCustomer->email; + $objCustomerGuestDetail->save(); } } @@ -1176,7 +1180,7 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Phone number is required.'); } } - $className = 'CartCustomerGuestDetail'; + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if ($phone && !Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Invaid phone number.'); @@ -1389,17 +1393,113 @@ class AdminCustomersControllerCore extends AdminController $this->ajaxDie(json_encode($response)); } + public function ajaxProcessInitGuestModal() + { + $response['hasError'] = 1; + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { + $this->context->smarty->assign( + array( + 'genders' => Gender::getGenders(), + 'customerGuestDetail' => $objCustomerGuestDetail, + ) + ); + $modal = array( + 'modal_id' => 'customer-guest-modal', + 'modal_class' => 'customer_guest_modal', + 'modal_title' => '  '.$this->l('Guest details'), + 'modal_content' => $this->context->smarty->fetch('controllers/customers/modals/_customer_guest_form.tpl'), + 'modal_actions' => array( + array( + 'type' => 'button', + 'value' => 'submitGuestInfo', + 'class' => 'submitGuestInfoInfo btn-primary pull-right', + 'label' => ' '.$this->l('Save Guest'), + ), + ), + ); + + $this->context->smarty->assign($modal); + $response['hasError'] = 0; + $response['modalHtml'] = $this->context->smarty->fetch('modal.tpl'); + } + + $this->ajaxDie(json_encode($response)); + } + + + public function ajaxProcessUpdateGuestDetails() + { + $response = array('hasError' => 0, 'errors' => array()); + // Check tab access is allowed to edit + if ($this->tabAccess['edit'] == 1) { + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { + $objCustomerGuestDetail->id_gender = Tools::getValue('id_gender'); + $objCustomerGuestDetail->firstname = Tools::getValue('firstname'); + $objCustomerGuestDetail->lastname = Tools::getValue('lastname'); + $objCustomerGuestDetail->phone = Tools::getValue('phone'); + if ($objCustomerGuestDetail->save()) { + $gender = new Gender($objCustomerGuestDetail->id_gender, $this->context->language->id); + $response['data']['gender'] = $gender->name; + $response['data']['firstname'] = $objCustomerGuestDetail->firstname; + $response['data']['lastname'] = $objCustomerGuestDetail->lastname ; + $response['data']['email'] = $objCustomerGuestDetail->email; + $response['data']['phone'] = $objCustomerGuestDetail->phone; + $response['data']['id'] = $objCustomerGuestDetail->id; + $response['msg'] = $this->l('Guest details are updated.'); + } else { + $response['errors'][] = $this->l('Unable to save guest details.'); + } + } else { + $response['errors'][] = $this->l('Guest details not found.'); + } + } else { + $response['errors'][] = $this->l('You do not have permission to edit this.'); + } + + if ($response['errors']) { + $response['hasError'] = 1; + $this->context->smarty->assign('errors', $response['errors']); + $response['errorsHtml'] = $this->context->smarty->fetch('alerts.tpl'); + } + + $this->ajaxDie(json_encode($response)); + } + + public function ajaxProcessDeleteGuest() + { + $response = array('hasError' => 1, 'errors' => array()); + // Check tab access is allowed to edit + if ($this->tabAccess['delete'] == 1) { + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { + if ($objCustomerGuestDetail->delete()) { + $response['hasError'] = false; + $response['msg'] = $this->l('Successful deletion.'); + } else { + $response['msg'] = $this->l('Unable to delete guest details.'); + } + } else { + $response['msg'] = $this->l('Guest details not found.'); + } + } else { + $response['msg'] = $this->l('You do not have permission to delete this.'); + } + + $this->ajaxDie(json_encode($response)); + } + public function setMedia() { parent::setMedia(); if ($this->loadObject(true) - && ($this->display == 'edit' || $this->display == 'add') + && ($this->display == 'edit' || $this->display == 'add' || $this->display == 'view') ) { $idCustomer = $this->object->id ? $this->object->id : 0; Media::addJSDef( array( 'customer_controller_url' => self::$currentIndex.'&token='.$this->token, - 'id_customer' => $idCustomer + 'id_customer' => $idCustomer, + 'txtSomeErr' => $this->l('Some error occurred. Please try again.', null, true), + 'confirmTxt' => $this->l('Are you sure you want to delete this guest details?', null, true) ) ); $this->addJS(_PS_JS_DIR_.'admin/customers.js'); diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index ff254b67a..573ba8a0f 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -422,7 +422,7 @@ class AuthControllerCore extends FrontController $addresses_types[] = 'address_invoice'; } - $className = 'CartCustomerGuestDetail'; + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone')) { $this->errors[] = Tools::displayError('Phone number is required.'); diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 65ce13b27..04fb339de 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -88,7 +88,8 @@ class IdentityControllerCore extends FrontController $this->errors[] = Tools::displayError('Phone number is required.'); } } - $className = 'CartCustomerGuestDetail'; + + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if ($phone && !Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Invaid phone number.'); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index d8baeb03c..ba225a5e9 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -119,7 +119,8 @@ class OrderOpcControllerCore extends ParentOrderController if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !$phone) { $this->errors[] = Tools::displayError('Phone number is a required field.', false); } - $className = 'CartCustomerGuestDetail'; + + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if (!Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index b21a85bfd..ab0c0b31e 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -686,9 +686,9 @@ CREATE TABLE `PREFIX_order_customer_guest_detail` ( PRIMARY KEY (`id_order_customer_guest_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; -CREATE TABLE `PREFIX_cart_customer_guest_detail` ( +CREATE TABLE `PREFIX_customer_guest_detail` ( `id_customer_guest_detail` int(10) unsigned NOT NULL auto_increment, - `id_cart` int(10) unsigned NOT NULL, + `id_customer` int(10) unsigned NOT NULL, `id_gender` int(10) unsigned NOT NULL, `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, @@ -699,10 +699,10 @@ CREATE TABLE `PREFIX_cart_customer_guest_detail` ( PRIMARY KEY (`id_customer_guest_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; -CREATE TABLE `PREFIX_customer_guest_detail_mapping` ( +CREATE TABLE `PREFIX_cart_customer_guest` ( `id_customer_guest_detail` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_customer_guest_detail`, `id_customer`) + `id_cart` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_customer_guest_detail`, `id_cart`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; CREATE TABLE `PREFIX_customization` ( diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 490e2b691..7dae52982 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -946,6 +946,9 @@ 0 + + + 5 diff --git a/js/admin/customers.js b/js/admin/customers.js index 5eaa94c7d..d29e97ed7 100644 --- a/js/admin/customers.js +++ b/js/admin/customers.js @@ -48,4 +48,129 @@ $(document).ready(function() { }); } }); + + $(document).on('click', '.edit-customer-guest-detail', function(e) { + e.preventDefault(); + GuestModal.show($(this).data('id_customer_guest_detail')); + }); + $(document).on('click', '.delete-customer-guest-detail', function(e) { + e.preventDefault(); + if (confirm(confirmTxt)) { + GuestModal.deleteGuest($(this).data('id_customer_guest_detail')); + } + }); + + const GuestModal = { + show: function(id_customer_guest_detail) { + $("#page-loader").show(); + $('#customer-guest-modal').remove(); + $.ajax({ + url: customer_controller_url, + method: 'POST', + dataType: 'json', + data: { + ajax : 1, + id_customer_guest_detail: id_customer_guest_detail, + action: 'InitGuestModal' + }, + beforeSend: function() { + $("#page-loader").show(); + }, + success: function(result) { + if (result.hasError == 0 && result.modalHtml) { + $('#footer').next('.bootstrap').append(result.modalHtml); + $('#customer-guest-modal').modal('show'); + } else { + showErrorMessage(txtSomeErr); + } + }, + complete: function() { + $("#page-loader").hide(); + } + }); + }, + close: function() { + $('#customer-guest-modal').modal('hide'); + }, + submit: function() { + $("#page-loader").show(); + GuestModal.hideErrors(); + $.ajax({ + headers: { + "cache-control": "no-cache" + }, + url: customer_controller_url, + method: 'POST', + dataType: 'json', + cache: false, + data: $('#customer-guest-details-form').serialize()+'&ajax=true&action=updateGuestDetails', + success: function(result) { + if (result.hasError == true) { + GuestModal.showErrors(result.errorsHtml); + } else { + if (result.msg) { + showSuccessMessage(result.msg); + } + let tr = $(''); + tr.append('' + result.data.email + '') + .append('' + result.data.firstname + '') + .append('' + result.data.lastname + '') + .append('' + result.data.phone + '') + .append('') + .append(''); + $('.customer_guest_detail_'+result.data.id).html($(tr).html()); + } + }, + complete: function() { + $("#page-loader").hide(); + } + }); + }, + deleteGuest: function(id_customer_guest_detail) { + $("#page-loader").show(); + GuestModal.hideErrors(); + $.ajax({ + headers: { + "cache-control": "no-cache" + }, + url: customer_controller_url, + method: 'POST', + dataType: 'json', + cache: false, + data: { + ajax : 1, + id_customer_guest_detail: id_customer_guest_detail, + action: 'DeleteGuest' + }, + success: function(result) { + if (result.hasError == true) { + showErrorMessage(result.msg); + } else if (result.msg) { + showSuccessMessage(result.msg); + $('.customer_guest_detail_'+id_customer_guest_detail).remove(); + if ($('.customer_guest_details').length == 0) { + $('.customer-guests').closest('.panel').hide(); + } else { + $('.customer-guests-count').text(parseInt($('.customer_guest_details').length)); + } + } + }, + complete: function() { + $("#page-loader").hide(); + } + }); + }, + showErrors: function(errorsHtml) { + $('#customer-guest-modal .errors-wrap').html(errorsHtml); + $('#customer-guest-modal .errors-wrap').show(200); + }, + hideErrors: function(cb) { + $('#customer-guest-modal .errors-wrap').hide(200); + $('#customer-guest-modal .errors-wrap').html(''); + } + }; + $(document).on('click', '.submitGuestInfoInfo', function(e) { + e.preventDefault(); + GuestModal.submit(); + }); }); diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index c8af2ab06..df1ea54ac 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -94,9 +94,11 @@ $(document).ready(function() if ($("#customer_guest_detail:checked").val() == 1) { $('#checkout-guest-info-block').hide('slow'); $('#customer-guest-detail-container').show('slow'); + $('#customer_guest_detail_errors').show('slow'); } else { $('#customer-guest-detail-container').hide('slow'); $('#checkout-guest-info-block').show('slow'); + $('#customer_guest_detail_errors').hide('hide'); } } function validateCustomerGuestDetailForm() { @@ -115,30 +117,24 @@ $(document).ready(function() if ($("#customer_guest_detail:checked").val() == 1) { validateCustomerGuestDetailForm(); } - - function submitCustomerGuestDetailForm(postData) { - $.ajax({ - type: 'POST', - url: orderOpcUrl, - async: false, - cache: false, - dataType : "json", - data: postData - }); - } - - $('#customer_guest_detail_form').on('change', function(e) { - let postData = $(this).serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token; - submitCustomerGuestDetailForm(postData); + $(document).on('click', '.submit-guest-details', function(e) { + e.preventDefault(); + if ($('#customer_guest_detail').prop('checked')) { + validateCustomerGuestDetailForm(); + if ($('#customer_guest_detail_form').find('.form-error').length == 0) { + $('#customer_guest_detail_form').get(0).submit(); + } + } else { + $('#customer_guest_detail_form').get(0).submit(); + } }); + function setCustomerGuestDetailForm(guestDetail) { $('#customer_guest_detail_firstname').val(guestDetail.firstname); $('#customer_guest_detail_lastname').val(guestDetail.lastname); $('#customer_guest_detail_email').val(guestDetail.email); $('#customer_guest_detail_phone').val(guestDetail.phone); validateCustomerGuestDetailForm(); - let postData = $('#customer_guest_detail_form').serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token; - submitCustomerGuestDetailForm(postData); $('.customer_guest_detail_ul').remove(); } @@ -194,9 +190,17 @@ $(document).ready(function() $('.customer_guest_detail_ul').remove(); clearTimeout(debounceTimeout); // Clear the existing timeout debounceTimeout = setTimeout(() => { - let firstName = $('#customer_guest_detail_firstname').val(); - let lastName = $('#customer_guest_detail_lastname').val(); - let email = $('#customer_guest_detail_email').val(); + let firstName = ''; + let lastName = ''; + let email = ''; + if ($(e.target).prop('id') == 'customer_guest_detail_firstname') { + firstName = $('#customer_guest_detail_firstname').val() + } else if ($(e.target).prop('id') == 'customer_guest_detail_lastname') { + lastName = $('#customer_guest_detail_lastname').val() + } else if ($(e.target).prop('id') == 'customer_guest_detail_email') { + email = $('#customer_guest_detail_email').val() + } + let targetElem = $(this); customerGuestDetailAjax = $.ajax({ type: 'POST', @@ -220,7 +224,6 @@ $(document).ready(function() $(itemElem).attr('data-guest_detail', JSON.stringify(guestDetail)); $(listElem).append(itemElem); }); - $(targetElem).closest('.form-group').append($(listElem).prop('outerHTML')); } } diff --git a/themes/hotel-reservation-theme/order-opc.tpl b/themes/hotel-reservation-theme/order-opc.tpl index 3f342c077..f412b1bee 100644 --- a/themes/hotel-reservation-theme/order-opc.tpl +++ b/themes/hotel-reservation-theme/order-opc.tpl @@ -98,11 +98,22 @@ {if $is_logged || $isGuest} {if $is_logged} {block name='order_opc_guest_detail_form'} -
+ +

+ {if isset($customerGuestDetailErrors) && $customerGuestDetailErrors} +
+

{if $customerGuestDetailErrors|@count > 1}{l s='There are %d errors' sprintf=$customerGuestDetailErrors|@count}{else}{l s='There is %d error' sprintf=$customerGuestDetailErrors|@count}{/if}

+
    + {foreach from=$customerGuestDetailErrors key=k item=customerGuestDetailError} +
  1. {$customerGuestDetailError}
  2. + {/foreach} +
+
+ {/if}
@@ -173,7 +184,7 @@
- + {l s='Proceed'} From bc7339e073dcdb5b43bd7330b95410691ad6f2d6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Mar 2025 17:35:52 +0530 Subject: [PATCH 046/143] Updated the flow for customer guest creation and deletion process --- controllers/front/OrderOpcController.php | 109 ++++++++++++----------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index ba225a5e9..063ed9494 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -388,10 +388,6 @@ class OrderOpcControllerCore extends ParentOrderController $this->ajaxDie($this->changeRoomDemands()); exit; break; - case 'submitCustomerGuestDetail': - $this->ajaxDie($this->submitCustomerGuestDetail()); - exit; - break; case 'getCustomerGuestDetail': $this->ajaxDie($this->getCustomerGuestDetail()); exit; @@ -443,6 +439,10 @@ class OrderOpcControllerCore extends ParentOrderController parent::initContent(); + if (Tools::getValue('submitGuestDetails')) { + $this->submitCustomerGuestDetail(); + } + /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */ if (empty($this->context->cart->id_carrier)) { $checked = $this->context->cart->simulateCarrierSelectedOutput(); @@ -556,9 +556,9 @@ class OrderOpcControllerCore extends ParentOrderController $this->_assignPayment(); // GUEST BOOKING if ($this->isLogged) { - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { $this->context->smarty->assign( - 'customer_guest_detail', CartCustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail) + 'customer_guest_detail', CustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail) ); } $this->context->smarty->assign('id_customer_guest_detail', $id_customer_guest_detail); @@ -1080,23 +1080,14 @@ class OrderOpcControllerCore extends ParentOrderController $firstname = trim(Tools::getValue('firstname')); $lastname = trim(Tools::getValue('lastname')); $email = trim(Tools::getValue('email')); - $objCartCustomerGuestDetail = new CartCustomerGuestDetailCore(); - if ($guestDetails = $objCartCustomerGuestDetail->getCustomerRelatedGuestDetails( + $objCustomerGuestDetail = new CustomerGuestDetail(); + if ($guestDetails = $objCustomerGuestDetail->getCustomerRelatedGuestDetails( $this->context->cart->id_customer, $firstname, $lastname, $email, )) { $response['status'] = true; - $detailsExist = array(); - foreach ($guestDetails as $guestKey => $guestDetail) { - $joinKey = trim($guestDetail['firstname']).trim($guestDetail['lastname']).trim($guestDetail['email']); - if ($guestDetail['id_cart'] == $this->context->cart->id || isset($detailsExist[$joinKey])) { - unset($guestDetails[$guestKey]); - } - $detailsExist[$joinKey] = true; - } - $response['guestDetails'] = $guestDetails; } @@ -1110,71 +1101,85 @@ class OrderOpcControllerCore extends ParentOrderController $this->context->cookie->__set('customer_details_proceeded', 0); $this->context->cookie->checkedTOS = false; if ($customerGuestDetail) { - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { - $objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail); - } else { - $objCustomerGuestDetail = new CartCustomerGuestDetail(); - } - + $customerGuestDetailErrors = array(); $customerGuestDetailGender = Tools::getValue('customer_guest_detail_gender'); $customerGuestDetailFirstname = Tools::getValue('customer_guest_detail_firstname'); $customerGuestDetailLastname = Tools::getValue('customer_guest_detail_lastname'); $customerGuestDetailEmail = Tools::getValue('customer_guest_detail_email'); $customerGuestDetailPhone = Tools::getValue('customer_guest_detail_phone'); - - $className = 'CartCustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - - if (trim($customerGuestDetailGender) && Validate::isUnsignedInt($customerGuestDetailGender)) { - $objCustomerGuestDetail->id_gender = $customerGuestDetailGender; + if ($id_customer_guest_detail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->cart->id)) { + $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); + } else if ($id_customer_guest_detail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->customer->id, null)) { + $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); } else { - $result['errors']['customer_guest_detail_gender'] = Tools::displayError('Invalid gender'); + $objCustomerGuestDetail = new CustomerGuestDetail(); } - if (trim($customerGuestDetailFirstname) - && Validate::isName($customerGuestDetailFirstname) - && (!isset($rules['size']['firstname']) + $className = 'CustomerGuestDetail'; + $rules = call_user_func(array($className, 'getValidationRules'), $className); + + if (!(trim($customerGuestDetailGender) || !Validate::isUnsignedInt($customerGuestDetailGender))) { + $customerGuestDetailErrors[] = Tools::displayError('Invalid gender'); + } + + if (!trim($customerGuestDetailFirstname) + || !Validate::isName($customerGuestDetailFirstname) + || !(!isset($rules['size']['firstname']) || (isset($rules['size']['firstname']) && (Tools::strlen(trim($customerGuestDetailFirstname)) <= $rules['size']['firstname'])) ) ) { - $objCustomerGuestDetail->firstname = $customerGuestDetailFirstname; + $customerGuestDetailErrors[] = Tools::displayError('Invalid first name'); } - if (trim($customerGuestDetailLastname) - && Validate::isName($customerGuestDetailLastname) - && (!isset($rules['size']['lastname']) + if (!trim($customerGuestDetailLastname) + || !Validate::isName($customerGuestDetailLastname) + || !(!isset($rules['size']['lastname']) || (isset($rules['size']['lastname']) && (Tools::strlen(trim($customerGuestDetailLastname)) <= $rules['size']['lastname'])) ) ) { - $objCustomerGuestDetail->lastname = $customerGuestDetailLastname; + $customerGuestDetailErrors[] = Tools::displayError('Invalid last name'); } - if (trim($customerGuestDetailEmail) - && Validate::isEmail($customerGuestDetailEmail) - && (!isset($rules['size']['email']) + if (!trim($customerGuestDetailEmail) + || !Validate::isEmail($customerGuestDetailEmail) + || !(!isset($rules['size']['email']) || (isset($rules['size']['email']) && (Tools::strlen(trim($customerGuestDetailEmail)) <= $rules['size']['email'])) ) ) { - $objCustomerGuestDetail->email = $customerGuestDetailEmail; + $customerGuestDetailErrors[] = Tools::displayError('Invalid email'); } - if (trim($customerGuestDetailPhone) - && Validate::isPhoneNumber($customerGuestDetailPhone) - && (!isset($rules['size']['phone']) + if (!trim($customerGuestDetailPhone) + || !Validate::isPhoneNumber($customerGuestDetailPhone) + || !(!isset($rules['size']['phone']) || (isset($rules['size']['phone']) && (Tools::strlen(trim($customerGuestDetailPhone)) <= $rules['size']['phone'])) ) ) { - $objCustomerGuestDetail->phone = $customerGuestDetailPhone; + $customerGuestDetailErrors[] = Tools::displayError('Invalid phone'); } - $objCustomerGuestDetail->id_cart = $this->context->cart->id; - $objCustomerGuestDetail->save(); - } else { - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { - if (Validate::isLoadedObject($objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail))) { - $objCustomerGuestDetail->delete(); + if (empty($customerGuestDetailErrors)) { + $objCustomerGuestDetail->id_gender = $customerGuestDetailGender; + $objCustomerGuestDetail->firstname = $customerGuestDetailFirstname; + $objCustomerGuestDetail->lastname = $customerGuestDetailLastname; + $objCustomerGuestDetail->email = $customerGuestDetailEmail; + $objCustomerGuestDetail->phone = $customerGuestDetailPhone; + $objCustomerGuestDetail->id_customer = $this->context->customer->id; + if ($objCustomerGuestDetail->save()) { + if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_NUM')) { + $objCustomerGuestDetail->deleteCartCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); + } + // To prevent duplications for the same cart. + CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); + CustomerGuestDetail::saveCartCustomerGuest($this->context->cart->id, $objCustomerGuestDetail->id); + Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1))); } } + + $this->context->smarty->assign('customerGuestDetailErrors', $customerGuestDetailErrors); + } else { + CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); + Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1))); } $this->context->cart->save(); From dd9d4be23ead5aa89e79b5babea3d56ebcdaedef Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Mar 2025 17:40:24 +0530 Subject: [PATCH 047/143] updated some function names according to their working --- classes/CustomerGuestDetail.php | 6 +++--- controllers/admin/AdminCustomersController.php | 2 +- controllers/front/OrderOpcController.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/CustomerGuestDetail.php b/classes/CustomerGuestDetail.php index 32f3eb63b..2bc07b422 100644 --- a/classes/CustomerGuestDetail.php +++ b/classes/CustomerGuestDetail.php @@ -83,10 +83,10 @@ class CustomerGuestDetailCore extends ObjectModel return parent::delete(); } - public function deleteCartCustomerGuestByIdCustomer($idCustomer, $offset = 0) + public function deleteCustomerGuestByIdCustomer($idCustomer, $offset = 0) { $res = true; - if ($guests = $this->getCustomerRelatedGuestDetails($idCustomer, false, false, false, $offset)) { + if ($guests = $this->getCustomerGuestsByIdCustomer($idCustomer, false, false, false, $offset)) { foreach ($guests as $guest) { $objCustomerGuestDetail = new CustomerGuestDetail((int) $guest['id_customer_guest_detail']); $objCustomerGuestDetail->delete(); @@ -96,7 +96,7 @@ class CustomerGuestDetailCore extends ObjectModel return $res; } - public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) + public function getCustomerGuestsByIdCustomer($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) { return Db::getInstance()->executeS(' SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone` diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 381a7cde2..b9523a9bc 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -941,7 +941,7 @@ class AdminCustomersControllerCore extends AdminController $shop = new Shop($customer->id_shop); $objCustomerGuestDetail = new CustomerGuestDetail(); - $customerGuests = $objCustomerGuestDetail->getCustomerRelatedGuestDetails($customer->id); + $customerGuests = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer($customer->id); $this->tpl_view_vars = array( 'customer' => $customer, 'gender' => $gender, diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 063ed9494..ac66b6486 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -1081,7 +1081,7 @@ class OrderOpcControllerCore extends ParentOrderController $lastname = trim(Tools::getValue('lastname')); $email = trim(Tools::getValue('email')); $objCustomerGuestDetail = new CustomerGuestDetail(); - if ($guestDetails = $objCustomerGuestDetail->getCustomerRelatedGuestDetails( + if ($guestDetails = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer( $this->context->cart->id_customer, $firstname, $lastname, @@ -1167,7 +1167,7 @@ class OrderOpcControllerCore extends ParentOrderController $objCustomerGuestDetail->id_customer = $this->context->customer->id; if ($objCustomerGuestDetail->save()) { if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_NUM')) { - $objCustomerGuestDetail->deleteCartCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); + $objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); } // To prevent duplications for the same cart. CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); From f7a3c37cfadfe0457f137d94bca7daad2faa99b0 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Tue, 25 Mar 2025 16:43:48 +0530 Subject: [PATCH 048/143] Fix: Create new customer if guest email is sent via booking webservice --- classes/webservice/WebserviceSpecificManagementBookings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/webservice/WebserviceSpecificManagementBookings.php b/classes/webservice/WebserviceSpecificManagementBookings.php index e1c58944e..cc8862fc8 100644 --- a/classes/webservice/WebserviceSpecificManagementBookings.php +++ b/classes/webservice/WebserviceSpecificManagementBookings.php @@ -1269,7 +1269,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $this->bookingCustomer = $objCustomer; } else { $objCustomer = new Customer(); - $this->bookingCustomer = $objCustomer->getByEmail($guestDetails['email']); + $this->bookingCustomer = $objCustomer->getByEmail($guestDetails['email'], null, false); } if (isset($this->bookingCustomer->id) From 5d6cb9cad598f46ee6b3bd30e98b88683b57584d Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 1 Apr 2025 14:52:57 +0530 Subject: [PATCH 049/143] Added optimization for the price calculation for the room types in the cart --- classes/Cart.php | 16 +++--- .../classes/HotelBookingDetail.php | 2 +- .../classes/HotelCartBookingData.php | 56 ++++++++++++------- .../classes/HotelRoomTypeFeaturePricing.php | 24 +++++--- 4 files changed, 61 insertions(+), 37 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index b0e1c018d..e523441a7 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -733,8 +733,8 @@ class CartCore extends ObjectModel $totalPriceByProductTaxExcl = 0; $priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id); foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) { - $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $cartRoomInfo['id_product'], + $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices( + array($cartRoomInfo['id_product']), $cartRoomInfo['date_from'], $cartRoomInfo['date_to'], 0, @@ -744,8 +744,8 @@ class CartCore extends ObjectModel $cartRoomInfo['id_room'], 0 ); - $totalPriceByProductTaxIncl += $roomTotalPrice['total_price_tax_incl']; - $totalPriceByProductTaxExcl += $roomTotalPrice['total_price_tax_excl']; + $totalPriceByProductTaxIncl += $roomTotalPrice[$cartRoomInfo['id_product']]['total_price_tax_incl']; + $totalPriceByProductTaxExcl += $roomTotalPrice[$cartRoomInfo['id_product']]['total_price_tax_excl']; } // Rounding as per configurations @@ -1781,8 +1781,8 @@ class CartCore extends ObjectModel $priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id); foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) { // get the real price of the room type - $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $cartRoomInfo['id_product'], + $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices( + array($cartRoomInfo['id_product']), $cartRoomInfo['date_from'], $cartRoomInfo['date_to'], 0, @@ -1793,9 +1793,9 @@ class CartCore extends ObjectModel 0 ); if ($with_taxes) { - $totalPriceByProduct = $roomTotalPrice['total_price_tax_incl']; + $totalPriceByProduct = $roomTotalPrice[$cartRoomInfo['id_product']]['total_price_tax_incl']; } else { - $totalPriceByProduct = $roomTotalPrice['total_price_tax_excl']; + $totalPriceByProduct = $roomTotalPrice[$cartRoomInfo['id_product']]['total_price_tax_excl']; } // If customer has selected advance payment of the cart diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 328c9b681..d2c68e93c 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1689,7 +1689,7 @@ class HotelBookingDetail extends ObjectModel $numDays = 1; } $useTax = self::useTax(); - $productsFeaturePriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices($idProducts, $date_from, $date_to, 0, 1, 0); + $productsFeaturePriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices($idProducts, $date_from, $date_to, 0, 0, 0, 0, 0, 1, 0); foreach ($bookingData['rm_data'] as $key => $value) { $product_feature = Product::getFrontFeaturesStatic($this->context->language->id, $value['id_product']); $prod_amen = array(); diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 9f279c76e..0c2da0fa1 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1331,13 +1331,23 @@ class HotelCartBookingData extends ObjectModel */ public function getCartInfoIdCartIdProduct($id_cart, $id_product, $date_from = false, $date_to = false) { - $sql = 'SELECT * - FROM `'._DB_PREFIX_.'htl_cart_booking_data` - WHERE `id_cart`='.(int) $id_cart.' AND `id_product`='.(int) $id_product; - if ($date_from && $date_to) { - $sql .= ' AND `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\''; + $cache_key = 'HotelCartBookingData::getCartInfoIdCartIdProduct'.(int)$id_cart.(int)$id_product.($date_from ? strtotime($date_from) : '_').($date_to ? strtotime($date_to) : '_'); + if (!Cache::isStored($cache_key)) { + $sql = 'SELECT * + FROM `'._DB_PREFIX_.'htl_cart_booking_data` + WHERE `id_cart`='.(int) $id_cart.' AND `id_product`='.(int) $id_product; + if ($date_from && $date_to) { + $sql .= ' AND `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\''; + } + + $res = Db::getInstance()->executeS($sql); + + Cache::store($cache_key, $res); + } else { + $res = Cache::retrieve($cache_key); } - return Db::getInstance()->executeS($sql); + + return $res; } /** @@ -1419,17 +1429,21 @@ class HotelCartBookingData extends ObjectModel $idProducts, $dateFrom, $dateTo, - $idGroup + $idGroup, + $idCart = 0, + $idRoom = 0 ) { $featurePricePriority = Configuration::get('HTL_FEATURE_PRICING_PRIORITY'); if ($featurePricePriority = explode(';', $featurePricePriority)) { if ($featurePrices = Db::getInstance()->executeS( 'SELECT fp.`id_feature_price`, fp.`id_product`, fp.`date_from`, fp.`date_to`, fp.`impact_way`, fp.`is_special_days_exists`, - fp.`date_selection_type`, fp.`special_days`, fp.`impact_type`, fp.`impact_value` + fp.`id_cart`, fp.`id_room`, fp.`date_selection_type`, fp.`special_days`, fp.`impact_type`, fp.`impact_value` FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp'. (Group::isFeatureActive() ? ' INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $idGroup.')' : '').' - WHERE fp.`id_cart` = 0 AND fp.`id_product` IN('.implode(', ', $idProducts).') AND fp.`active`=1 + WHERE (fp.`id_cart` = 0 '.($idCart ? ' || fp.`id_cart` = '.(int) $idCart: '' ).') + AND (fp.`id_room` = 0 '.($idRoom ? ' || fp.`id_room` = '.(int) $idRoom: '' ).') + AND fp.`id_product` IN('.implode(', ', $idProducts).') AND fp.`active`=1 AND fp.`date_from` <= \''.pSQL($dateTo).'\' AND fp.`date_to` >= \''.pSQL($dateFrom).'\' ' )) { $idProductsWisefeaturePrice = array(); @@ -1686,8 +1700,8 @@ class HotelCartBookingData extends ObjectModel $cartHotelData[$prodKey]['date_diff'][$dateJoin]['children'] = $data_v['children']; $cartHotelData[$prodKey]['date_diff'][$dateJoin]['child_ages'] = json_decode($data_v['child_ages']); - $roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $product['id_product'], + $roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices( + array($product['id_product']), $data_v['date_from'], $data_v['date_to'], 0, @@ -1696,8 +1710,8 @@ class HotelCartBookingData extends ObjectModel $context->cart->id_guest, $data_v['id_room'] ); - $roomTypeDateRangePriceWithoutAutoAdd = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $product['id_product'], + $roomTypeDateRangePriceWithoutAutoAdd = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices( + array($product['id_product']), $data_v['date_from'], $data_v['date_to'], 0, @@ -1707,8 +1721,8 @@ class HotelCartBookingData extends ObjectModel $data_v['id_room'], 0 ); - $priceWithoutDiscount = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $product['id_product'], + $priceWithoutDiscount = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices( + array($product['id_product']), $data_v['date_from'], $data_v['date_to'], 0, @@ -1720,13 +1734,13 @@ class HotelCartBookingData extends ObjectModel 0 ); if (!$price_tax) { - $amount = $roomTypeDateRangePrice['total_price_tax_excl']; - $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl']; - $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl']; + $amount = $roomTypeDateRangePrice[$product['id_product']]['total_price_tax_excl']; + $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd[$product['id_product']]['total_price_tax_excl']; + $totalPriceWithoutDiscount = $priceWithoutDiscount[$product['id_product']]['total_price_tax_excl']; } else { - $amount = $roomTypeDateRangePrice['total_price_tax_incl']; - $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl']; - $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl']; + $amount = $roomTypeDateRangePrice[$product['id_product']]['total_price_tax_incl']; + $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd[$product['id_product']]['total_price_tax_incl']; + $totalPriceWithoutDiscount = $priceWithoutDiscount[$product['id_product']]['total_price_tax_incl']; } $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount; $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd; diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 55513a695..3b0e6afdd 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -793,7 +793,11 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $idProducts = array(), $dateFrom, $dateTo, + $quantity = 0, $idGroup = 0, + $idCart = 0, + $idGuest = 0, + $idRoom = 0, $withAutoRoomservices = 1, $useReduc = 1 ) { @@ -853,9 +857,15 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $idProducts, $dateFrom, $dateTo, - $idGroup + $idGroup, + $idCart, + $idRoom ); + if (!$quantity) { + $quantity = 1; + } + foreach ($idProducts as $idProduct) { for($currentDate = strtotime($dateFrom); $currentDate < strtotime($dateTo); $currentDate += _TIME_1_DAY_) { $featureImpactPriceTI = 0; @@ -916,8 +926,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel } } - $roomTypeWisePricing[$idProduct]['total_price_tax_excl'] = Tools::processPriceRounding($roomTypeWisePricing[$idProduct]['total_price_tax_excl']); - $roomTypeWisePricing[$idProduct]['total_price_tax_incl'] = Tools::processPriceRounding($roomTypeWisePricing[$idProduct]['total_price_tax_incl']); + $roomTypeWisePricing[$idProduct]['total_price_tax_excl'] = Tools::processPriceRounding($roomTypeWisePricing[$idProduct]['total_price_tax_excl'], $quantity); + $roomTypeWisePricing[$idProduct]['total_price_tax_incl'] = Tools::processPriceRounding($roomTypeWisePricing[$idProduct]['total_price_tax_incl'], $quantity); } Hook::exec('actionRoomTypesTotalPricesModifier', @@ -955,8 +965,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel ) { $dateFrom = date('Y-m-d H:i:s', strtotime($date_from)); $dateTo = date('Y-m-d H:i:s', strtotime($date_to)); - $totalDurationPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $id_product, + $totalDurationPrice = HotelRoomTypeFeaturePricing::getRoomTypesTotalPrices( + array($id_product), $dateFrom, $dateTo, 0, @@ -968,8 +978,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $use_reduc ); - $totalDurationPriceTI = $totalDurationPrice['total_price_tax_incl']; - $totalDurationPriceTE = $totalDurationPrice['total_price_tax_excl']; + $totalDurationPriceTI = $totalDurationPrice[$id_product]['total_price_tax_incl']; + $totalDurationPriceTE = $totalDurationPrice[$id_product]['total_price_tax_excl']; $numDaysInDuration = HotelHelper::getNumberOfDays($dateFrom, $dateTo); if ($use_tax) { $pricePerDay = $totalDurationPriceTI/$numDaysInDuration; From 0b5a6177538326fb541843f715892b7ed2499f59 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 7 Apr 2025 12:16:42 +0530 Subject: [PATCH 050/143] Added new hooks --- .../classes/HotelBookingDemands.php | 2 ++ .../classes/HotelCartBookingData.php | 2 ++ .../hotelreservationsystem/classes/HotelHelper.php | 1 + .../classes/RoomTypeServiceProduct.php | 1 + .../classes/RoomTypeServiceProductCartDetail.php | 11 +++++++++++ .../wkroomsearchblock/classes/WkRoomSearchHelper.php | 1 + 6 files changed, 18 insertions(+) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDemands.php b/modules/hotelreservationsystem/classes/HotelBookingDemands.php index 8cca590ba..bc1e66f44 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDemands.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDemands.php @@ -103,8 +103,10 @@ class HotelBookingDemands extends ObjectModel $sql .= ' AND hb.`id_room`='.(int)$idRoom; } if ($dateFrom && $dateTo) { + $result = Hook::exec('actionRoomTypeBookingDemandsDatesModifierBefore', array('date_from' => &$dateFrom, 'date_to' => &$dateTo), null, true); $dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom)); $dateTo = date('Y-m-d H:i:s', strtotime($dateTo)); + Hook::exec('actionRoomTypeBookingDemandsDatesModifierAfter', array('date_from' => &$dateFrom, 'date_to' => &$dateTo, 'result' => $result)); $sql .= ' AND hb.`date_from`=\''.pSQL($dateFrom).'\' AND hb.`date_to`= \''.pSQL($dateTo).'\''; } diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 7f8a3e151..17db396f7 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1078,6 +1078,8 @@ class HotelCartBookingData extends ObjectModel } } + Hook::exec('actionValidateCartBookingsErrors', array('errors' => &$errors)); + return $errors; } diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 7182faf92..16317f2db 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -2499,6 +2499,7 @@ class HotelHelper $startDate = new DateTime($dateFrom); $endDate = new DateTime($dateTo); $daysDifference = $startDate->diff($endDate)->days; + Hook::exec('actionDatesDifferenceModifier', array('date_from'=> $dateFrom, 'date_to'=> $dateTo, 'days_difference'=>&$daysDifference)); return $daysDifference; } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 7c80b17e1..ff485619e 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -145,6 +145,7 @@ class RoomTypeServiceProduct extends ObjectModel $sql .= ' AND p.`price_addition_type` = '.$priceAdditionType; } if ($services = Db::getInstance()->executeS($sql)) { + Hook::exec('actionAutoAddServices', array('services' => &$services, 'dateFrom' => $dateFrom, 'dateTo' => $dateTo)); $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); foreach($services as &$service) { $service['price'] = $objRoomTypeServiceProductPrice->getServicePrice( diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index fec2fed2c..6818de1f5 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -54,6 +54,17 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $idCart, $idHtlCartData ) { + $isServiceAvailable = Hook::exec('actionCheckServiceAvailability', array( + 'idProduct' => $idProduct, + 'quantity' => $quantity, + 'idCart' => $idCart, + 'idHtlCartData' => $idHtlCartData + )); + + if (!$isServiceAvailable) { + return false; + } + if ($id_room_type_service_product_cart_detail = $this->alreadyExists($idProduct, $idCart, $idHtlCartData)) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail($id_room_type_service_product_cart_detail); } else { diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php index 8a0c2335e..bbc36a8fa 100644 --- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php +++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php @@ -278,6 +278,7 @@ class WkRoomSearchHelper } $smartyVars['total_columns'] = $totalColumns; + Hook::exec('actionSearchPanelVariablesModifier', array('smartyVars' => &$smartyVars)); Context::getContext()->smarty->assign($smartyVars); } From b53544067d0c2775e9e88372976f044158a42da7 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 7 Apr 2025 15:04:44 +0530 Subject: [PATCH 051/143] Added new param id_guest in the product::getPriceStatic() --- classes/Cart.php | 2 ++ classes/Product.php | 2 +- .../classes/HotelRoomTypeFeaturePricing.php | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index e826b3f97..1444a2aad 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -635,6 +635,8 @@ class CartCore extends ObjectModel return array(); } + $customer = new Customer($this->id_customer); + Context::getContext()->customer = $customer; $cart_shop_context = Context::getContext()->cloneContext(); foreach ($result as &$row) { diff --git a/classes/Product.php b/classes/Product.php index f62901fe9..b5ec6f2b5 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3043,7 +3043,7 @@ class ProductCore extends ObjectModel public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null, $id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null, - $use_customer_price = true, $id_product_roomtype = false) + $use_customer_price = true, $id_product_roomtype = false, $id_group = null) { if (!$context) { $context = Context::getContext(); diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index fd1ef9d93..6b9a82692 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -651,8 +651,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $totalPrice['total_price_tax_excl'] = 0; $featureImpactPriceTE = 0; $featureImpactPriceTI = 0; - $productPriceTI = Product::getPriceStatic((int) $id_product, true, false, 6, null, false, $use_reduc); - $productPriceTE = Product::getPriceStatic((int) $id_product, false, false, 6, null, false, $use_reduc); + $productPriceTI = Product::getPriceStatic((int) $id_product, 1, 0, 6, null, 0, $use_reduc, 1, 0, null, null, null, $nothing, 1, 1, null, 1, 0, $id_group); + $productPriceTE = Product::getPriceStatic((int) $id_product, 0, 0, 6, null, 0, $use_reduc, 1, 0, null, null, null, $nothing, 1, 1, null, 1, 0, $id_group); if ($productPriceTE) { $taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100; } else { From 6d9b760aa0386918fbc1dffe1c5ab27c7d464359 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 9 Apr 2025 10:16:44 +0530 Subject: [PATCH 052/143] Added id_guest in the getServicePrice() --- .../classes/RoomTypeServiceProductPrice.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php index 8feb56940..ffb137c2f 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php @@ -110,7 +110,8 @@ class RoomTypeServiceProductPrice extends ObjectModel $useTax = null, $id_cart = false, $id_address = null, - $use_reduc= 1 + $use_reduc= 1, + $idGroup = null ) { if ($useTax === null) $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; @@ -135,7 +136,8 @@ class RoomTypeServiceProductPrice extends ObjectModel true, null, true, - (int)$idProductRoomType + (int)$idProductRoomType, + $idGroup ); Hook::exec('actionServicePriceModifier', From 5dc9e3acdfde3a11894732fbac6c82e08f6c96a0 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 10 Apr 2025 15:36:09 +0530 Subject: [PATCH 053/143] Removed book now button from search result page if no valid dates are provided --- modules/blockcart/blockcart.php | 5 ----- themes/hotel-reservation-theme/_partials/room_type_list.tpl | 4 ++-- .../js/modules/blockcart/ajax-cart.js | 4 +--- themes/hotel-reservation-theme/js/occupancy.js | 3 --- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index 2be499905..32033875c 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -395,11 +395,6 @@ class Blockcart extends Module $this->context->controller->addCSS(($this->_path).'blockcart.css', 'all'); if ((int) (Configuration::get('PS_BLOCK_CART_AJAX'))) { - Media::addJsDef( - array( - 'room_selection_error_message' => $this->l('You must check room availability before adding them to the cart.', null, true) - ) - ); $this->context->controller->addJS(($this->_path).'ajax-cart.js'); $this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll', 'bxslider')); } diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 1942ac424..171d2d1c1 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -98,7 +98,7 @@
{block name='room_type_list_room_booking_fields'}
- {if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict} + {if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict && (!isset($display_all_rooms) || !$display_all_rooms)} {if isset($occupancy_required_for_booking) && $occupancy_required_for_booking}
{block name='occupancy_field'} @@ -115,7 +115,7 @@ {/if} {block name='room_type_list_room_book_now_button'} {/block} {/if} diff --git a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js index ad9dee8b9..95bcd7192 100644 --- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js +++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js @@ -146,10 +146,8 @@ var ajaxCart = { // var minimalQuantity = $("#quantity_wanted_" + idProduct).val(); // if (!minimalQuantity) // minimalQuantity = 1; - if ($(this).prop('disabled') != 'disabled' && occupancy && !$(this).hasClass('display_type_room_list')) { + if ($(this).prop('disabled') != 'disabled' && occupancy) { ajaxCart.add(idProduct, idProductAttribute, false, this, occupancy, null, dateFrom, dateTo); - } else if ($(this).hasClass('display_type_room_list') && occupancy) { - showErrorMessage(room_selection_error_message); } }); //for product page 'add' button... diff --git a/themes/hotel-reservation-theme/js/occupancy.js b/themes/hotel-reservation-theme/js/occupancy.js index c13e4e13c..b292e430c 100644 --- a/themes/hotel-reservation-theme/js/occupancy.js +++ b/themes/hotel-reservation-theme/js/occupancy.js @@ -235,9 +235,6 @@ $(document).ready(function(){ $(document).on('click', '.booking_occupancy_wrapper .add_new_occupancy_btn', function(e) { e.preventDefault(); - if ($(this).hasClass('disabled')) { - return; - } var booking_occupancy_wrapper = $(this).closest('.booking_occupancy_wrapper'); var occupancy_block = ''; From 38dfe0cee54c3db4864b5b5a8d4c378bdb8e9957 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 10 Apr 2025 16:46:11 +0530 Subject: [PATCH 054/143] Removed extra phone numbers from the order-detail page in the front --- .../hotel-reservation-theme/order-detail.tpl | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index 9ac445d81..561d8a5a5 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -406,20 +406,6 @@ {$guestInformations['phone']|escape:'html':'UTF-8'} {/if} - - {if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile} - - {l s='Mobile'} - {$address_invoice->phone_mobile|escape:'html':'UTF-8'} - - {/if} - - {if isset($address_invoice->phone) && $address_invoice->phone} - - {l s='Phone'} - {$address_invoice->phone|escape:'html':'UTF-8'} - - {/if} {/if} {block name='displayOrderDetailGuestDetailsRow'} @@ -798,19 +784,6 @@ {$guestInformations['phone']|escape:'html':'UTF-8'} {/if} - {if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile} - - {l s='Mobile'} - {$address_invoice->phone_mobile|escape:'html':'UTF-8'} - - {/if} - - {if isset($address_invoice->phone) && $address_invoice->phone} - - {l s='Phone'} - {$address_invoice->phone|escape:'html':'UTF-8'} - - {/if} {/if} {block name='displayOrderDetailGuestDetailsRow'} From 7937f7d65c0f9bfa69ca57fe0b87448ae2644bea Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 14 Apr 2025 11:20:07 +0530 Subject: [PATCH 055/143] Update the url generate for the bulk update action, updated the form to retain the submitted values in case of any error --- .../admin/AdminHotelFeaturePricesSettings.php | 4 ++- .../helpers/form/form.tpl | 32 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index 830d1a635..a3b83fab1 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -203,7 +203,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController parent::initToolbar(); if (empty($this->display) || $this->display == 'list') { $this->page_header_toolbar_btn['bulk_add'] = array( - 'href' => self::$currentIndex.'&add'.$this->table.'&bulkAdd'.$this->table.'&token='.$this->token, + 'href' => self::$currentIndex.'&bulkAdd'.$this->table.'&token='.$this->token, 'desc' => $this->l('Bulk create rules'), 'imgclass' => 'new' ); @@ -230,6 +230,8 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController parent::initProcess(); if (Tools::isSubmit('bulkAdd'.$this->table)) { self::$currentIndex = self::$currentIndex.'&bulkAdd'.$this->table.''; + $this->action = 'new'; + $this->display = 'add'; } if (Tools::isSubmit('submitBulkAdd'.$this->table)) { diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index a9c3c89a8..2382c30e0 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -93,17 +93,17 @@
-
date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}{else}style="display:none;"{/if}> +
date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}style="display:none;"{else if !isset($edit) && !isset($smarty.post.date_selection_type)}style="display:none;"{/if}> @@ -112,24 +112,24 @@
-
date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}> +
date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
- +
-
date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}> +
date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
- +
-
date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}> +
date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}style="display:block;"{/if}> -
+
+ +
+ +
+
diff --git a/modules/wkfooteraboutblock/CHANGELOG.txt b/modules/wkfooteraboutblock/CHANGELOG.txt deleted file mode 100644 index 000b65308..000000000 --- a/modules/wkfooteraboutblock/CHANGELOG.txt +++ /dev/null @@ -1,52 +0,0 @@ ------------------------------- -# V1.0.3 to V1.0.4 ------------------------------- - -## Improved/Changed Features: - -* [CO] : [#528] licenses updated -* [FO] : [#387] Add nav bar and move language and currency selector at top at front office - - ------------------------------- -# V1.0.2 to V1.0.3 ------------------------------- - -## Improved/Changed Features: - -[*] FO : [#290] Using $this->_path for including css and js - - -------------------------------- -# V1.0.1 to V1.0.2 -------------------------------- - -## Improved/changed features - -[*] FO : Translations are corrected. - -## Update Policy - -- Mobule need only file update, can be updated only by UPLOADING new version on module - - - ------------------------------ -# V1.0.0 to V1.0.1 ------------------------------ - -## Added features - -+ [CO] : index.php added/Updated in all folders -+ [CO] : License.txt added. -+ [CO] : License added in every file. -+ [CO] : logo.gif file added. - - -## Improved/changed features - -- [CO] : WK_HTL_SHORT_DESC (configuration key) is called as multilang field now. - -## Update Policy - -- Mobule need only file update, can be updated only by UPLOADING new version on module \ No newline at end of file diff --git a/modules/wkfooteraboutblock/LICENSE.md b/modules/wkfooteraboutblock/LICENSE.md deleted file mode 100644 index 44b1b399c..000000000 --- a/modules/wkfooteraboutblock/LICENSE.md +++ /dev/null @@ -1,223 +0,0 @@ -SOFTWARE LICENCE AGREEMENT -=============================== - -This AGREEMENT is made effective on the date of the purchase of the software between Webkul Software Pvt. Ltd.,Company incorporated under the Companies Act, 1956 (hereinafter referred to as “Licensor"), and the purchaser of the software/ product (hereinafter referred to as "Licensee"). - -Preamble -================== -Licensor is a web and mobile product based organization engaged in the business of developing and marketing software for enterprise level e-commerce businesses. It is an ISO and NSR (NASSCOM) certified organization having a team of more than 150 creative engineers which come from different backgrounds. It has developed more than 700 web extensions and apps in the past few years for open source platforms which are used and trusted globally. Licensee now wishes to obtain license, and Licensor wishes to grant a license, to allow use of the software so purchased in developing the e-commerce business website/ mobile app of the Licensee, subject to the terms and conditions set forth herein. - - -THEREFORE, with the intent to be legally bound, the parties hereby agree as follows: - - -Agreement -================ - -1.Definitions : ------------------- -As used in this Agreement, the following capitalized terms shall have the definitions set forth below: - - -"Derivative Works" are works developed by Licensee, its officers, agents, contractors or employees, which are based upon, in whole or in part, the Source Code and/or the Documentation and may also be based upon and/or incorporate one or more other preexisting works of the Licensor. Derivative Works may be any improvement, revision, modification, translation (including compilation or recapitulation by computer), abridgment, condensation, expansion, or any other form in which such a preexisting work may be recast, transformed, or adapted. For purposes hereof, a Derivative Work shall also include any compilation that incorporates such a preexisting work. - - -"Documentation" is written, printed or otherwise recorded or stored (digital or paper) material relating to the Software and/or Source Code, including technical specifications and instructions for its use including Software/ Source Code annotations and other descriptions of the principles of its operation and instructions for its use. - - -"Improvements" shall mean, with respect to the Software, all modifications and changes made, developed, acquired or conceived after the date hereof and during the entire term of this Agreement. - - -"Source Code" is the computer programming source code form of the Software in the form maintained by the Licensor, and includes all non-third-party executables, libraries, components, and Documentation created or used in the creation, development, maintenance, and support of the Software as well as all updates, error corrections and revisions thereto provided by Licensor, in whole or in part. - - -2. Software License. -------------------------- - -(a)Grant of License. For the consideration set forth below, Licensor hereby grants to Licensee, and Licensee hereby accepts the worldwide, non-exclusive, perpetual, royalty-free rights and licenses set forth below: - - -(i)The right and license to use and incorporate the software, in whole or in part, to develop its website/ mobile app (including the integration of all or part of the Licensor’s software into Licensee's own software) on one domain ( Except Joomla modules , listed on store are entitled to be used on unlimited domain as per the standard guidelines ) only, solely for the own personal or business use of the Licensee. However, the License does not authorize the Licensee to compile, copy or distribute the said Software or its Derivative Works. - - -(ii)The right and license does not authorize the Licensee to make any backup or archival copies of the Software and / or the Source Code and Documentation. - -(iii)The right and license does not authorize the Licensee to migrate the domain license to another domain. - - -(b)Scope; Rights and Responsibilities. - - -(i)Licensor shall enable the Licensee to download one complete copy of the Software. - - -(ii)The Software is intended for the sole use of the Licensee in development of its own website/ mobile app. - - -(iii)Licensee does not have the right to hand over, sell, distribute, sub-license, rent, lease or lend any portion of the Software or Documentation, whether modified or unmodified, to anyone. Licensee should not place the Software on a server so that it becomes accessible via a public network such as the Internet for distribution purposes. In case the Licensee is using any source code management system like github, it can use the code there only when it has paid subscription from such management system. - - -(iv)Licensee is not authorized to appoint, or work with, third parties to perform any development services using the Source Code, the source code to Derivative Works and/or the Documentation on behalf of, or working with, the Licensee. Release of Source Code, Derivative Work source code and/or Documentation to any third party shall be considered as violation of the Agreement, inter-alia entailing forthwith termination and legal action. - - - -(c)Ownership. - - -(i)Software and Source Code. All right, title, copyright, and interest in the Software, Source Code, Software Modifications and Error corrections will be and remain the property of Licensor. - - -(ii)Derivative Works. As creation of Derivative Works by the Licensee is prohibited, thus, all right, title, copyright, and interest in any and/or all Derivative Works and Improvements created by, or on behalf of, Licensee will also be deemed to the property of Licensor. Licensor shall be entitled to protect copyright / intellectual property in all such Derivative Works and Improvements also in any country as it may deem fit including without limitation seeking copyright and/or patent protection. - - -3.Consideration. --------------------- - -(a)Licensee shall pay to Licensor the amount as mentioned on the website from where the order is placed, as one-time, upfront fees in consideration for the licenses and rights granted hereunder (hereinafter referred to as the "License Fee"). The License Fee to be paid by Licensee shall be paid upfront at the time of placing the order, and no credit will be allowed under any circumstances. - - -(b)Once paid, the License Fees shall be non-refundable. The Licensee has fully satisfied itself about the Software and has seen the demonstration, and only thereafter has placed the order. Thus, the License Fees or any part thereof is non-refundable. No claim for refund of the Licence Fees shall be entertained under any circumstances. - - - -4.Representations and Warranties. -------------------------------------- - -(a)Mutual. Each of the parties represents and warrants to the other as follows. - - -(i)such party is a legal entity duly organized, validly existing and in good standing; - - -(ii)such party has the power and authority to conduct its business as presently conducted and to enter into, execute, deliver and perform this Agreement. - - -(iii)This Agreement has been duly and validly accepted by such party and constitutes the legal, valid and binding obligations of such party respectively, enforceable against such party in accordance with their respective terms; - - -(iv)the acceptance, execution, delivery and performance of this Agreement does not and will not violate such party's charter or by-laws; nor require any consent, authorization, approval, exemption or other action by any third party or governmental entity. - - -(b)Licensor warrants that, at the time of purchase of the Software: - - -the Software will function materially as set forth in the website or published functionality provided by Licensor to customers and potential customers describing the Software; and - - -Software add-ons, if purchased by the Licensee from the Licensor, will not materially diminish the features or functions of or the specifications of the Software as they existed as of the execution of this Agreement. - - - -(c)Title. Licensor represents and warrants that it is the exclusive owner of all copyright/ intellectual property in the Software (including the Source Code) and has good and marketable title to the Software (including the Source Code) free and clear of all liens, claims and encumbrances of any nature whatsoever (collectively, "Liens"). Licensor's grant of license and rights to Licensee hereunder does not, and will not infringe any third party's property, intellectual property or personal rights. - - - -5.Term. -------------- - -(a)Subject to Licensee's payment obligations, this Agreement shall commence as on the date of making payment of the Software by the Licensee to the Licensor, and shall continue until terminated by either party. - - -(b)The Licensor retains the right to terminate the license at any time, if the Licensee is not abiding by any of the terms of the Agreement. The Licensee may terminate the Agreement at any time at its own discretion by uninstalling the Software and /or by destroying the said Software (or any copies thereof). However, the Licensee shall not be entitled to seek any refund of the amount paid by it to the Licensor, under any circumstances. - - -(c)Survival. In the event this Agreement is terminated for any reason, the provisions set forth in Sections 2(a), 2(b), and 2(c) shall survive. - - - - -6. Indemnification ----------------------- - -The Licensee release the Licensor from, and agree to indemnify, defend and hold harmless the Licensor (and its officers, directors, employees, agents and Affiliates) against, any claim, loss, damage, settlement, cost, taxes, expense or other liability (including, without limitation, attorneys' fees) (each, a "Claim") arising from or related to: (a) any actual or alleged breach of any obligations in this Agreement; (b) any refund, adjustment, or return of Software,(c) any claim for actual or alleged infringement of any Intellectual Property Rights made by any third party or damages related thereto; or (d) Taxes. - - -7. Limitation of Liability ------------------------------- - -The Licensor will not be liable for any direct, indirect, incidental, special, consequential or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data or other intangible losses arising out of or in connection with the Software, whether in contract, warranty, tort etc. (including negligence, software liability, any type of civil responsibility or other theory or otherwise) to the Licensee or any other person for cost of software, cover, recovery or recoupment of any investment made by the Licensee or its affiliates in connection with this Agreement, or for any other loss of profit, revenue, business, or data or punitive or consequential damages arising out of or relating to this Agreement. Further, the aggregate liability of the Licensor, arising out of or in connection with this Agreement or the transactions contemplated hereby will not exceed at any time, or under any circumstances, the total amounts received by the Licensor from the Licensee in connection with the particular software giving rise to the claim. - - -8. Force Majeure ---------------------- - -The Licensor will not be liable for any delay or failure to perform any of its obligations under this Agreement by reasons, events or other matters beyond its reasonable control. - - -9. Relationship of Parties ------------------------------- - -The Licensor and Licensee are independent legal entities, and nothing in this Agreement will be construed to create a partnership, joint venture, association of persons, agency, franchise, sales representative, or employment relationship between the parties. The Licensee will have no authority to make or accept any offers or representations on behalf of the Licensor. The relationship between the parties is that of Licensor and Licensee only, and the rights, duties, liabilities of each party shall be governed by this Agreement. - - -10. Modification ------------------------- - -The Licensor may amend any of the terms and conditions contained in this Agreement at any time and solely at its discretion. Any changes will be effective upon the posting of such changes on the Portal/ website, and the Licensee is responsible for reviewing these changes and informing itself of all applicable changes or notices. The continued use of a software by the Licensee after posting of any changes by the Licensor, will constitute the acceptance of such changes or modifications by the Licensee. - - - -11.Miscellaneous. ------------------------ - -(a)General Provisions. This Agreement: (i) may be amended only by a writing signed by each of the parties; (ii) may be executed in several counterparts, each of which shall be deemed an original but all of which shall constitute one and the same instrument; (iii) contains the entire agreement of the parties with respect to the transactions contemplated hereby and supersedes all prior written and oral agreements, and all contemporaneous oral agreements, relating to such transactions; (iv) shall be governed by, and construed and enforced in accordance with, the laws of India; and (v) shall be binding upon, and inure to the benefit of, the parties and their respective successors and permitted assigns. Each of the parties hereby irrevocably submits to the jurisdiction of the Courts at Delhi, India, for the purposes of any action or proceeding arising out of or relating to this Agreement or the subject matter hereof and brought by any other party. - - -(b)Assignment. Licensee cannot assign, pledge or otherwise transfer, whether by operation of law or otherwise, this Agreement, or any of its obligations hereunder, without the prior written consent of Licensor, which consent shall not be unreasonably withheld. - - -(c)Notices. Unless otherwise specifically provided herein, all notices, consents, requests, demands and other communications required or permitted hereunder: - - -(i)shall be in writing; - - -(ii)shall be sent by messenger, certified or registered mail/email, or reliable express delivery service, to the appropriate address(es) set forth below; and - - -(iii)shall be deemed to have been given on the date of receipt by the addressee, as evidenced by a receipt executed by the addressee (or a responsible person in his or her office), the records of the Party delivering such communication or a notice to the effect that such addressee refused to claim or accept such communication, if sent by messenger, mail or express delivery service. - - -All such communications shall be sent to the following addresses or numbers, or to such other addresses or numbers as any party may inform the others by giving five days' prior notice: - - -If to Webkul Software Pvt. Ltd.: - - - -Webkul Software Pvt. Ltd. - -H-28, ARV Park, Sector 63, NOIDA – 201301, - -Uttar Pradesh, India - - -If to Licensee: - -At the address mentioned by the Licensee - -(at the time of placing order of generating Invoice) - - -(d)Severability. It is the intent of the parties that the provisions of this Agreement be enforced to the fullest extent permissible under the laws and public policies of India in which enforcement hereof is sought. In furtherance of the foregoing, each provision hereof shall be severable from each other provision, and any provision hereof which is/ becomes unenforceable shall be subject to the following: (i) if such provision is contrary to or conflicts with any requirement of any statute, rule or regulation in effect, then such requirement shall be incorporated into, or substituted for, such unenforceable provision to the minimum extent necessary to make such provision enforceable; (ii) the court, agency or arbitrator considering the matter is hereby authorized to (or, if such court, agency or arbitrator is unwilling or fails to do so, then the parties shall) amend such provision to the minimum extent necessary to make such provision enforceable, and the parties hereby consent to the entry of an order so amending such provision; and (iii) if any such provision cannot be or is not reformed and made enforceable pursuant to clause (i) or (ii) above, then such provision shall be ineffective to the minimum extent necessary to make the remainder of this Agreement enforceable. Any application of the foregoing provisions to any provision hereof shall not effect the validity or enforceability of any other provision hereof. - - -(e)By purchasing the Software, the Licensee acknowledge that it has read this Agreement, and that it agrees to the content of the Agreement, its terms and agree to use the Software in compliance with this Agreement. - - -(f)The Licensor holds the sole copyright of the Software. The Software or any portion thereof is a copyrightable matter and is liable to be protected by the applicable laws. Copyright infringement in any manner can lead to prosecution according to the current law. The Licensor reserves the right to revoke the license of any user who is not holding any license or is holding an invalid license. - - -(g)This Agreement gives the right to use only one copy of the Software on one domain solely for the own personal or business use of the Licensee, subject to all the terms and conditions of this Agreement. A separate License has to be purchased for each new Software installation. Any distribution of the Software without the written consent of the Licensor (including non-commercial distribution) is regarded as violation of this Agreement, and will entail immediate termination of the Agreement and may invite liability, both civil and criminal, as per applicable laws. - - -(h)The Licensor reserves the rights to publish a selected list of users/ Licensees of its Software, and no permission of any Licensee is needed in this regard. The Licensee agrees that the Licensor may, in its sole discretion, disclose or make available any information provided or submitted by the Licensee or related to it under this Agreement to any judicial, quasi-judicial, governmental, regulatory or any other authority as may be required by the Licensor to co-operate and / or comply with any of their orders, instructions or directions or to fulfill any requirements under applicable Laws. - - -(i)If the Licensee continues to use the Software even after the sending of the notice by the Licensor for termination, the Licensee agree to accept an injunction to restrain itself from its further use, and to pay all costs (including but not limited to reasonable attorney fees) to enforce injunction or to revoke the License, and any damages suffered by the Licensor because of the misuse of the Software by the Licensee. - - -12. Arbitration ------------------------ - -If any dispute arises between the Licensor and the Licensee at any time, in connection with the validity, interpretation, implementation or alleged breach of any provision of this Agreement, the same shall be referred to a sole Arbitrator who shall be an independent and neutral third party appointed exclusively by the Licensor. The Licensee shall not object to the appointment of the Arbitrator so appointed by the Licensor. The place of arbitration shall be Delhi, India. The Arbitration & Conciliation Act, 1996 as amended by The Arbitration & Conciliation (Amendment) Act, 2015, shall govern the arbitration proceedings. The arbitration proceedings shall be held in the English language. diff --git a/modules/wkfooteraboutblock/index.php b/modules/wkfooteraboutblock/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/logo.gif b/modules/wkfooteraboutblock/logo.gif deleted file mode 100644 index c6839c90b242af2946174d9808b57d6accd5e9d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1818 zcmbVNSy&TS6b>SS3l_0e+=syhmC0n131k8hvam#qU_=2+mC0l@5t50?AW38gWf5dm zP?SYQv=>*00!Ow@@hnaiNJ^%U7`rS}@hycUg zSZ=Hy7OUe*M^jc4F-6@J*Ssm9_)*WJEo5a$cxjp>eOGvc8MD;Twc07G8{+o#_4Vb& z%PYRS;E#I#9qV8P1Qxja95tvyhF0uqzH%qtV1?LyW7d0-~ zTOujl7rj3n%SaWZRW7g6P1P3!Y%G#*G9YVmV%KM&nW_G%m+D*1Y)dwpvs>Aa7m#n7 zN#|kt>#+@K0qObk3$lW;Q@E+c^GmG4bz9}z+Ag#mj5|~qR#XtW@m~AAEWhk>MaBL0 zE-SolgDkhJ<3Vp%Z?eE#xU48wn%8x!tL<=Gov!{!#Sz<8+xeOcM^+rIkJ#C9<91zi z{lo5u+m$*3N64o!2{QpQK%>yDhV=r3=gY`};lnN5&{30U1u?%s(K|Y`}>Gk_J@dDy?1w zK0bK{1hi@q7|mC36b31&(S})#D8iaRU}`XM9uQy_nso*pN#lT7m#8-h%_0z2 zQz}x(?CoM01O`;-1Q95VQj>ggYpp{fXhMrU=APV_(B{+ z$Poy+2=HQo44YBCQmB-Lyx?L^B2Yuq1|bY5CnvL$d2GtK3PvytgE?H7%Y_&X$Yjye zxEa!$yap}ENE2by8fY!02kaJc6_rGbK*rPOA?OSW#Y@9_6MG;aHbLoNGj4zpHV4+} z>~Rffn`kBZuN$w_Hbq$sB&;M&RFaV(8FjBgFq6C26WJ9RZ-fy>EmIUcQAQC-I#N%| zWg?KdVXL)jp_)sgD3|bsNCYJz6jA#^0-O{;m>MTlI41Drar_4Dyb6!V{7|V_CKU(} z8G-~0BvJ`Kgo_CLkPyC1Dh(dQ%Jn81*AwI*x0d04ft9=#E0h{ZoTiLX6qPvG1(6zx zrc4^j07#|wstW*b1x{%7cHwM$p`OPrBaPa%q&mb%>41Su3$?HCf=}S8l^k>>L~?j2 zgkrcKq~Z|-gb*kbJ5QzJqCD^gUj2VF2s2K>_ICMC`wWVhp0saY4g+&|IZmXWnIR)H zEDrsD_x<(fAHP5Q?blzP{`}LAPaZ$|;rs8tefUjpPxpha`}b^}ckg_CyW>{-&981; zzjn3l%PW_^`24d^KWV*m@xu9!&z)^KbNbXrCr^BM{MgYWhd+4#(82ebn-1)Mci-N| zJq^2e?X0h>t=X}?dfV2j$}O8K%F9YiiZ>M%ZY;>p%iXX(Cp#-MBRwrOWu4VxPF|Zt zn~ZA=lwOyZuv)8GwUSg5Dm;G0@^|9iUKSe@y>v;`V&$U9h=qy;;q&ETp&`LCsYDzU zI8PMdFT@0XzI>F&MK~}U@|inlw)d==Gp2iip1`!JQzlQEIKgB5xVPRM>psTqjnS^7 zMvfTn;ylc0sN)a^7R&SZp)C9Iv48BZ0L!^QW2Cdh;EZA3-tz(jr_RSmPFf^#bQ?Z= z!h{&we{GWIbcqNA63h@}j2ye%bJ8T-;0UgE)DLq=8J6ffbQUtv*$q&-#--`vH5TFw zIuQdoW1^fq!h<}PxbRRhA3GoI>M?nSobTZRi|6vauZ@e6DpokCgIwmW68Ly4qaVf0 zZgI>QIyF>aYZ1$Gi(UMMF%B&)!-kA?7epEENiG%7Rk>6l?(tdWtRQ7;$)V89+|diX zBMna)d!{*CYZ7r=S+xqLxucy%IF$ggZZ0hUe*iExzFYtR diff --git a/modules/wkfooteraboutblock/logo.png b/modules/wkfooteraboutblock/logo.png deleted file mode 100644 index a0ab2968a35c9b69ec669b1b2f415bb7c7f35b22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1164 zcmV;71atd|P)R5shUcgj6aQ_Pob7a zm!(vuhdYRpMU#6le0eW-M3HVaZ)qiJWH4oOH*|6= za&RhfZ7*(WENf>fXlyKOgFu9KGIwPrW`90_<i6w_-_qb2%4PV)R`cbXeF~M-KlO!VS<+Oq4!_O6qe|GAU%>+c3vtAw8c!C3W~MbA6N+%97_&sHEPUwAi7J z2?eOLFz{i$Dbt#8!inLMe5)R<Z~xNOvE_`VyUyrQsxQimvqft+L5 z5Y2I=r0@?)9iqf}WYuI!mE?&T*%2eg?W@Zl+u%P1PINkitnGy zDU?!&S(JDKz&z)oIR%uL1S&}(Hb=>`28-s^|MKIK!h4iDL|Kli?M5SH6QG5HgECK{ zlsdG1wi=WKDv9vIvc;`fulvD|veljbg}g)VAw`tOMQA+$&dt+Jo%oLSW z&Dk`qE-w}{C{=Sd&Fc#$&?a0otbD2|Y(7ipJydbUK|(CLfSbNEh=W(|zLrQ3?nJs=ICI>J^;FDs&Z^Hpix^ z=43Ls{0+i6{8Cc;*P&g=T33rOM+{fejssDi#epCVo{tH4IM3g15BZLfFnFAR+dJ4X ews$)Rd;b80T?{7Pq1;9Q0000initUpgrade(); -} - -class UpgradeWkFooterAboutBlock104 -{ - public function __construct($module) - { - $this->module = $module; - } - - public function initUpgrade() - { - return $this->module->unregisterHook('displayFooterPaymentInfo'); - } -} diff --git a/modules/wkfooteraboutblock/views/css/index.php b/modules/wkfooteraboutblock/views/css/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/css/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css b/modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css deleted file mode 100644 index eed441b13..000000000 --- a/modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css +++ /dev/null @@ -1,25 +0,0 @@ -/** -* 2010-2018 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -.footer-about-hotel { - color: #BFBFBF; - font-size: 16px; - font-weight: 400; - line-height: 25px; -} \ No newline at end of file diff --git a/modules/wkfooteraboutblock/views/index.php b/modules/wkfooteraboutblock/views/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/views/templates/hook/index.php b/modules/wkfooteraboutblock/views/templates/hook/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/templates/hook/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl b/modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl deleted file mode 100644 index 8350b5b0e..000000000 --- a/modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{* -* 2010-2018 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*} - -
-
- - -
-
\ No newline at end of file diff --git a/modules/wkfooteraboutblock/views/templates/index.php b/modules/wkfooteraboutblock/views/templates/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/templates/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/wkfooteraboutblock.php b/modules/wkfooteraboutblock/wkfooteraboutblock.php deleted file mode 100644 index 42cde657a..000000000 --- a/modules/wkfooteraboutblock/wkfooteraboutblock.php +++ /dev/null @@ -1,62 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -if (!defined('_PS_VERSION_')) { - exit; -} - -class WkFooterAboutBlock extends Module -{ - public function __construct() - { - $this->name = 'wkfooteraboutblock'; - $this->tab = 'front_office_features'; - $this->version = '1.0.4'; - $this->author = 'Webkul'; - $this->need_instance = 0; - - $this->bootstrap = true; - parent::__construct(); - - $this->displayName = $this->l('Footer About Hotel Block'); - $this->description = $this->l('Show About Hotel block in footer.'); - $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); - } - - public function hookDisplayFooterMostLeftBlock($params) - { - $this->context->smarty->assign( - array('WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id)) - ); - - $this->context->controller->addCSS($this->_path.'/views/css/wkFooterAboutBlockFront.css'); - return $this->display(__FILE__, 'wkFooterAboutBlock.tpl'); - } - - public function install() - { - if (!parent::install() - || !$this->registerHook('displayFooterMostLeftBlock') - ) { - return false; - } - return true; - } -} diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl index 6a5aedbe0..e3f5bb273 100644 --- a/themes/hotel-reservation-theme/contact-form.tpl +++ b/themes/hotel-reservation-theme/contact-form.tpl @@ -159,7 +159,7 @@ {hook h='displayBeforeHotelBranchInformation'} {/block} {block name='contact_form_hotel_branches'} - {if isset($hotelsInfo) && $hotelsInfo} + {if isset($displayHotels) && $displayHotels && isset($hotelsInfo) && $hotelsInfo}
{l s='Our Hotels'} @@ -200,8 +200,8 @@ {hook h='displayAfterHotelBranchInformation'} {/block} {block name='contact_form_hotel_locations'} - {if isset($hotelLocationArray)} -
+ {if isset($displayHotelMap) && $displayHotelMap && isset($hotelLocationArray)} +
diff --git a/themes/hotel-reservation-theme/css/contact-form.css b/themes/hotel-reservation-theme/css/contact-form.css index 5ffae05e0..7e6ee9769 100644 --- a/themes/hotel-reservation-theme/css/contact-form.css +++ b/themes/hotel-reservation-theme/css/contact-form.css @@ -274,3 +274,9 @@ outline: none; color: #427fed; } +.margin-bottom-30 { + margin-bottom: 30px; +} +.margin-top-30 { + margin-top: 30px; +} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css index e97d787ca..979d70364 100644 --- a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css +++ b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css @@ -37,6 +37,11 @@ #user_info_acc span.caret { border-top-color: #fff; } +div.our_hotel_tab a{ + color: #fff; + font-size: 17px; + font-weight: 400;} + @media (max-width: 450px) { .hide_xs { display: none; } diff --git a/themes/hotel-reservation-theme/css/properties.css b/themes/hotel-reservation-theme/css/properties.css new file mode 100644 index 000000000..c96b81421 --- /dev/null +++ b/themes/hotel-reservation-theme/css/properties.css @@ -0,0 +1,286 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ + +.margin-top-50 { + margin-top: 50px; +} +.margin-bottom-30 { + margin-bottom: 30px; +} +.margin-bottom-20 { + margin-bottom: 20px; +} +.margin-top-20 { + margin-top: 20px; +} +.htl-contact-page { + padding: 10px; +} +.page-heading { + font-size: 32px; +} +.empty-properties-container{ + margin: 30px; +} +.htl-contact-page .contact-header { + font-size: 42px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300; + margin-bottom: 20px; +} +.htl-contact-page .contact-desc { + font-size: 16px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300; + margin-bottom: 20px; + line-height: 30px; +} +.htl-contact-page .contact-form-box { + padding: 30px; + border-radius: 4px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); +} +.htl-contact-page .contact-form-box .control-label { + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; +} +.htl-contact-page .contact-form-box .form-control, .htl-contact-page .uploader span.filename { + border: 1px solid rgba(0, 0, 0, 1); + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; +} +.htl-contact-page .uploader span.filename { + font-size: 12px; +} +.htl-contact-page .contact-form-box #contact_type { + width: 90%; + text-align: left; +} +.title-container { + margin-left: 150px; + margin-right: 150px; + color: #333333;} +.htl-contact-page .contact_type_ul { + font-size: 14px; + font-weight: 400; + top: 45px; + padding: 0px; + width: 100%; + border-bottom: 1px solid rgba(0, 0, 0, 1); + border-left: 1px solid rgba(0, 0, 0, 1); + border-right: 1px solid rgba(0, 0, 0, 1); + max-height: 145px; + overflow-y: auto; +} +.htl-contact-page .contact_type_ul li { + cursor: default; + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; + padding: 11px; +} +.htl-contact-page .contact_type_ul li:hover, .htl-contact-page .contact_type_ul li:focus, .htl-contact-page .contact_type_ul li:active { + background-color: #379bf0; + color: #FFFFFF; +} +.htl-contact-page .contact_btn { + font-size: 14px; + color: rgba(255, 255, 255, 1); + font-weight: 600; + text-transform: uppercase; + border-radius: 4px; + padding: 0 20px; +} +.htl-contact-page .global-address-header { + font-weight: 400; + font-size: 12px; + color: rgba(0, 0, 0, .6); + text-transform: uppercase; + margin-bottom: 5px; +} +.htl-contact-page .global-address-value { + font-weight: 400; + font-size: 14px; + margin-bottom: 10px; + color: rgba(0, 0, 0, 1); + line-height: 22px; +} +.htl-contact-page .htl-global-address-div { + padding: 20px; + border-radius: 4px; + margin-bottom: 10px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); +} +@media screen and (min-width: 767px) { + .htl-contact-page .htl-global-address-div { + margin-top: 60px; + } +} +.htl-contact-page .hotels-container { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; +} +.hotels-container .hotel-header { + margin-bottom: 40px; + text-align: center; +} +.hotels-container .hotel-header>span { + font-size: 30px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + border-bottom: 1px solid rgba(0, 0, 0, 1); +} +.htl-contact-page span.action { + background:#379bf0!important; +} +.htl-contact-page .hotel-address-container { + border-radius: 4px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); + float: left; + padding: 15px 0px; + width: 100%; +} +.htl-contact-page .hotel-city-container>span { + font-size: 20px; + font-weight: 400; + color: rgba(0, 0, 0, 1); +} +.hotel-address-container .hotel-name { + font-size: 18px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + margin-bottom: 15px; +} +.hotel-address-container span.htl-address-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); +} +.hotel-address-container img.htl-img { + border-radius: 6px; +} +.empty-properties-image-container { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/no-hotel.png) ; + background-repeat:no-repeat; + background-position: center center; + padding: 200px 0px 10px 0px; + display: block; +} +.hotel-address-container span.htl-phone-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 15px 0px 2px; + background-position: 37px; + margin-right: 5px; + font-size: 14px; +} +.hotel-address-container span.htl-email-icon { + padding: 1px 10px 1px; + background-position: 19px; + margin-right: 5px; +} +.htl-contact-page .hotel-city-container { + margin-bottom: 10px; +} +span.htl-map-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 20px 0px 0px; + background-position: 0px 0px; + margin-right: 5px; + font-size: 14px; +} +.view_rooms_btn, .htl-map-direction-btn { + border-radius: 4px; + padding: 10px 12px; + text-transform: uppercase; +} + +.htl-map-direction-btn{ + background-color: #DEDEDE; + color: #333333; +} +.view_rooms_btn { + background-color: #1292FF; + border-color: #1292FF; + font-weight: 600; +} +.view_rooms_btn:hover { + background-color: #3c89cb; + border-color: #3a75a7; +} +.pagination-container { + text-align: center; +} +.hotel-branch-info-actions{ + display: flex; + gap: 10px; +} +.pagination-container .pagination > li > a, .pagination-container .pagination > li > span { + border: unset; +} +.pagination-container .pagination > li .active { + border: 1px solid #333333; + border-radius: 12px; + z-index: 10; +} +.hotel-address-container p.hotel-branch-info-value { + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; + line-height: 25px; +} +.hotel-address-container .htl-map-direction-btn span { + font-size: 12px; + color: rgba(0, 0, 0, 1); + font-weight: 400; +} +/* ==== google map ==== */ +#googleMapWrapper { + clear: both; + height: 500px; +} +#map { + width: 100%; + height: 100%; +} + +#map .view-link { + padding-top: 4px; +} + +.gm-btn-get-directions { + text-decoration: none; + color: #427fed; + font-weight: bold; +} + +.gm-btn-get-directions:hover { + text-decoration: underline; + color: #427fed; +} + +.gm-btn-get-directions:focus { + outline: none; + color: #427fed; +} diff --git a/themes/hotel-reservation-theme/js/properties.js b/themes/hotel-reservation-theme/js/properties.js new file mode 100644 index 000000000..c48b6944d --- /dev/null +++ b/themes/hotel-reservation-theme/js/properties.js @@ -0,0 +1,85 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ + +$(document).ready(function() { + + //By Webkul JS for Map locations of the hotels on google Map + if (typeof hotelLocationArray != 'undefined' + && $('#map').length + && typeof google == 'object' + && typeof google.maps == 'object' + ) { + initMap(); + } +}); + +function initMap() { + var map; + var bounds = new google.maps.LatLngBounds(); + hotelLocationArray = JSON.parse(hotelLocationArray); + + // Display a map on the page + map = new google.maps.Map(document.getElementById("map")); + google.maps.event.trigger(map, 'resize'); + + map.setTilt(45); + + // Display multiple markers on a map + var infoWindow = new google.maps.InfoWindow(); + var marker; + var i; + + $.each(hotelLocationArray, function(i, location) { + var position = new google.maps.LatLng(location.latitude, location.longitude); + bounds.extend(position); + marker = new google.maps.Marker({ + position: position, + map: map, + title: location.hotel_name, + animation: google.maps.Animation.DROP, + icon: PS_STORES_ICON + }); + + // Allow each marker to have an info window + google.maps.event.addListener(marker, 'click', (function(marker, i) { + return function() { + var directionsLink = 'https://www.google.com/maps/dir/?api=1&destination='+ + location.latitude+','+location.longitude; + var content = '
'+location.hotel_name+'
'+ + location.map_formated_address+ + ''; + infoWindow.setContent(content); + infoWindow.open(map, marker); + } + })(marker, i)); + + // Automatically center the map fitting all markers on the screen + map.fitBounds(bounds); + }); + + // Override our map zoom level once our fitBounds function runs (Make sure it only runs once) + var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) { + // this.setZoom(8); + google.maps.event.removeListener(boundsListener); + }); +} diff --git a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl index aaa993549..746c4b0b4 100644 --- a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl +++ b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl @@ -31,21 +31,26 @@ - {else} - - {l s='Sign in' mod='blockuserinfo'} - - + {else} + + {l s='Sign in' mod='blockuserinfo'} + + {/if} {if !isset($ajaxCustomerLogin)}
+ {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} + + {/if} {/if} {/block} diff --git a/themes/hotel-reservation-theme/properties.tpl b/themes/hotel-reservation-theme/properties.tpl new file mode 100644 index 000000000..12ade303e --- /dev/null +++ b/themes/hotel-reservation-theme/properties.tpl @@ -0,0 +1,128 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*} + +{block name='our_properties'} +{capture name=path}{l s='Our Properties'}{/capture} + {if isset($hotelsInfo) && $hotelsInfo} + {block name='our_properties_list_title'} +
+

{l s='Our Hotels'}

+
+

{$WK_HTL_SHORT_DESC|escape:'html':'UTF-8'}

+
+
+ {/block} + + {block name='displayPropertiesLocationBefore'} + {hook h='displayPropertiesLocationBefore'} + {/block} + + {block name='our_properties_location'} + {if isset($hotelLocationArray) && $hotelLocationArray && isset($displayHotelMap) && $displayHotelMap} +
+
+
+
+
+ {/if} +
+ {/block} + + {block name='displayPropertiesLocationAfter'} + {hook h='displayPropertiesLocationAfter'} + {/block} + + {block name='displayPropertiesListBefore'} + {hook h='displayPropertiesListBefore'} + {/block} + +
+ {block name='our_properties_list'} +
+ {foreach $hotelsInfo as $hotel} +
+
+
+ +
+
+

{$hotel['hotel_name']}

+

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

+

+ {$hotel['phone']} +

+

+ {$hotel['email']} +

+
+ {l s='View Rooms'} + {if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap} + {l s='View on map'} + {/if} +
+
+
+
+ {/foreach} +
+ {/block} + + {block name='displayPropertiesListAfter'} + {hook h='displayPropertiesListAfter'} + {/block} + + {if (isset($pageLimit)) && $pageLimit > 1} + + + +
+
    + {if !isset($pagination[1])} +
  • 1
  • + {if !isset($pagination[2])} +
  • ...
  • + {/if} + {/if} + {foreach $pagination as $page} +
  • {$page}
  • + {/foreach} + {if !isset($pagination[$pageLimit])} + {if !isset($pagination[$pageLimit-1])} +
  • ...
  • + {/if} +
  • {$pageLimit}
  • + {/if} +
+
+ {/if} +
+ {else} +
+
+
+
+
+

{l s='No Hotel Found!!'}

+
+
+ {/if} +{/block} From 9919c1cd5fb34763695c1482304dca77ae5251a2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 21 Apr 2025 13:06:44 +0530 Subject: [PATCH 064/143] Fixed: Issue during installation, and assigned missing variables in the smarty --- controllers/front/PropertiesController.php | 1 + .../blocknavigationmenu/classes/WkCustomNavigationLink.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/front/PropertiesController.php b/controllers/front/PropertiesController.php index 17bd1e291..6736c9ac7 100644 --- a/controllers/front/PropertiesController.php +++ b/controllers/front/PropertiesController.php @@ -132,6 +132,7 @@ class PropertiesControllerCore extends FrontController 'hotelLocationArray' => $hotelLocationArray, 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), 'displayHotelMap' => $displayHotelMap, + 'WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id), 'currentIndex' => $this->context->link->getPageLink('properties') ) ); diff --git a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php index deca3d60d..5346c4320 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -169,12 +169,14 @@ class WkCustomNavigationLink extends ObjectModel $objCustomNavigationLink->name[$language['id_lang']] = 'Our hotels'; } + $https_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; + $objLink = new Link($https_link, $https_link); $objCustomNavigationLink->position = $this->getHigherPosition(); $objCustomNavigationLink->id_cms = 0; $objCustomNavigationLink->show_at_navigation = 1; $objCustomNavigationLink->show_at_footer = 0; $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->link = Context::getContext()->link->getPageLink('properties'); + $objCustomNavigationLink->link = $objLink->getPageLink('properties'); $objCustomNavigationLink->is_custom_link = 1; $objCustomNavigationLink->save(); From 9fc3ab77c0d75d87c8a9e8ab59d93fdb56eae86d Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 22 Apr 2025 12:16:21 +0530 Subject: [PATCH 065/143] Added new hook in the configuration.tpl to add new cols in the rooms configuration table --- .../default/template/controllers/products/configuration.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 21e63328b..ffdeb356b 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -63,6 +63,7 @@ + {hook h='displayAddColumnInRoomList'} {l s='--'} @@ -99,6 +100,7 @@ + {hook h='displayAddRowInRoomList' item=$key id_room=$room_info['id']} {if isset($room_info['id'])} {if $room_info['booked_dates']} @@ -139,6 +141,7 @@ + {hook h='displayAddRowInRoomList' item=$k} {if $k == 1} @@ -417,6 +420,7 @@ html += ''; html += ''; html += ''; + html += '' + '{hook h='displayAddRowInRoomList'}'; html += ''; html += ''; html += ''; @@ -1319,4 +1323,4 @@ } }); - \ No newline at end of file + From cfa0969762e626248e4c834147221e41b117afee Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 22 Apr 2025 15:45:28 +0530 Subject: [PATCH 066/143] Added server side validation to the booking dates updation from admin orders --- controllers/admin/AdminOrdersController.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 7c9542518..7f20f22a8 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -5785,8 +5785,8 @@ class AdminOrdersControllerCore extends AdminController // If order is refunded, the validate changes which are not allowed $objOrderReturn = new OrderReturn(); $refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($order->id, 0, 1); + $objBookingDetail = new HotelBookingDetail($id_hotel_booking); if ($refundReqBookings && (in_array($id_hotel_booking, $refundReqBookings))) { - $objBookingDetail = new HotelBookingDetail($id_hotel_booking); // If order is cancelled, we can't edit order if ($objBookingDetail->is_refunded && $objBookingDetail->is_cancelled) { die(json_encode(array( @@ -5804,6 +5804,22 @@ class AdminOrdersControllerCore extends AdminController } } + if ($objBookingDetail->id_status != HotelBookingDetail::STATUS_ALLOTED + && strtotime($old_date_from) != strtotime($new_date_from) + ) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('You cannot update the start date for a booking that has already been checked in.'), + ))); + } else if ($objBookingDetail->id_status == HotelBookingDetail::STATUS_CHECKED_OUT + && strtotime($old_date_to) != strtotime($new_date_to) + ) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('You cannot update the end date for a booking that has already been checked out.'), + ))); + } + if (!Validate::isPrice($product_price_tax_incl) || !Validate::isPrice($product_price_tax_excl)) { die(json_encode(array( 'result' => false, From fba44a298af05ffcc5f31aea54775b3097d2d903 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 23 Apr 2025 13:17:08 +0530 Subject: [PATCH 067/143] Added: Module and core upgrade Files for version 1.6.1 --- .../php/add_order_detail_meta_page_161.php | 105 ++++++++++++++++++ .../php/clean_product_description_161.php | 39 +++++++ .../php/update_order_payment_type_160.php | 51 +++++++++ .../upgrade/php/update_order_states_161.php | 67 +++++++++++ install/upgrade/php/update_tabs_161.php | 58 ++++++++++ install/upgrade/sql/1.6.1.0.sql | 65 +++++++++++ .../upgrade/upgrade-1.1.3.php | 46 ++++++++ modules/blocknewsletter/upgrade/index.php | 32 ++++++ .../blocknewsletter/upgrade/upgrade-2.3.0.php | 87 +++++++++++++++ .../upgrade/upgrade-1.6.0.php | 78 +++++++++++++ modules/qlohotelreview/upgrade/index.php | 32 ++++++ .../qlohotelreview/upgrade/upgrade-1.0.1.php | 44 ++++++++ modules/wkhotelroom/upgrade/upgrade-1.1.9.php | 44 ++++++++ 13 files changed, 748 insertions(+) create mode 100644 install/upgrade/php/add_order_detail_meta_page_161.php create mode 100644 install/upgrade/php/clean_product_description_161.php create mode 100644 install/upgrade/php/update_order_payment_type_160.php create mode 100644 install/upgrade/php/update_order_states_161.php create mode 100644 install/upgrade/php/update_tabs_161.php create mode 100644 install/upgrade/sql/1.6.1.0.sql create mode 100644 modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php create mode 100644 modules/blocknewsletter/upgrade/index.php create mode 100644 modules/blocknewsletter/upgrade/upgrade-2.3.0.php create mode 100644 modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php create mode 100644 modules/qlohotelreview/upgrade/index.php create mode 100644 modules/qlohotelreview/upgrade/upgrade-1.0.1.php create mode 100644 modules/wkhotelroom/upgrade/upgrade-1.1.9.php diff --git a/install/upgrade/php/add_order_detail_meta_page_161.php b/install/upgrade/php/add_order_detail_meta_page_161.php new file mode 100644 index 000000000..c07b903cf --- /dev/null +++ b/install/upgrade/php/add_order_detail_meta_page_161.php @@ -0,0 +1,105 @@ +getValue(' + SELECT id_meta + FROM `'._DB_PREFIX_.'meta` m + WHERE m.`page` = "order-detail"') + ) { + // meta + Db::getInstance()->insert( + 'meta', + array( + 'page' => 'order-detail', + 'configurable' => 1, + ) + ); + if ($last_id = Db::getInstance()->Insert_ID()) { + // meta lang + $pageDetail = array( + 'en' => array( + 'title' => 'Booking details', + 'url_rewrite' => 'order-detail' + ), + 'fr' => array( + 'title' => 'Détails de réservation', + 'url_rewrite' => 'details-de-reservation' + ) + ); + if ($languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `'._DB_PREFIX_.'lang`')) { + $row = array(); + foreach ($languages as $lang) { + if (in_array(strtolower($lang['iso_code']), array_keys($pageDetail))) { + $row[] = array( + 'id_meta' => (int)$last_id, + 'id_shop' => 1, + 'id_lang' => (int)$lang['id_lang'], + 'title' => $pageDetail[strtolower($lang['iso_code'])]['title'], + 'description' => '', + 'keywords' => '', + 'url_rewrite' => $pageDetail[strtolower($lang['iso_code'])]['url_rewrite'] + ); + } else { + $row[] = array( + 'id_meta' => (int)$last_id, + 'id_shop' => 1, + 'id_lang' => (int)$lang['id_lang'], + 'title' => $pageDetail['en']['title'], + 'description' => '', + 'keywords' => '', + 'url_rewrite' => $pageDetail['en']['url_rewrite'] + ); + } + } + Db::getInstance()->insert( + 'meta_lang', + $row + ); + } + + // meta themes + $row = array(); + if ($themes = Db::getInstance()->executeS('SELECT id_theme FROM `'._DB_PREFIX_.'theme`')) { + foreach ($themes as $theme) { + $row[] = array( + 'id_theme' => (int)$theme, + 'id_meta' => (int)$last_id, + 'left_column' => 0, + 'right_column' => 0 + ); + } + Db::getInstance()->insert( + 'theme_meta', + $row + ); + } + + return true; + } else { + return false; + } + } +} diff --git a/install/upgrade/php/clean_product_description_161.php b/install/upgrade/php/clean_product_description_161.php new file mode 100644 index 000000000..4bc0c9ce6 --- /dev/null +++ b/install/upgrade/php/clean_product_description_161.php @@ -0,0 +1,39 @@ +executeS( + 'SELECT `id_product`, `id_lang`, `description_short` FROM `'._DB_PREFIX_.'product_lang`' + )) { + $sql = 'UPDATE `'._DB_PREFIX_.'product_lang` + SET description_short = CASE'; + foreach ($descriptions as $description) { + $sql .= ' WHEN id_product = '.(int)$description['id_product'].' AND id_lang = '.(int)$description['id_lang'].' + THEN "'.pSQL(Tools::getDescriptionClean($description['description_short'])).'"'; + } + $sql .= ' END'; + Db::getInstance()->execute($sql); + } + +} \ No newline at end of file diff --git a/install/upgrade/php/update_order_payment_type_160.php b/install/upgrade/php/update_order_payment_type_160.php new file mode 100644 index 000000000..102546a00 --- /dev/null +++ b/install/upgrade/php/update_order_payment_type_160.php @@ -0,0 +1,51 @@ +executeS( + 'SELECT `id_order`, `module` FROM `'._DB_PREFIX_.'orders`' + )) { + $sql = 'UPDATE `'._DB_PREFIX_.'orders` + SET payment_type = CASE'; + $modulePaymentType = array(); + foreach ($orders as &$order) { + if (!isset($modulePaymentType[$order['module']])) { + $module = Module::getInstanceByName($order['module']); + if ($module instanceof Module && $module->payment_type) { + $modulePaymentType[$order['module']] = $module->payment_type; + } else { + $modulePaymentType[$order['module']] = 1; + } + } + $sql .= ' WHEN id_order = '.(int)$order['id_order'].' THEN '.(int)$modulePaymentType[$order['module']]; + } + $sql .= ' END WHERE id_order IN ('.pSQL(implode(', ', array_column($orders, 'id_order'))).')'; + Db::getInstance()->execute($sql); + } + Db::getInstance()->execute( + 'UPDATE `'._DB_PREFIX_.'order_payment` op + INNER JOIN `'._DB_PREFIX_.'orders` o ON (op.`order_reference` = o.`reference`) + SET op.`payment_type` = o.`payment_type`' + ); +} \ No newline at end of file diff --git a/install/upgrade/php/update_order_states_161.php b/install/upgrade/php/update_order_states_161.php new file mode 100644 index 000000000..97667c26f --- /dev/null +++ b/install/upgrade/php/update_order_states_161.php @@ -0,0 +1,67 @@ + 0, + 'send_email' => 0, + 'color' => '#FF69B4', + 'unremovable' => 1, + 'hidden' => 0, + 'logable' => 0, + 'delivery' => 0, + 'shipped' => 0, + 'paid' => 0, + 'pdf_delivery' => 0, + 'pdf_invoice' => 0, + 'deleted' => 0 + ); + Db::getInstance()->insert('order_state', $data); + if ($last_id = Db::getInstance()->Insert_ID()) { + if ($languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `'._DB_PREFIX_.'lang`')) { + $row = array(); + foreach ($languages as $lang) { + $row[] = array( + 'id_order_state' => (int)$last_id, + 'id_lang' => (int)$lang['id_lang'], + 'name' => 'Overbooking (Partial payment)', + 'template' => '', + ); + } + Db::getInstance()->insert( + 'order_state_lang', + $row + ); + } + if (file_exists(dirname(__FILE__).'/../../data/img/os/Overbooking_partial_paid.gif')) { + copy(dirname(__FILE__).'/../../data/img/os/Overbooking_partial_paid.gif', _PS_ROOT_DIR_.'/img/os/'.$last_id.'.gif'); + } + Db::getInstance()->insert('configuration',[ + 'name' => 'PS_OS_OVERBOOKING_PARTIAL_PAID', + 'value' => $last_id, + 'date_add' => date('Y-m-d H:i:s'), + 'date_upd' => date('Y-m-d H:i:s') + ]); + } +} \ No newline at end of file diff --git a/install/upgrade/php/update_tabs_161.php b/install/upgrade/php/update_tabs_161.php new file mode 100644 index 000000000..0fbd7331c --- /dev/null +++ b/install/upgrade/php/update_tabs_161.php @@ -0,0 +1,58 @@ +delete('tab', 'id_tab IN ('.implode(', ', $ids).')'); + Db::getInstance()->delete('tab_lang', 'id_tab IN ('.implode(', ', $ids).')'); + } + + // remove id parent of stats tab + $idAdminStats = get_tab_id('AdminStats'); + $position = Db::getInstance()->getValue('SELECT MAX(`position`) FROM `'._DB_PREFIX_.'tab` WHERE `id_parent` = 0'); + Db::getInstance()->update('tab', array('id_parent' => 0, 'position' => ($position + 1)), '`id_tab` = '.$idAdminStats); +} + +function get_tab_id($class_name) +{ + static $cache = array(); + + if (!isset($cache[$class_name])) { + $cache[$class_name] = Db::getInstance()->getValue('SELECT id_tab FROM '._DB_PREFIX_.'tab WHERE class_name = \''.pSQL($class_name).'\''); + } + return $cache[$class_name]; +} \ No newline at end of file diff --git a/install/upgrade/sql/1.6.1.0.sql b/install/upgrade/sql/1.6.1.0.sql new file mode 100644 index 000000000..9d3cf32d9 --- /dev/null +++ b/install/upgrade/sql/1.6.1.0.sql @@ -0,0 +1,65 @@ +SET NAMES 'utf8'; + +INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES + ('PS_ALLOW_EMP', '0', NOW(), NOW()), + ('PS_ALLOW_EMP_MAX_ATTEMPTS', '0', NOW(), NOW()), + ('PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS', '30', NOW(), NOW()), + ('PS_ORDER_LIST_PRICE_DISPLAY_CURRENCY', '1', NOW(), NOW()), + ('PS_OVERBOOKING_ORDER_ACTION', '1', NOW(), NOW()), + ('PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY', '2', NOW(), NOW()), + + ('PS_CUSTOMER_BIRTHDATE', '1', NOW(), NOW()), + + ('PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS', '5', NOW(), NOW()), + ('PS_KPI_REVPAC_NB_DAYS', '30', NOW(), NOW()), + ('PS_KPI_CONVERSION_RATE_NB_DAYS', '30', NOW(), NOW()), + ('PS_ORDER_KPI_AVG_ORDER_VALUE_NB_DAYS', '30', NOW(), NOW()), + ('PS_ORDER_KPI_PER_VISITOR_PROFIT_NB_DAYS', '30', NOW(), NOW()), + ('PS_KPI_NEW_CUSTOMERS_NB_DAYS', '30', NOW(), NOW()), + + ('PS_BACKDATE_ORDER_SUPERADMIN', '1', NOW(), NOW()), + ('PS_BACKDATE_ORDER_EMPLOYEES', '0', NOW(), NOW()); + +UPDATE `PREFIX_configuration` +set `value` = 1 +WHERE `name` = 'PS_TAX_DISPLAY'; + +UPDATE `PREFIX_configuration` +set `value` = 'id_address_invoice' +WHERE `name` = 'PS_TAX_ADDRESS_TYPE'; + + +UPDATE `PREFIX_configuration` +set `value` = STR_TO_DATE(`value`, '%d-%m-%Y') +WHERE `name` = 'MAX_GLOBAL_BOOKING_DATE'; + +UPDATE `PREFIX_product` +set `show_at_front` = 1 +WHERE `booking_product` = 1; +UPDATE `PREFIX_product_shop` ps +INNER JOIN `PREFIX_product` p on(ps.`id_product` = p.`id_product`) +set ps.`show_at_front` = 1 +WHERE p.`booking_product` = 1; + +INSERT INTO `PREFIX_cart_customer_guest_detail` +(`phone`, `id_gender`, `firstname`, `lastname`, `email`, `id_cart`, `date_add`, `date_upd`) +SELECT + IF(a.phone_mobile IS NOT NULL AND a.phone_mobile != '', a.phone_mobile, a.phone) AS phone, + c.id_gender, c.firstname, c.lastname, c.email, 0 AS id_cart, + NOW() AS date_add, NOW() AS date_upd +FROM + `PREFIX_address` a +INNER JOIN + `PREFIX_customer` c ON a.`id_customer` = c.`id_customer` +WHERE + a.`auto_generated` = 0 +GROUP BY + c.`id_customer`; + + + +/* PHP:add_order_detail_meta_page_161(); */; +/* PHP:clean_product_description_161(); */; +/* PHP:update_tabs_161(); */; +/* PHP:update_order_states_161(); */; + diff --git a/modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php b/modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php new file mode 100644 index 000000000..8d227a83e --- /dev/null +++ b/modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php @@ -0,0 +1,46 @@ +initUpgrade(); +} + +class upgradeBlockNavigationMenu113 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + return ($this->module->registerHook('actionObjectCMSUpdateAfter') + && $this->module->registerHook('actionObjectCMSDeleteAfter')); + + } +} diff --git a/modules/blocknewsletter/upgrade/index.php b/modules/blocknewsletter/upgrade/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/blocknewsletter/upgrade/index.php @@ -0,0 +1,32 @@ +registerHooks() + || !$objUpgrade->callInstallTab() + ) { + return false; + } + + return true; +} + +class upgradeBlocknewsletter230 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function registerHooks() + { + if (!$this->module->registerHook('actionObjectCustomerUpdateBefore') + || !$this->module->registerHook('actionCustomerCartRulesModifier') + || !$this->module->registerHook('actionValidateCartRule') + || !$this->module->registerHook('actionObjectCustomerDeleteAfter') + ) { + return false; + } + + return true; + } + + public function callInstallTab() + { + $result = $this->installTab('AdminParentNewsletter', 'Newsletter', false, true); + $result &= $this->installTab('AdminNewsletter', 'Configuration', 'AdminParentNewsletter', true); + + return $result; + } + + public function installTab($className, $tabName, $tabParentName = false, $hidden = false) + { + $tab = new Tab(); + $tab->active = 1; + $tab->class_name = $className; + $tab->name = array(); + foreach (Language::getLanguages(false) as $lang) { + $tab->name[$lang['id_lang']] = $tabName; + } + if ($tabParentName) { + $tab->id_parent = (int) Tab::getIdFromClassName($tabParentName); + } elseif ($hidden) { + $tab->id_parent = -1; + } else { + $tab->id_parent = 0; + } + $tab->module = $this->module->name; + + return $tab->add(); + } +} diff --git a/modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php b/modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php new file mode 100644 index 000000000..ab51aec40 --- /dev/null +++ b/modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php @@ -0,0 +1,78 @@ +initUpgrade(); +} + +class UpgradeHotelreservationSystem160 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + if (!$this->updateTabs() + || !$this->updateDefaultConfiguration() + || !$this->updateHooks() + + ) { + return false; + } + return true; + } + + public function updateHooks() + { + if (!$this->module->registerHook('actionFrontControllerSetMedia') + || !$this->module->registerHook('displayNav') + || !$this->module->registerHook('displayExternalNavigationHook') + ) { + return false; + } + + return true; + } + + public function updateTabs() + { + $id_tab = Tab::getIdFromClassName('AdminAssignHotelFeatures'); + $objTab = new Tab($id_tab); + return $objTab->delete(); + } + + public function updateDefaultConfiguration() + { + Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', Configuration::get('WK_HOTEL_GLOBAL_CONTACT_NUMBER')); + Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', Configuration::get('WK_HOTEL_GLOBAL_CONTACT_EMAIL')); + + return true; + } +} diff --git a/modules/qlohotelreview/upgrade/index.php b/modules/qlohotelreview/upgrade/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qlohotelreview/upgrade/index.php @@ -0,0 +1,32 @@ +initUpgrade(); +} + +class UpgradeQloHotelReview101 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + return $this->module->registerHook('actionCleanData'); + } +} diff --git a/modules/wkhotelroom/upgrade/upgrade-1.1.9.php b/modules/wkhotelroom/upgrade/upgrade-1.1.9.php new file mode 100644 index 000000000..f259c5e85 --- /dev/null +++ b/modules/wkhotelroom/upgrade/upgrade-1.1.9.php @@ -0,0 +1,44 @@ +initUpgrade(); +} + +class UpgradeWkHotelRoom119 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + return $this->module->registerHook('actionCleanData'); + } +} From 5b6946b8a9ccb9edb649cc93b994be817a551630 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 23 Apr 2025 14:43:25 +0530 Subject: [PATCH 068/143] Added new hooks in room_type_list.tpl --- themes/hotel-reservation-theme/_partials/room_type_list.tpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 6f9dc568e..f32614fc8 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -134,4 +134,9 @@
{l s='No room available for this hotel!'}
+ {hook h='displayAfterNoRoomAvailableBlock'} {/if} + +{block name='displayRoomTypeListAfter'} + {hook h='displayRoomTypeListAfter'} +{/block} From 5eec321f1cee949c7c12c6bd356231d99e205f70 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 23 Apr 2025 16:07:37 +0530 Subject: [PATCH 069/143] Fixed: the price stays the same for the booking if admin selects a customer with a group discount and then refreshes the page --- classes/Cart.php | 2 -- controllers/admin/AdminOrdersController.php | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index 1444a2aad..e826b3f97 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -635,8 +635,6 @@ class CartCore extends ObjectModel return array(); } - $customer = new Customer($this->id_customer); - Context::getContext()->customer = $customer; $cart_shop_context = Context::getContext()->cloneContext(); foreach ($result as &$row) { diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 90593bfbc..cad0ddada 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1680,6 +1680,8 @@ class AdminOrdersControllerCore extends AdminController $this->context->cart = $objCart; $this->context->currency = new Currency((int)$objCart->id_currency); + // Setting the customer in context to get the order total with the group discount. + $this->context->customer = new Customer($objCart->id_customer); $this->errors = HotelCartBookingData::validateCartBookings(); $orderTotal = $objCart->getOrderTotal(true, Cart::BOTH); if ($objCart->is_advance_payment) { From 33a5a3d1c7b1600f4c8c62454fc857751bbabf23 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 23 Apr 2025 18:14:57 +0530 Subject: [PATCH 070/143] Fixed: issues with room short description if max character limit is added --- controllers/admin/AdminNormalProductsController.php | 5 ++--- controllers/admin/AdminProductsController.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 67d94513e..a69d7eb96 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -1408,8 +1408,7 @@ class AdminNormalProductsControllerCore extends AdminController 'ajaxfileupload', 'date', 'tagify', - 'select2', - 'validate' + 'select2' )); $this->addJS(array( @@ -2168,7 +2167,7 @@ class AdminNormalProductsControllerCore extends AdminController if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang']))) { if (Tools::strlen(strip_tags($value)) > $limit) { $this->errors[] = sprintf( - Tools::displayError('This %1$s field (%2$s) is too long: %3$d chars max (current count %4$d).'), + Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'), call_user_func(array($className, 'displayFieldName'), 'description_short'), $language['name'], $limit, diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index c5ab481e3..52ab956e8 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1503,8 +1503,7 @@ class AdminProductsControllerCore extends AdminController 'ajaxfileupload', 'date', 'tagify', - 'select2', - 'validate' + 'select2' )); $this->addJS(array( @@ -2180,7 +2179,7 @@ class AdminProductsControllerCore extends AdminController if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang']))) { if (Tools::strlen(strip_tags($value)) > $limit) { $this->errors[] = sprintf( - Tools::displayError('This %1$s field (%2$s) is too long: %3$d chars max (current count %4$d).'), + Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'), call_user_func(array($className, 'displayFieldName'), 'description_short'), $language['name'], $limit, From 3b1eefa08d34f147ad2c8ae08b382743171d5b1a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 24 Apr 2025 11:53:56 +0530 Subject: [PATCH 071/143] Fixed: extra room is created if used bulk create feature --- controllers/admin/AdminProductsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 4bd95e210..9046c2508 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5391,7 +5391,7 @@ class AdminProductsControllerCore extends AdminController $roomsInfo['prefix'] = $prefix; } - for ($i = 0; $i <= $roomQuantity; $i++) { + for ($i = 0; $i < $roomQuantity; $i++) { $roomNum = $roomsInfo['prefix']; if ((int) $roomNumber) { $roomNum .= '-'.($roomNumber + $i); From ca3d64317c9a6523933629b5f74b1a26f569f109 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Thu, 24 Apr 2025 15:32:22 +0530 Subject: [PATCH 072/143] resolved the placeholder issue --- .../wkroomsearchblock/views/js/wk-room-search-block.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index e18babcb7..c002751ce 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -136,8 +136,13 @@ const BookingSearchManager = { success: function(result) { if (result.status) { $('#hotel_cat_id').val(''); - $('#id_hotel_button').html(result.html_hotel_options); - $('#id_hotel_button').trigger('chosen:updated'); + if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) { + $('#id_hotel_button').focus() + } + else{ + $('#id_hotel_button').html(result.html_hotel_options); + $('#id_hotel_button').trigger('chosen:updated'); + } // Resetting the data from previously selected hotel $('#preparation_time').val(0); var max_order_date = $('#max_order_date').val(); From ff1371c23143c76c7a9075e5af394b3479f00a6a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 24 Apr 2025 15:48:11 +0530 Subject: [PATCH 073/143] Fixed: the text in the admin translation controller is not in correct language but if the selected language already exists --- controllers/admin/AdminTranslationsController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 6ccc5713c..350fcceeb 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -1966,6 +1966,7 @@ class AdminTranslationsControllerCore extends AdminController } + unset($GLOBALS[$name_var]); // count will contain the number of expressions of the page $count = 0; foreach ($tabs_array as $array) { From 3862b42796f0d499496e5a1e261b870b7a5ed008 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Thu, 24 Apr 2025 19:54:47 +0530 Subject: [PATCH 074/143] Issues on the product page have been resolved. --- .../wkroomsearchblock/views/js/wk-room-search-block.js | 10 +++------- .../views/templates/front/hotel-options.tpl | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index c002751ce..742c44c7d 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -136,13 +136,9 @@ const BookingSearchManager = { success: function(result) { if (result.status) { $('#hotel_cat_id').val(''); - if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) { - $('#id_hotel_button').focus() - } - else{ - $('#id_hotel_button').html(result.html_hotel_options); - $('#id_hotel_button').trigger('chosen:updated'); - } + $('#id_hotel_button').html(result.html_hotel_options); + $('#id_hotel_button').focus(); + $('#id_hotel_button').trigger('chosen:updated'); // Resetting the data from previously selected hotel $('#preparation_time').val(0); var max_order_date = $('#max_order_date').val(); diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl index 1c258d2c8..946dab890 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} - + {if isset($hotels_info) && is_array($hotels_info)} {foreach from=$hotels_info item=hotel_info}
{/foreach}
From abfadf76bf43138bdcbc5a4e40098c0a5e20e4f8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 25 Apr 2025 12:58:14 +0530 Subject: [PATCH 078/143] Added max char to the hotel short description textarea --- .../controllers/admin/AdminAddHotelController.php | 1 + .../views/templates/admin/add_hotel/helpers/form/form.tpl | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 09e879372..0065efa52 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -123,6 +123,7 @@ class AdminAddHotelController extends ModuleAdminController $smartyVars['currentLang'] = Language::getLanguage((int) $currentLangId); $smartyVars['defaultCurrency'] = Configuration::get('PS_CURRENCY_DEFAULT'); + $smartyVars['PS_SHORT_DESC_LIMIT'] = Configuration::get('PS_SHORT_DESC_LIMIT'); $countries = Country::getCountries($this->context->language->id, true); $smartyVars['country_var'] = $countries; diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 0a70e1433..68766826c 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -150,6 +150,7 @@
From 5b7f51a9181a09daccfd810cbdde2c3769e613cc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 25 Apr 2025 18:01:28 +0530 Subject: [PATCH 079/143] Added: Hotel address in the invoice, removed hotel column from the room type table --- classes/order/Order.php | 11 +++++++++++ classes/pdf/HTMLTemplateInvoice.php | 9 +++++++++ pdf/invoice.addresses-tab.tpl | 7 ++++++- pdf/invoice.product-tab.tpl | 8 +------- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/classes/order/Order.php b/classes/order/Order.php index d479ac256..8899d7ea2 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -2857,6 +2857,17 @@ class OrderCore extends ObjectModel return $result; } + /** + * Get the Hotel Id of the order + * @return int|bool Hotel Id of the order + */ + public function getOrderHotelId() + { + return Db::getInstance()->getValue( + 'SELECT `id_hotel` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `id_order` = '.(int) $this->id + ); + } + /** * @param bool $useTax: if true, total with tax, if false, total without tax * @param bool $withDiscounts: if true, total including discount, if false, total excluding discount diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index e2a82cbf0..4dbacf732 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -314,10 +314,18 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $service_product_data = array(); $room_extra_demands = array(); $room_additinal_services = array(); + $formattedHotelAddress = false; if (Module::isInstalled('hotelreservationsystem')) { $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + $objHotelBranchInfo = new HotelBranchInformation((int) $order_obj->getOrderHotelId()); + // since hotel address has same firstname and lastname we are going to remove the lastname + $invoiceAddressPatternRules['avoid'] = array('lastname'); + if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) { + $objHotelAddress = new Address((int) $idHotelAddress); + $formattedHotelAddress = AddressFormat::generateAddress($objHotelAddress, $invoiceAddressPatternRules, '
', ' '); + } $customer = new Customer($this->order->id_customer); if (!empty($order_details)) { @@ -591,6 +599,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate 'cart_rules' => $cart_rules, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, + 'hotel_address' => $formattedHotelAddress, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'display_product_images' => $display_product_images, diff --git a/pdf/invoice.addresses-tab.tpl b/pdf/invoice.addresses-tab.tpl index 0b743c4f0..fe6efc706 100644 --- a/pdf/invoice.addresses-tab.tpl +++ b/pdf/invoice.addresses-tab.tpl @@ -31,7 +31,12 @@ {$delivery_address} {/if} --> - + + {l s='Hotel Detail' pdf='true'}

+ {if $hotel_address} + {$hotel_address} + {/if} + {l s='Customer Detail' pdf='true'}

diff --git a/pdf/invoice.product-tab.tpl b/pdf/invoice.product-tab.tpl index d6721f5d9..ed6859cf6 100644 --- a/pdf/invoice.product-tab.tpl +++ b/pdf/invoice.product-tab.tpl @@ -27,14 +27,13 @@ - + {if $display_product_images} {/if} - {* {if isset($layout.before_discount)} @@ -62,11 +61,6 @@ {$data_v['name']}

- From a7d424484a8625c257d690a50a95ccfbf9e1ed8c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 25 Apr 2025 19:10:38 +0530 Subject: [PATCH 080/143] Fixed the language not loading properly --- classes/Translate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Translate.php b/classes/Translate.php index c2c8ccd08..5401aad78 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -57,7 +57,7 @@ class TranslateCore $iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')); } if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php')) { - include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); + include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); } } From 2dc5ca660ccb1d163c6d4e463f42c342d666717a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 28 Apr 2025 10:01:10 +0530 Subject: [PATCH 081/143] Fixed: hotel name in not shown properly in the invoice, in hotel detail --- classes/pdf/HTMLTemplateInvoice.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 4dbacf732..f0e889a56 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -317,13 +317,12 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $formattedHotelAddress = false; if (Module::isInstalled('hotelreservationsystem')) { $obj_htl_bk_dtl = new HotelBookingDetail(); - $obj_rm_type = new HotelRoomType(); $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); - $objHotelBranchInfo = new HotelBranchInformation((int) $order_obj->getOrderHotelId()); - // since hotel address has same firstname and lastname we are going to remove the lastname + $objHotelBranchInfo = new HotelBranchInformation((int) $order_obj->getOrderHotelId(), $this->context->language->id); $invoiceAddressPatternRules['avoid'] = array('lastname'); if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) { $objHotelAddress = new Address((int) $idHotelAddress); + $objHotelAddress->firstname = $objHotelBranchInfo->hotel_name; $formattedHotelAddress = AddressFormat::generateAddress($objHotelAddress, $invoiceAddressPatternRules, '
', ' '); } From 7ad61c5523a7f0c1b70ac35fe24cf97465bea686 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 28 Apr 2025 11:28:45 +0530 Subject: [PATCH 082/143] Fixed: The default address is removed from address list in address tab if admin edits the default address from order detail page in back office --- controllers/admin/AdminAddressesController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index afc8f587b..55d39db18 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -457,8 +457,6 @@ class AdminAddressesControllerCore extends AdminController ** we delete its id_address to force the creation of a new one */ if ((int)Tools::getValue('id_order')) { $this->_redirect = false; - // set deleted=1 as customer can have only one address and this address is for an order only - $_POST['deleted'] = 1; } // Check the requires fields which are settings in the BO From ada8d869486621060d9e017dd97bb7a9d384c474 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 28 Apr 2025 15:17:22 +0530 Subject: [PATCH 083/143] Optimized the design for guest selection process on checkout page in the front office --- .../hotel-reservation-theme/css/order-opc.css | 13 +++-- .../hotel-reservation-theme/js/order-opc.js | 58 ++++++++++--------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/themes/hotel-reservation-theme/css/order-opc.css b/themes/hotel-reservation-theme/css/order-opc.css index d32358148..9baa5a9a4 100644 --- a/themes/hotel-reservation-theme/css/order-opc.css +++ b/themes/hotel-reservation-theme/css/order-opc.css @@ -689,17 +689,18 @@ overflow-y: auto; max-height: 200px; background: #fff; - margin: 0; - margin-top: 2px; - font-size: 14px; z-index: 10; box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); position: absolute; width: 90%;} - +.customer_guest_detail_email_list{ + width: 92%;} .customer_guest_detail_li { - white-space: nowrap; - padding: 15px;} + display: block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 10px;} .customer_guest_detail_li.active { color: #fff; background-color: #379bf0;} diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index df1ea54ac..df3f26a0e 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -193,41 +193,47 @@ $(document).ready(function() let firstName = ''; let lastName = ''; let email = ''; + let target = false if ($(e.target).prop('id') == 'customer_guest_detail_firstname') { firstName = $('#customer_guest_detail_firstname').val() } else if ($(e.target).prop('id') == 'customer_guest_detail_lastname') { lastName = $('#customer_guest_detail_lastname').val() } else if ($(e.target).prop('id') == 'customer_guest_detail_email') { - email = $('#customer_guest_detail_email').val() + email = $('#customer_guest_detail_email').val(); } let targetElem = $(this); - customerGuestDetailAjax = $.ajax({ - type: 'POST', - url: orderOpcUrl, - async: false, - cache: false, - dataType : "json", - data: { - token : static_token, - ajax : true, - method : 'getCustomerGuestDetail', - firstname : firstName, - lastname : lastName, - email : email, - }, - success: function(data) { - if (data.status) { - let listElem = $('
    ').addClass('customer_guest_detail_ul'); - $.each(data.guestDetails, function(index, guestDetail) { - let itemElem = $('
  • ').addClass('customer_guest_detail_li').text(guestDetail.firstname + ' '+ guestDetail.lastname + ' ('+ guestDetail.email+')'); - $(itemElem).attr('data-guest_detail', JSON.stringify(guestDetail)); - $(listElem).append(itemElem); - }); - $(targetElem).closest('.form-group').append($(listElem).prop('outerHTML')); + if ($.trim($(targetElem).val()) != '') { + customerGuestDetailAjax = $.ajax({ + type: 'POST', + url: orderOpcUrl, + async: false, + cache: false, + dataType : "json", + data: { + token : static_token, + ajax : true, + method : 'getCustomerGuestDetail', + firstname : firstName, + lastname : lastName, + email : email, + }, + success: function(data) { + if (data.status) { + let listElem = $('
      ').addClass('customer_guest_detail_ul'); + $.each(data.guestDetails, function(index, guestDetail) { + let itemElem = $('
    • ').addClass('customer_guest_detail_li').text(guestDetail.firstname + ' '+ guestDetail.lastname + ' ('+ guestDetail.email+')'); + $(itemElem).attr('data-guest_detail', JSON.stringify(guestDetail)); + $(listElem).append(itemElem); + }); + if ($(targetElem).prop('id') == 'customer_guest_detail_email') { + $(listElem).addClass('customer_guest_detail_email_list'); + } + $(targetElem).closest('.form-group').append($(listElem).prop('outerHTML')); + } } - } - }); + }); + } }, 200); } }); From 58a66a441d69f9277bdcf45f2ed434c2d154fa82 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 28 Apr 2025 19:22:02 +0530 Subject: [PATCH 084/143] optimized the multiple price rules creation flow --- .../admin/AdminHotelFeaturePricesSettings.php | 392 +++++------------- .../views/js/HotelReservationAdmin.js | 22 + .../helpers/form/form.tpl | 63 ++- 3 files changed, 179 insertions(+), 298 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index a3b83fab1..d3f61a5cb 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -202,11 +202,6 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController { parent::initToolbar(); if (empty($this->display) || $this->display == 'list') { - $this->page_header_toolbar_btn['bulk_add'] = array( - 'href' => self::$currentIndex.'&bulkAdd'.$this->table.'&token='.$this->token, - 'desc' => $this->l('Bulk create rules'), - 'imgclass' => 'new' - ); $this->page_header_toolbar_btn['new'] = array( 'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token, 'desc' => $this->l('Add new rule'), @@ -216,34 +211,6 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $this->toolbar_btn = array(); } - public function initToolbarTitle() - { - parent::initToolbarTitle(); - if (Tools::isSubmit('bulkAdd'.$this->table)) { - $this->toolbar_title[] = $this->l('Bulk Create', null, null, false); - $this->addMetaTitle($this->l('Bulk Create', null, null, false)); - } - } - - public function initProcess() - { - parent::initProcess(); - if (Tools::isSubmit('bulkAdd'.$this->table)) { - self::$currentIndex = self::$currentIndex.'&bulkAdd'.$this->table.''; - $this->action = 'new'; - $this->display = 'add'; - } - - if (Tools::isSubmit('submitBulkAdd'.$this->table)) { - if ($this->tabAccess['add'] === '1') { - $this->action = 'bulkSave'; - $this->display = 'list'; - } else { - $this->errors[] = Tools::displayError('You do not have permission to add this.'); - } - } - } - public function renderList() { $this->addRowAction('edit'); @@ -281,15 +248,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $smartyVars['edit'] = 1; $smartyVars['feature_price_groups'] = $objFeaturePrice->getGroups($idFeaturePrice); - } - - $smartyVars['defaultcurrency_sign'] = $currencySign; - $smartyVars['date_from'] = $dateFrom; - $smartyVars['date_to'] = $dateTo; - $smartyVars['groups'] = Group::getGroups($this->context->language->id); - if (Tools::isSubmit('bulkAdd'.$this->table)) { - $this->submit_action = 'submitBulkAdd'.$this->table; - $smartyVars['bulk_add'] = true; + } else { $tree = new HelperTree('hotels-tree'); if ($treeData = HotelHelper::generateTreeData([ 'rootNode' => HotelHelper::NODE_HOTEL, @@ -313,12 +272,18 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $smartyVars['hotel_tree'] = $tree->render(); } + $smartyVars['defaultcurrency_sign'] = $currencySign; + $smartyVars['date_from'] = $dateFrom; + $smartyVars['date_to'] = $dateTo; + $smartyVars['groups'] = Group::getGroups($this->context->language->id); + $this->context->smarty->assign($smartyVars); $this->fields_form = array( 'submit' => array( 'title' => $this->l('Save'), ), ); + return parent::renderForm(); } @@ -406,38 +371,66 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $groups = Tools::getValue('groupBox'); $jsonSpecialDays = json_encode($specialDays); $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); + $createMultiple = Tools::getValue('create_multiple'); + if (!$createMultiple) { + $roomTypeIds = array($roomTypeId); + } else { + $roomTypeIds = Tools::getValue('room_type_box'); + } $objFeaturePricing = new HotelRoomTypeFeaturePricing(); - if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) { $priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE; } $languages = Language::getLanguages(false); $objDefaultLang = new language($defaultLangId); - - if (!Tools::getValue('feature_price_name_'.$defaultLangId)) { + if (!($priceRuleNameDefault = Tools::getValue('feature_price_name_'.$defaultLangId))) { $this->errors[] = sprintf( $this->l('Advanced price rule name is required at least in %s'), $objDefaultLang->name ); + } else { + if (preg_match('{room_type_name}', $priceRuleNameDefault)) { + $priceRuleNameDefault = str_replace('{room_type_name}', '%s', $priceRuleNameDefault); + } } + $validateRules = call_user_func( array('HotelRoomTypeFeaturePricing', 'getValidationRules'), 'HotelRoomTypeFeaturePricing' ); - foreach ($languages as $language) { - if (!Validate::isCatalogName(Tools::getValue('feature_price_name_'.$language['id_lang']))) { - $this->errors[] = $this->l('Advanced price rule name is invalid in ').$language['name']; - } elseif (Tools::strlen(Tools::getValue('feature_price_name_'.$language['id_lang'])) > $validateRules['sizeLang']['feature_price_name']) { - sprintf( - $this->l('Advanced price rule Name field is too long (%2$d chars max).'), - $validateRules['sizeLang']['feature_price_name'] - ); + $featurePricingName = array(); + if ($roomTypeIds) { + foreach ($roomTypeIds as $idRoomType) { + $objProduct = new Product((int) $idRoomType); + foreach ($languages as $lang) { + $priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']); + if ($priceRuleName) { + if (preg_match('{room_type_name}', $priceRuleName)) { + $priceRuleName = str_replace('{room_type_name}', $objProduct->name[$lang['id_lang']], $priceRuleName); + } + } + + if (!Validate::isCatalogName($priceRuleName)) { + $this->errors[] = $this->l('Advanced price rule name is invalid in ').$lang['name']; + } elseif (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) { + $this->errors[] = sprintf( + $this->l('Advanced price rule Name field is too long (%d chars max).'), + $validateRules['sizeLang']['feature_price_name'] + ); + } + + if ($priceRuleName) { + $featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleName; + } else { + $featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleNameDefault; + } + } } } - if (!$roomTypeId) { + if (!$roomTypeId && !$createMultiple) { $this->errors[] = $this->l('Room is not selected. Please try again.'); } @@ -460,7 +453,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $this->errors[] = $this->l('Invalid Date To.'); } if ($dateTo < $dateFrom) { - $this->errors[] = $this->l('Date To must be a date after Date From.'); + $this->errors[] = $this->l('Date To cannot be smaller than Date From.'); } if ($isSpecialDaysExists) { if (!isset($specialDays) || !$specialDays) { @@ -479,81 +472,87 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController if (!$impactValue) { $this->errors[] = $this->l('Please enter a valid impact value.'); - } else { - if (!Validate::isPrice($impactValue)) { - $this->errors[] = $this->l('Invalid value of impact value.'); - } else if ($priceImpactType == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE - && $impactValue > 100 // check if percentage added is greater then 100 - ) { - $this->errors[] = $this->l('Invalid value of impact value.'); - } + } else if (!Validate::isPrice($impactValue)) { + $this->errors[] = $this->l('Invalid value of impact value.'); + } else if ($priceImpactType == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE + && $impactValue > 100 // check if percentage added is greater then 100 + ) { + $this->errors[] = $this->l('Invalid value of impact value.'); } if (!(bool)$groups) { $this->errors[] = $this->l('Please select at least one group for the group access'); } - $isPlanTypeExists = 0; if ($isSpecialDaysExists && $jsonSpecialDays == 'false') { $this->errors[] = $this->l('Please select at least one day for week days restriction.'); - } else if (empty($this->errors)) { - $isPlanTypeExists = $this->validateExistingFeaturePrice( - $dateSelectionType, - $roomTypeId, - $dateFrom, - $dateTo, - $groups, - $idFeaturePrice, - $isSpecialDaysExists, - $jsonSpecialDays - ); } - if ($isPlanTypeExists) { - $this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this plan. Please select a different date range.'); - } else { - if (!count($this->errors)) { - if ($idFeaturePrice) { - $objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice); - } - $objFeaturePricing->id_product = $roomTypeId; - // lang fields - foreach ($languages as $language) { - if (Tools::getValue('feature_price_name_'.$language['id_lang'])) { - $objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue( - 'feature_price_name_'.$language['id_lang'] - ); - } else { - $objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue( - 'feature_price_name_'.$defaultLangId - ); - } - } - $objFeaturePricing->date_selection_type = $dateSelectionType; - $objFeaturePricing->date_from = $dateFrom; - $objFeaturePricing->date_to = $dateTo; - $objFeaturePricing->impact_way = $priceImpactWay; - $objFeaturePricing->is_special_days_exists = $isSpecialDaysExists; - $objFeaturePricing->special_days = $jsonSpecialDays; - $objFeaturePricing->impact_type = $priceImpactType; - $objFeaturePricing->impact_value = $impactValue; - $objFeaturePricing->active = $enableFeaturePrice; - // set the values of the groups for this feature price - $objFeaturePricing->groupBox = $groups; + if ($createMultiple && empty($roomTypeIds)) { + $this->errors[] = $this->l('Please select at least one room type for creating multiple price rules.'); + } else if (empty($this->errors)) { + foreach ($roomTypeIds as $idRoomType) { + $isPlanTypeExists = $this->validateExistingFeaturePrice( + $dateSelectionType, + $idRoomType, + $dateFrom, + $dateTo, + $groups, + $idFeaturePrice, + $isSpecialDaysExists, + $jsonSpecialDays + ); - if ($objFeaturePricing->save()) { - if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { - Tools::redirectAdmin( - self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id. - '&update'.$this->table.'&conf=4&token='.$this->token - ); - } else { - Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); - } + if ($isPlanTypeExists) { + $objProduct = new Product((int) $idRoomType, false, $this->context->language->id); + $this->errors[] = sprintf($this->l('An advanced price rule already exists for "%s" for the selected date range. Please select a different date range.'), $objProduct->name); + } + } + } + + if (!$isPlanTypeExists && !count($this->errors)) { + if ($idFeaturePrice) { + $objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice); + } + + // lang fields + $objFeaturePricing->date_selection_type = $dateSelectionType; + $objFeaturePricing->date_from = $dateFrom; + $objFeaturePricing->date_to = $dateTo; + $objFeaturePricing->impact_way = $priceImpactWay; + $objFeaturePricing->is_special_days_exists = $isSpecialDaysExists; + $objFeaturePricing->special_days = $jsonSpecialDays; + $objFeaturePricing->impact_type = $priceImpactType; + $objFeaturePricing->impact_value = $impactValue; + $objFeaturePricing->active = $enableFeaturePrice; + + // set the values of the groups for this feature price + $objFeaturePricing->groupBox = $groups; + $objFeaturePricing->id_product = $roomTypeId; + if ($createMultiple) { + foreach ($roomTypeIds as $idRoomType) { + $objFeaturePricing->id_product = $idRoomType; + $objFeaturePricing->feature_price_name = $featurePricingName[$idRoomType]; + $objFeaturePricing->add(); + } + + Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token); + } else { + $objFeaturePricing->feature_price_name = $featurePricingName[$roomTypeId]; + } + + if ($objFeaturePricing->save()) { + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { + Tools::redirectAdmin( + self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id. + '&update'.$this->table.'&conf=4&token='.$this->token + ); } else { - $this->errors[] = $this->l('Some error occured while saving advanced price rule.'); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } + } else { + $this->errors[] = $this->l('Some error occured while saving advanced price rule.'); } } if (isset($idFeaturePrice) && $idFeaturePrice) { @@ -563,167 +562,6 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } } - public function processBulkSave() - { - $enableFeaturePrice = Tools::getValue('enable_feature_price'); - $roomTypeIds = Tools::getValue('room_type_box'); - $dateFrom = Tools::getValue('date_from'); - $dateTo = Tools::getValue('date_to'); - $isSpecialDaysExists = Tools::getValue('is_special_days_exists'); - $specialDays = Tools::getValue('special_days'); - $priceImpactWay = Tools::getValue('price_impact_way'); - $priceImpactType = Tools::getValue('price_impact_type'); - $impactValue = Tools::getValue('impact_value'); - $dateSelectionType = Tools::getValue('date_selection_type'); - $specificDate = date('Y-m-d', strtotime(Tools::getValue('specific_date'))); - $groups = Tools::getValue('groupBox'); - $jsonSpecialDays = json_encode($specialDays); - $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); - - $objFeaturePricing = new HotelRoomTypeFeaturePricing(); - - if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) { - $priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE; - } - - $languages = Language::getLanguages(false); - $objDefaultLang = new language($defaultLangId); - $featurePricingName = array(); - if (!Tools::getValue('feature_price_name_'.$defaultLangId)) { - $this->errors[] = sprintf( - $this->l('Advanced price rule name is required at least in %s'), - $objDefaultLang->name - ); - } - - $validateRules = call_user_func( - array('HotelRoomTypeFeaturePricing', 'getValidationRules'), - 'HotelRoomTypeFeaturePricing' - ); - foreach ($languages as $language) { - if (!Validate::isCatalogName(Tools::getValue('feature_price_name_'.$language['id_lang']))) { - $this->errors[] = $this->l('Advanced price rule name is invalid in ').$language['name']; - } elseif (Tools::strlen(Tools::getValue('feature_price_name_'.$language['id_lang'])) > $validateRules['sizeLang']['feature_price_name']) { - sprintf( - $this->l('Advanced price rule Name field is too long (%2$d chars max).'), - $validateRules['sizeLang']['feature_price_name'] - ); - } - - if (Tools::getValue('feature_price_name_'.$language['id_lang'])) { - $featurePricingName[$language['id_lang']] = Tools::getValue('feature_price_name_'.$language['id_lang']); - } else { - $featurePricingName[$language['id_lang']] = Tools::getValue('feature_price_name_'.$defaultLangId); - } - } - if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) { - $dateFrom = $specificDate; - $dateTo = date('Y-m-d', strtotime("+1 day", strtotime($specificDate))); - } else if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) { - if ($dateFrom == '') { - $this->errors[] = $this->l('Please choose Date from for the advanced price rule.'); - } - if ($dateTo == '') { - $this->errors[] = $this->l('Please choose Date to for the advanced price rule.'); - } - $dateFrom = date('Y-m-d', strtotime($dateFrom)); - $dateTo = date('Y-m-d', strtotime($dateTo)); - if (!Validate::isDate($dateFrom)) { - $this->errors[] = $this->l('Invalid Date From.'); - } - if (!Validate::isDate($dateTo)) { - $this->errors[] = $this->l('Invalid Date To.'); - } - if ($dateTo < $dateFrom) { - $this->errors[] = $this->l('Date To must be a date after Date From.'); - } - if ($isSpecialDaysExists) { - if (!isset($specialDays) || !$specialDays) { - $this->errors[] = $this->l('Please select at least one day for week days restriction.'); - } - } - } else { - if ($specificDate == '') { - $this->errors[] = $this->l('Please choose Date from for the advanced price rule.'); - } - $specificDate = date('Y-m-d', strtotime($specificDate)); - if (!Validate::isDate($specificDate)) { - $this->errors[] = $this->l('Invalid Date From.'); - } - } - - if (!$impactValue) { - $this->errors[] = $this->l('Please enter a valid impact value.'); - } else { - if (!Validate::isPrice($impactValue)) { - $this->errors[] = $this->l('Invalid value of impact value.'); - } else if ($priceImpactType == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE - && $impactValue > 100 // check if percentage added is greater then 100 - ) { - $this->errors[] = $this->l('Invalid value of impact value.'); - } - } - - if (!(bool)$groups) { - $this->errors[] = $this->l('Please select at least one group for the group access'); - } - - $isPlanTypeExists = 0; - if (empty($roomTypeIds)) { - $this->errors[] = $this->l('Please select at least one room type for bulk creation process.'); - } else if (empty($this->errors)) { - if ($isSpecialDaysExists && $jsonSpecialDays == 'false') { - $this->errors[] = $this->l('Please select at least one day for week days restriction.'); - } else { - foreach ($roomTypeIds as $roomTypeId) { - $isPlanTypeExists = $this->validateExistingFeaturePrice( - $dateSelectionType, - $roomTypeId, - $dateFrom, - $dateTo, - $groups, - 0, - $isSpecialDaysExists, - $jsonSpecialDays - ); - - if ($isPlanTypeExists) { - $objProduct = new Product((int) $roomTypeId, false, $this->context->language->id); - $this->errors[] = sprintf($this->l('An advanced price rule already exists for "%s" for the selected date range. Please select a different date range.'), $objProduct->name); - } - } - } - - if (empty($this->errors)) { - $res = true; - foreach ($roomTypeIds as $roomTypeId) { - $objFeaturePricing = new HotelRoomTypeFeaturePricing(); - $objFeaturePricing->id_product = $roomTypeId; - $objFeaturePricing->feature_price_name = $featurePricingName; - $objFeaturePricing->date_selection_type = $dateSelectionType; - $objFeaturePricing->date_from = $dateFrom; - $objFeaturePricing->date_to = $dateTo; - $objFeaturePricing->impact_way = $priceImpactWay; - $objFeaturePricing->is_special_days_exists = $isSpecialDaysExists; - $objFeaturePricing->special_days = $jsonSpecialDays; - $objFeaturePricing->impact_type = $priceImpactType; - $objFeaturePricing->impact_value = $impactValue; - $objFeaturePricing->active = $enableFeaturePrice; - - // set the values of the groups for this feature price - $objFeaturePricing->groupBox = $groups; - $res &= $objFeaturePricing->save(); - } - - Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelFeaturePricesSettings').'&conf=4&token='.$this->token); - } - } - - if (!empty($this->errors)) { - $this->display = 'add'; - } - } - public function ajaxProcessSearchProductByName() { $response = array('status' => 'failed'); diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index 1e3bc80b5..802a4d99c 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -569,6 +569,28 @@ $(document).ready(function() { /* ---- AdminHotelFeaturePricesSettingsController Admin ---- */ + if ($('input[name="create_multiple"]:checked').val() == 1) { + $('.room-type-name').hide(); + $('.room-type-name-tree').show(); + $('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide(); + } else { + $('.room-type-name').show(); + $('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show(); + $('.room-type-name-tree').hide(); + } + + $(document).on('change', 'input[name="create_multiple"]', function() { + if ($('input[name="create_multiple"]:checked').val() == 1) { + $('.room-type-name').hide(); + $('.room-type-name-tree').show(); + $('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide(); + } else { + $('.room-type-name').show(); + $('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show(); + $('.room-type-name-tree').hide(); + } + }); + $('#date_selection_type').on('change', function() { if ($('#date_selection_type').val() == date_selection_types.specific) { $(".specific_date_type").show(200); diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index ca2d0340e..ac5bac0b4 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -57,36 +57,57 @@
    {/if} +
    + {l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'} +
    - {if isset($bulk_add)} -
    -
- + diff --git a/admin/themes/default/template/page_header_toolbar.tpl b/admin/themes/default/template/page_header_toolbar.tpl index 0bf095f1a..7e47cd02d 100644 --- a/admin/themes/default/template/page_header_toolbar.tpl +++ b/admin/themes/default/template/page_header_toolbar.tpl @@ -83,7 +83,7 @@
  • - {$btn.desc|escape} + {$btn.desc}
  • {/if} From 4aefc75b9bf06e4593ea544b9eb11b08528fae76 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 1 May 2025 16:29:32 +0530 Subject: [PATCH 092/143] Fixed: incorrect information shown on Room type page Price tab for advance price rules --- .../template/controllers/products/prices.tpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/admin/themes/default/template/controllers/products/prices.tpl b/admin/themes/default/template/controllers/products/prices.tpl index b45c43e69..32fe8a418 100644 --- a/admin/themes/default/template/controllers/products/prices.tpl +++ b/admin/themes/default/template/controllers/products/prices.tpl @@ -413,13 +413,6 @@ $(document).ready(function () { - + + From 1d10b42622f14298cb44c2ff38965aaca8860e86 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 9 May 2025 12:07:51 +0530 Subject: [PATCH 103/143] added some minor changes to the code --- classes/pdf/HTMLTemplateInvoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 4241b427d..2066ae493 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -314,12 +314,12 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $service_product_data = array(); $room_extra_demands = array(); $room_additinal_services = array(); - $formattedHotelAddress = false; + $formattedHotelAddress = ''; if (Module::isInstalled('hotelreservationsystem')) { $obj_htl_bk_dtl = new HotelBookingDetail(); $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); $objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $this->context->language->id); - $invoiceAddressPatternRules['avoid'] = array('lastname'); + $invoiceAddressPatternRules['avoid'][] = 'lastname'; if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) { $objHotelAddress = new Address((int) $idHotelAddress); $objHotelAddress->firstname = $objHotelBranchInfo->hotel_name; From ae7cc5dbb36c13eabe488f27a7a47252417efddf Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 9 May 2025 17:05:28 +0530 Subject: [PATCH 104/143] updated the validations and flow while creating multiple advance price rules --- .../admin/AdminHotelFeaturePricesSettings.php | 68 +++++++++++-------- .../helpers/form/form.tpl | 26 ++++--- 2 files changed, 56 insertions(+), 38 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index 027220d65..73c5cad5e 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -372,11 +372,6 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $jsonSpecialDays = json_encode($specialDays); $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); $createMultiple = Tools::getValue('create_multiple'); - if (!$createMultiple) { - $roomTypeIds = array($roomTypeId); - } else { - $roomTypeIds = Tools::getValue('room_type_box'); - } $objFeaturePricing = new HotelRoomTypeFeaturePricing(); if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) { @@ -384,41 +379,64 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } $languages = Language::getLanguages(false); - $objDefaultLang = new language($defaultLangId); + $objDefaultLang = new Language($defaultLangId); if (!($priceRuleNameDefault = Tools::getValue('feature_price_name_'.$defaultLangId))) { - $this->errors[] = sprintf( - $this->l('Advanced price rule name is required at least in %s'), - $objDefaultLang->name - ); + $this->errors[] = sprintf($this->l('Advanced price rule name is required at least in %s'), $objDefaultLang->name); } else { if (preg_match('{room_type_name}', $priceRuleNameDefault)) { $priceRuleNameDefault = str_replace('{room_type_name}', '%s', $priceRuleNameDefault); } } + $toUpdatePriceRuleName = false; $validateRules = call_user_func( array('HotelRoomTypeFeaturePricing', 'getValidationRules'), 'HotelRoomTypeFeaturePricing' ); + foreach ($languages as $lang) { + $priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']); + if (preg_match('{room_type_name}', $priceRuleName)) { + $priceRuleName = str_replace('{room_type_name}', '%s', $priceRuleName); + $toUpdatePriceRuleName = true; + } + if (!Validate::isCatalogName($priceRuleName)) { + $this->errors[] = $this->l('Advanced price rule name is invalid in ').$lang['name']; + } elseif (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) { + $this->errors[] = sprintf( + $this->l('Advanced price rule Name field is too long (%d chars max).'), + $validateRules['sizeLang']['feature_price_name'], + ); + } + } + $featurePricingName = array(); - if ($roomTypeIds) { + $roomTypeIds = array(); + if (!$createMultiple) { + if ($roomTypeId) { + $roomTypeIds = array($roomTypeId); + } else { + $this->errors[] = $this->l('Room type is not selected. Please try again.'); + } + } else if (!$roomTypeIds = Tools::getValue('room_type_box')) { + $this->errors[] = $this->l('Please select at least one room type for creating multiple price rules.'); + } + + if ($roomTypeIds && !$this->errors) { foreach ($roomTypeIds as $idRoomType) { $objProduct = new Product((int) $idRoomType); foreach ($languages as $lang) { $priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']); - if ($priceRuleName) { + if ($priceRuleName && $toUpdatePriceRuleName) { if (preg_match('{room_type_name}', $priceRuleName)) { $priceRuleName = str_replace('{room_type_name}', $objProduct->name[$lang['id_lang']], $priceRuleName); } - } - - if (!Validate::isCatalogName($priceRuleName)) { - $this->errors[] = $this->l('Advanced price rule name is invalid in ').$lang['name']; - } elseif (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) { - $this->errors[] = sprintf( - $this->l('Advanced price rule Name field is too long (%d chars max).'), - $validateRules['sizeLang']['feature_price_name'] - ); + if (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) { + $this->errors[] = sprintf( + $this->l('Advanced price rule Name field is too long (%d chars max) for "%s" room type.'), + $validateRules['sizeLang']['feature_price_name'], + $objProduct->name[$lang['id_lang']] + ); + } } if ($priceRuleName) { @@ -430,10 +448,6 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } } - if (!$roomTypeId && !$createMultiple) { - $this->errors[] = $this->l('Room is not selected. Please try again.'); - } - if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) { $dateFrom = $specificDate; $dateTo = date('Y-m-d', strtotime("+1 day", strtotime($specificDate))); @@ -485,9 +499,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $this->errors[] = $this->l('Please select at least one day for week days restriction.'); } - if ($createMultiple && empty($roomTypeIds)) { - $this->errors[] = $this->l('Please select at least one room type for creating multiple price rules.'); - } else if (empty($this->errors)) { + if (empty($this->errors)) { foreach ($roomTypeIds as $idRoomType) { $isPlanTypeExists = $this->validateExistingFeaturePrice( $dateSelectionType, diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index e404f9695..a16c5be49 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -34,16 +34,13 @@
    {foreach from=$languages item=language} {assign var="feature_price_name" value="feature_price_name_`$language.id_lang`"} {/foreach} -
    - {l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'} -
    {if $languages|@count > 1}
    @@ -60,6 +57,11 @@
    {/if} +
    +
    + {l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'} +
    +
    {if !isset($objFeaturePrice) || !$objFeaturePrice->id} @@ -80,9 +82,11 @@ {if isset($hotel_tree)} -
    +
    @@ -100,7 +100,7 @@ - {hook h='displayAddRowInRoomList' item=$key id_room=$room_info['id']} + {hook h='displayHotelRoomListTableRowColumn' index=$key id_room=$room_info['id']} - {hook h='displayAddRowInRoomList' item=$k} + {hook h='displayHotelRoomListTableRowColumn' index=$k} '; - html += '' + '{hook h='displayAddRowInRoomList'}'; + html += '{hook h='displayHotelRoomListTableRowColumn'}'; html += ''; diff --git a/modules/hotelreservationsystem/classes/HotelBookingDemands.php b/modules/hotelreservationsystem/classes/HotelBookingDemands.php index bc1e66f44..8cca590ba 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDemands.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDemands.php @@ -103,10 +103,8 @@ class HotelBookingDemands extends ObjectModel $sql .= ' AND hb.`id_room`='.(int)$idRoom; } if ($dateFrom && $dateTo) { - $result = Hook::exec('actionRoomTypeBookingDemandsDatesModifierBefore', array('date_from' => &$dateFrom, 'date_to' => &$dateTo), null, true); $dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom)); $dateTo = date('Y-m-d H:i:s', strtotime($dateTo)); - Hook::exec('actionRoomTypeBookingDemandsDatesModifierAfter', array('date_from' => &$dateFrom, 'date_to' => &$dateTo, 'result' => $result)); $sql .= ' AND hb.`date_from`=\''.pSQL($dateFrom).'\' AND hb.`date_to`= \''.pSQL($dateTo).'\''; } diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index ce1d06c66..ed6c6d970 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1078,7 +1078,7 @@ class HotelCartBookingData extends ObjectModel } } - Hook::exec('actionValidateCartBookingsErrors', array('errors' => &$errors)); + Hook::exec('actionCartBookingsErrorsModifier', array('errors' => &$errors)); return $errors; } diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 16317f2db..e7275e656 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -2499,7 +2499,7 @@ class HotelHelper $startDate = new DateTime($dateFrom); $endDate = new DateTime($dateTo); $daysDifference = $startDate->diff($endDate)->days; - Hook::exec('actionDatesDifferenceModifier', array('date_from'=> $dateFrom, 'date_to'=> $dateTo, 'days_difference'=>&$daysDifference)); + Hook::exec('actionDatesDifferenceModifier', array('date_from'=> $dateFrom, 'date_to'=> $dateTo, 'days_difference'=> &$daysDifference)); return $daysDifference; } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index ff485619e..c01451080 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -145,7 +145,6 @@ class RoomTypeServiceProduct extends ObjectModel $sql .= ' AND p.`price_addition_type` = '.$priceAdditionType; } if ($services = Db::getInstance()->executeS($sql)) { - Hook::exec('actionAutoAddServices', array('services' => &$services, 'dateFrom' => $dateFrom, 'dateTo' => $dateTo)); $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); foreach($services as &$service) { $service['price'] = $objRoomTypeServiceProductPrice->getServicePrice( @@ -161,6 +160,8 @@ class RoomTypeServiceProduct extends ObjectModel ); } + Hook::exec('actionAutoAddServicesModifier', array('services' => &$services, 'dateFrom' => $dateFrom, 'dateTo' => $dateTo)); + return $services; } } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index 6818de1f5..ef652ddf6 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -54,14 +54,16 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $idCart, $idHtlCartData ) { - $isServiceAvailable = Hook::exec('actionCheckServiceAvailability', array( - 'idProduct' => $idProduct, + $isAvailable = true; + Hook::exec('actionCheckServiceAvailability', array( + 'id_product' => $idProduct, 'quantity' => $quantity, - 'idCart' => $idCart, - 'idHtlCartData' => $idHtlCartData + 'id_cart' => $idCart, + 'id_hotel_cart_data' => $idHtlCartData, + 'is_service_available' => &$isAvailable, )); - if (!$isServiceAvailable) { + if (!$isAvailable) { return false; } diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php index bbc36a8fa..9bde8c9d8 100644 --- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php +++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php @@ -278,7 +278,7 @@ class WkRoomSearchHelper } $smartyVars['total_columns'] = $totalColumns; - Hook::exec('actionSearchPanelVariablesModifier', array('smartyVars' => &$smartyVars)); + Hook::exec('actionSearchPanelParamsModifier', array('params' => &$smartyVars)); Context::getContext()->smarty->assign($smartyVars); } diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index f32614fc8..28e65b617 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -134,7 +134,6 @@
    {l s='No room available for this hotel!'}
    - {hook h='displayAfterNoRoomAvailableBlock'} {/if} {block name='displayRoomTypeListAfter'} From 87586caf6b10d1fd74a9797b3d1fa2e49b438611 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 15 May 2025 15:58:04 +0530 Subject: [PATCH 126/143] Updated the cache keys to reduce the risk of key collisions --- classes/Product.php | 2 +- modules/hotelreservationsystem/classes/HotelCartBookingData.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index 029dbdc77..19421df19 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -982,7 +982,7 @@ class ProductCore extends ObjectModel public static function isBookingProduct($id_product) { - $cache_key = 'Product::isBookingProduct'.(int)$id_product; + $cache_key = 'Product::isBookingProduct_'.(int)$id_product; if (!Cache::isStored($cache_key)) { $res = Db::getInstance()->getValue(' SELECT `booking_product` FROM `'._DB_PREFIX_.'product` p diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 2a5ae7dc6..23952b89e 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1331,7 +1331,7 @@ class HotelCartBookingData extends ObjectModel */ public function getCartInfoIdCartIdProduct($id_cart, $id_product, $date_from = false, $date_to = false) { - $cache_key = 'HotelCartBookingData::getCartInfoIdCartIdProduct'.(int)$id_cart.(int)$id_product.($date_from ? strtotime($date_from) : '_').($date_to ? strtotime($date_to) : '_'); + $cache_key = 'HotelCartBookingData::getCartInfoIdCartIdProduct_'.(int)$id_cart.'_'.(int)$id_product.'_'.($date_from ? strtotime($date_from) : 'null').'_'.($date_to ? strtotime($date_to) : 'null'); if (!Cache::isStored($cache_key)) { $sql = 'SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` From 20a24b05a5a0d89a873fb1b64cd955feab9bca21 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 15 May 2025 16:04:08 +0530 Subject: [PATCH 127/143] Updated the params name in the hook actionCheckServiceAvailability --- .../classes/RoomTypeServiceProductCartDetail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index c0785896d..b2a6123b5 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -59,7 +59,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel 'id_product' => $idProduct, 'quantity' => $quantity, 'id_cart' => $idCart, - 'id_hotel_cart_data' => $idHtlCartData, + 'htl_cart_booking_id' => $idHtlCartData, 'is_service_available' => &$isAvailable, )); From f65d880c629f47b23f11409cb9db4790f425db0c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 15 May 2025 16:06:04 +0530 Subject: [PATCH 128/143] Updated the params used in the data for front searc to get all room types --- controllers/front/CategoryController.php | 4 ++-- modules/hotelreservationsystem/classes/HotelBookingDetail.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 6984debfe..8ffcb03ba 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -184,7 +184,7 @@ class CategoryControllerCore extends FrontController ); if ($displayAllRoomsTypes) { - $bookingParams['display_all_room_types'] = 1; + $bookingParams['get_all_room_types'] = 1; } $booking_data = $objBookingDetail->dataForFrontSearch($bookingParams); @@ -336,7 +336,7 @@ class CategoryControllerCore extends FrontController ); if ($displayAllRoomsTypes) { - $bookingParams['display_all_room_types'] = 1; + $bookingParams['get_all_room_types'] = 1; } $booking_data = $objBookingDetail->dataForFrontSearch($bookingParams); diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 173092b3c..8f73e01b7 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1707,7 +1707,7 @@ class HotelBookingDetail extends ObjectModel continue; } - if (count($value['data']['available']) || (isset($display_all_room_types) && $display_all_room_types)) { + if (count($value['data']['available']) || (isset($get_all_room_types) && $get_all_room_types)) { $prod_price = Product::getPriceStatic($value['id_product'], self::useTax()); $productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 0); $cover_image_arr = Product::getCover($value['id_product']); From 3111e571b58e73825fb5e5ba62aa46ee358760f6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 15 May 2025 16:37:37 +0530 Subject: [PATCH 129/143] Added process to bulk delete, and update the bulk actions button on the room tab in manage room type page --- .../controllers/products/configuration.tpl | 73 +++++++++---- controllers/admin/AdminProductsController.php | 102 ++++++++++++------ 2 files changed, 121 insertions(+), 54 deletions(-) diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index eca7eefc0..580501037 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -28,11 +28,7 @@
    {l s='Rooms Details' pdf='true'}{l s='Rooms Details' pdf='true'}
    {l s='Room Image' pdf='true'}{l s='Room Description' pdf='true'}{l s='Hotel' pdf='true'} {l s='Tax Rate(s)' pdf='true'}{l s='Base price' pdf='true'}
    {l s='(Tax excl.)' pdf='true'}
    -

    - {$data_v['hotel_name']} -

    -
    {$data_v['order_detail_tax_label']} {if isset($room_info['id'])} - {if $room_info['booked_dates']} - + {if isset($room_info['booked_dates']) && $room_info['booked_dates']} + {/if} diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 3dc7ccdda..7e6d5908f 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2966,7 +2966,7 @@ class AdminProductsControllerCore extends AdminController $bookedDate['date_from_formatted'] = Tools::displayDate($bookedDate['date_from']); $bookedDate['date_to_formatted'] = Tools::displayDate($bookedDate['date_to']); } - $room['booked_dates'] = $bookedDates; + $room['booked_dates'] = json_encode($bookedDates); if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) { $disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']); From b12f01f3d61644052a4de44ae5fe2d757dd87f10 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 1 May 2025 12:46:42 +0530 Subject: [PATCH 091/143] Fixed: the text is displayed with html special character in the admin orders in some languages --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- admin/themes/default/template/page_header_toolbar.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 2f5c37c16..2184085c9 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -458,7 +458,7 @@
    {dateFormat date=$payment['date_add'] full=true} {$payment['payment_method']|escape:'html':'UTF-8'}{$payment_types[$payment['payment_type']]['name']|escape:'html':'UTF-8'}{$payment_types[$payment['payment_type']]['name']|escape:'UTF-8'} {$payment['transaction_id']|escape:'html':'UTF-8'} {displayPrice price=$payment['real_paid_amount'] currency=$payment['id_currency']} {if isset($payment['invoice_number'])}{$payment['invoice_number']}{else}--{/if} {$featurePlan['feature_price_name']} - {if $featurePlan['impact_type'] == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE} - {l s='Percentage'} - {else} - {l s='Fixed Amount'} - {/if} - {if $featurePlan['impact_way'] == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE} {l s='Decrease'} @@ -427,6 +420,13 @@ $(document).ready(function () { {l s='Increase'} {/if} + {if $featurePlan['impact_type'] == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE} + {l s='Percentage'} + {else} + {l s='Fixed Amount'} + {/if} + {if $featurePlan['impact_type'] == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE} {$featurePlan['impact_value']|round:2}% From ab7d7a9855b67dd1bf4c8d3981e95055f36c82da Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 2 May 2025 17:22:30 +0530 Subject: [PATCH 093/143] Fixed: some minor design issues --- themes/hotel-reservation-theme/_partials/room_type_list.tpl | 4 ++-- themes/hotel-reservation-theme/css/category.css | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index e475773bd..19b5be811 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -88,7 +88,7 @@ {/block} -
    +
    {block name='room_type_list_room_max_guests'}
    {$room_v['max_guests']|escape:'htmlall':'UTF-8'} {l s='Max guests:'}
    {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {if $room_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}
    @@ -121,7 +121,7 @@
    {else} {block name='room_type_list_room_price'} -
    +
    {if $room_v['feature_price_diff'] >= 0} {displayPrice price = $room_v['price_without_reduction']|round:2|floatVal} diff --git a/themes/hotel-reservation-theme/css/category.css b/themes/hotel-reservation-theme/css/category.css index 9c28d0336..17cf23feb 100644 --- a/themes/hotel-reservation-theme/css/category.css +++ b/themes/hotel-reservation-theme/css/category.css @@ -251,11 +251,15 @@ p.capa_txt { .booking_guest_occupancy_conatiner { display: flex; } +.room_type_list_actions .rm_price_cont { + margin-bottom: 0px; +} @media (min-width: 992px) { .booking_guest_occupancy_conatiner .booking_occupancy_wrapper { left: unset; } .room_features_cont > div { + min-height: 47px; display: flex; flex-wrap: wrap; align-items: center; From 6eee471cae2f49801e6fc04e68a4799f003d89df Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 5 May 2025 15:43:07 +0530 Subject: [PATCH 094/143] Fixed: The search form gets submitted after admin chages the hotel and the date range selected does not satisfy the max order date condition --- .../views/js/wk-room-search-block.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 6c747841b..7b74f6eeb 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -384,22 +384,24 @@ $(document).ready(function() { if (min_booking_offset) { start_date.setDate(start_date.getDate() + parseInt(min_booking_offset)); start_date.setHours(0, 0, 0, 0); - let selectedDateFrom = new Date(Date.parse(dateFrom)); - let selectedDateTo = new Date(Date.parse(dateTo)); - if (selectedDateFrom < start_date - || selectedDateTo < start_date - ) { - $('#check_in_time').val(''); - $('#check_out_time').val(''); - } } + let selectedDateFrom = new Date(Date.parse(dateFrom)); + let selectedDateTo = new Date(Date.parse(dateTo)); if (max_order_date) { max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date ); } else { max_order_date = false; } + if (selectedDateFrom < start_date + || selectedDateTo < start_date + || (max_order_date && max_order_date < selectedDateTo) + ) { + $('#check_in_time').val(''); + $('#check_out_time').val(''); + } + if (typeof $('#daterange_value').data('dateRangePicker') != 'undefined') { if (max_order_date) { if ($.datepicker.parseDate('yy-mm-dd', $('#check_out_time').val()) < max_order_date) { From d2aa1e3eed77d14fd257905a89f4a8c260eb1e81 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 6 May 2025 12:24:17 +0530 Subject: [PATCH 095/143] Fixed: the translation issue for the modules in the admin translation controller --- classes/Translate.php | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/classes/Translate.php b/classes/Translate.php index eac5b8401..9444fbaf0 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -31,6 +31,7 @@ class TranslateCore { public static $ignore_folder = array('.', '..', '.svn', '.git', '.htaccess', 'index.php'); public static $adminTranslations = array(); + public static $moduleTranslations = array(); /** * Get a translation for an admin controller @@ -127,7 +128,7 @@ class TranslateCore */ public static function getModuleTranslation($module, $string, $source, $sprintf = null, $addslashes = false, $language = null) { - global $_MODULES, $_MODULE, $_LANGADM; + global $_MODULE; static $lang_cache = array(); // $_MODULES is a cache of translations for all module. @@ -145,15 +146,16 @@ class TranslateCore $force_refresh = true; } - if ((!isset($translations_merged[$name]) && isset(Context::getContext()->language)) || $force_refresh) { + $iso = $language->iso_code; + if ((isset(Context::getContext()->language) && !isset($translations_merged[$name])) || $force_refresh) { $files_by_priority = array( // Translations in theme - _PS_THEME_DIR_.'modules/'.$name.'/translations/'.$language->iso_code.'.php', - _PS_THEME_DIR_.'modules/'.$name.'/'.$language->iso_code.'.php', + _PS_THEME_DIR_.'modules/'.$name.'/translations/'.$iso.'.php', + _PS_THEME_DIR_.'modules/'.$name.'/'.$iso.'.php', // PrestaShop 1.5 translations - _PS_MODULE_DIR_.$name.'/translations/'.$language->iso_code.'.php', + _PS_MODULE_DIR_.$name.'/translations/'.$iso.'.php', // PrestaShop 1.4 translations - _PS_MODULE_DIR_.$name.'/'.$language->iso_code.'.php' + _PS_MODULE_DIR_.$name.'/'.$iso.'.php' ); // if force_refresh is set reverse the list because array_merge will overrite the previous file with new file if ($force_refresh) { @@ -162,8 +164,8 @@ class TranslateCore foreach ($files_by_priority as $file) { if (file_exists($file)) { include_once($file); - $_MODULES = !empty($_MODULES) ? ($force_refresh ? array_merge($_MODULES, $_MODULE) : $_MODULES + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values. - $translations_merged[$name] = true; + self::$moduleTranslations[$iso] = !empty(self::$moduleTranslations[$iso]) ? ($force_refresh ? array_merge(self::$moduleTranslations[$iso], $_MODULE) : self::$moduleTranslations[$iso] + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values. + $translations_merged[$language->iso_code][$name] = true; } } } @@ -173,7 +175,7 @@ class TranslateCore $cache_key = $name.'|'.$string.'|'.$source.'|'.(int)$addslashes; if (!isset($lang_cache[$cache_key])) { - if ($_MODULES == null) { + if (self::$moduleTranslations[$iso] == null) { if ($sprintf !== null) { $string = Translate::checkAndReplaceArgs($string, $sprintf); } @@ -189,18 +191,18 @@ class TranslateCore $default_key_file = strtolower('<{'.$name.'}prestashop>'.$file).'_'.$key; } - if (isset($current_key_file) && !empty($_MODULES[$current_key_file])) { - $ret = stripslashes($_MODULES[$current_key_file]); - } elseif (isset($default_key_file) && !empty($_MODULES[$default_key_file])) { - $ret = stripslashes($_MODULES[$default_key_file]); - } elseif (!empty($_MODULES[$current_key])) { - $ret = stripslashes($_MODULES[$current_key]); - } elseif (!empty($_MODULES[$default_key])) { - $ret = stripslashes($_MODULES[$default_key]); + if (isset($current_key_file) && !empty(self::$moduleTranslations[$iso][$current_key_file])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$current_key_file]); + } elseif (isset($default_key_file) && !empty(self::$moduleTranslations[$iso][$default_key_file])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$default_key_file]); + } elseif (!empty(self::$moduleTranslations[$iso][$current_key])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$current_key]); + } elseif (!empty(self::$moduleTranslations[$iso][$default_key])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$default_key]); } // if translation was not found in module, look for it in AdminController or Helpers - elseif (!empty($_LANGADM)) { - $ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, $_LANGADM)); + elseif (isset(self::$adminTranslations[$iso]) && !empty(self::$adminTranslations[$iso])) { + $ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso])); } else { $ret = stripslashes($string); } From 89ceea7e76b66c6735c31f6d93d85f117f1feddc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 7 May 2025 14:56:27 +0530 Subject: [PATCH 096/143] Fixed: issues after merge with develop that caused the product from the cart to be deleted twice from cart product table --- controllers/admin/AdminOrdersController.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index e717e7a30..f0a1b0f60 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -6173,8 +6173,7 @@ class AdminOrdersControllerCore extends AdminController $del_id = Tools::getValue('del_id'); $room_id = Tools::getValue('id_room'); $obj_hotel_cart_detail = new HotelCartBookingData(); - $deleted = $obj_hotel_cart_detail->deleteCartBookingData($cart_id, $id_product, $room_id, $dt_frm, $dt_to); - if ($deleted) { + if ($obj_hotel_cart_detail->deleteCartBookingData($cart_id, $id_product, $room_id, $dt_frm, $dt_to)) { HotelRoomTypeFeaturePricing::deleteByIdCart($cart_id, $id_product, $room_id, $dt_frm, $dt_to ); $obj_product_process = new HotelCartBookingData(); $num_cart_rooms = 0; @@ -6182,14 +6181,8 @@ class AdminOrdersControllerCore extends AdminController $num_cart_rooms = count($rooms); } - $numDays = HotelHelper::getNumberOfDays($dt_frm, $dt_to); - $changed = $obj_product_process->changeProductDataByRoomId($room_id, $id_product, $numDays, $cart_id); - if ($changed) { - $result['status'] = 'deleted'; - $result['cart_rooms'] = $num_cart_rooms; - } else { - $result['status'] = 'failed'; - } + $result['status'] = 'deleted'; + $result['cart_rooms'] = $num_cart_rooms; } else { $result['status'] = 'failed'; } From 1662fc38680bc7865c8cd717371824e8f0ceb463 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 7 May 2025 16:56:45 +0530 Subject: [PATCH 097/143] Fixed: Cart changes are not reflected when using the cache --- classes/cache/Cache.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/cache/Cache.php b/classes/cache/Cache.php index 96b0fed3f..408fdf1bf 100644 --- a/classes/cache/Cache.php +++ b/classes/cache/Cache.php @@ -90,6 +90,7 @@ abstract class CacheCore 'page_viewed', 'employee', 'log', + 'htl_cart_booking_data', ); /** From a2714b8d1230b8e3fc180358113787292fa4b62f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 8 May 2025 11:12:01 +0530 Subject: [PATCH 098/143] Added: service related tables are not cleaned properly when using the cleaner, also fixed some queries --- modules/qlocleaner/qlocleaner.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php index d2c65a493..6ba70f67c 100644 --- a/modules/qlocleaner/qlocleaner.php +++ b/modules/qlocleaner/qlocleaner.php @@ -665,7 +665,8 @@ class QloCleaner extends Module array('warehouse_carrier', 'id_carrier', 'carrier', 'id_carrier'), array('warehouse_product_location', 'id_product', 'product', 'id_product'), array('warehouse_product_location', 'id_warehouse', 'warehouse', 'id_warehouse'), - array('specific_price', 'id_product', 'customer', 'id_customer'), + array('specific_price', 'id_product', 'product', 'id_product'), + array('specific_price', 'id_customer', 'customer', 'id_customer'), array('specific_price', 'id_group', 'group', 'id_group'), array('htl_features_block_data_lang', 'id_features_block', 'htl_features_block_data', 'id_features_block'), array('cart_rule', 'id_customer', 'customer', 'id_customer'), @@ -699,13 +700,18 @@ class QloCleaner extends Module array('profile_lang', 'id_lang', 'lang', 'id_lang'), array('htl_access', 'id_profile', 'profile', 'id_profile'), array('htl_access', 'id_hotel', 'htl_branch_info', 'id'), - array('htl_room_disable_dates', 'id_room_type', 'htl_room_type', 'id'), + array('htl_room_disable_dates', 'id_room_type', 'htl_room_type', 'id_product'), array('htl_room_type_feature_pricing_lang', 'id_feature_price', 'htl_room_type_feature_pricing', 'id_feature_price'), array('htl_room_type_feature_pricing_lang', 'id_lang', 'lang', 'id_lang'), array('htl_order_restrict_date', 'id_hotel', 'htl_branch_info', 'id'), array('htl_branch_refund_rules', 'id_hotel', 'htl_branch_info', 'id'), array('htl_order_refund_rules_lang', 'id_refund_rule', 'htl_branch_refund_rules', 'id_refund_rule'), array('htl_advance_payment', 'id_product', 'product', 'id_product'), + array('htl_order_refund_rules_lang', 'id_lang', 'lang', 'id_lang'), + array('htl_room_type_service_product', 'id_product', 'product', 'id_product'), + array('htl_room_type_service_product', 'id_element', 'product', 'id_product'), + array('htl_room_type_service_product_price', 'id_product', 'product', 'id_product'), + array('htl_room_type_service_product_price', 'id_element', 'product', 'id_product'), ) ); } @@ -802,7 +808,9 @@ class QloCleaner extends Module 'htl_room_block_data', 'htl_features_block_data', 'htl_testimonials_block_data', - 'htl_room_type_global_demand' + 'htl_room_type_global_demand', + 'htl_room_type_service_product', + 'htl_room_type_service_product_price', ) ); } From 54b595ce3f1175cdede25a4d240bf2d0132bc747 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 8 May 2025 12:13:17 +0530 Subject: [PATCH 099/143] Cache is not cleaned after using the cleaner, which shows the old data from the cache --- modules/qlocleaner/qlocleaner.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php index 6ba70f67c..a475b0c55 100644 --- a/modules/qlocleaner/qlocleaner.php +++ b/modules/qlocleaner/qlocleaner.php @@ -85,6 +85,7 @@ class QloCleaner extends Module } Hook::exec('actionCleanData', array('method' => 'checkAndFix')); $html .= $this->displayConfirmation($conf); + Cache::getInstance()->flush(); } elseif (Tools::isSubmit('submitCleanAndOptimize')) { $logs = self::cleanAndOptimize(); if (count($logs)) { @@ -95,14 +96,17 @@ class QloCleaner extends Module } Hook::exec('actionCleanData', array('method' => 'cleanAndOptimize')); $html .= $this->displayConfirmation($conf); + Cache::getInstance()->flush(); } elseif (Tools::getValue('submitTruncateCatalog') && Tools::getValue('checkTruncateCatalog')) { self::truncate('catalog'); Hook::exec('actionCleanData', array('method' => 'catalog')); $html .= $this->displayConfirmation($this->l('Catalog truncated successfuly, please run functional Integrity constraints to clean the database.')); + Cache::getInstance()->flush(); } elseif (Tools::getValue('submitTruncateSales') && Tools::getValue('checkTruncateSales')) { self::truncate('sales'); Hook::exec('actionCleanData', array('method' => 'sales')); $html .= $this->displayConfirmation($this->l('Orders and customers truncated successfuly, please run functional Integrity constraints to clean the database')); + Cache::getInstance()->flush(); } $html .= $this->context->smarty->fetch(_PS_MODULE_DIR_.$this->name.'/views/templates/admin/qlocleaner_script.tpl'); From 9e27a5bee43bf85fddcc77d065560e8988d3e056 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 8 May 2025 17:53:31 +0530 Subject: [PATCH 100/143] Fixed: the hooks installed for the theme properly --- install/data/xml/meta.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/data/xml/meta.xml b/install/data/xml/meta.xml index 0ae2f7dc8..baf678639 100644 --- a/install/data/xml/meta.xml +++ b/install/data/xml/meta.xml @@ -40,10 +40,6 @@ sitemap 1 - - properties - 1 - supplier 1 @@ -152,5 +148,9 @@ products-comparison 1 + + properties + 1 + From 9f0da5d1ddbe466cb5c92351857897ea2fb717cf Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 9 May 2025 09:23:15 +0530 Subject: [PATCH 101/143] Fixed: display issue with single language and removed validation on the percentage value --- .../controllers/admin/AdminHotelFeaturePricesSettings.php | 4 ---- .../hotel_feature_prices_settings/helpers/form/form.tpl | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index d3f61a5cb..027220d65 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -474,10 +474,6 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $this->errors[] = $this->l('Please enter a valid impact value.'); } else if (!Validate::isPrice($impactValue)) { $this->errors[] = $this->l('Invalid value of impact value.'); - } else if ($priceImpactType == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE - && $impactValue > 100 // check if percentage added is greater then 100 - ) { - $this->errors[] = $this->l('Invalid value of impact value.'); } if (!(bool)$groups) { diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index ac5bac0b4..e404f9695 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -41,6 +41,9 @@ {assign var="feature_price_name" value="feature_price_name_`$language.id_lang`"} {/foreach} +
    + {l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'} +
    {if $languages|@count > 1}
    @@ -57,9 +60,6 @@
    {/if} -
    - {l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'} -
    {if !isset($objFeaturePrice) || !$objFeaturePrice->id} From 88433a3755ba4b730d0a6ae002a4a9eafa68263a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 9 May 2025 11:13:09 +0530 Subject: [PATCH 102/143] Fixed: desing issues in the rooms tab in manage room type page --- .../default/template/controllers/products/configuration.tpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index d3009ad60..d0c029704 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -125,6 +125,9 @@ {for $k=0 to 1} {assign var="var_name_room_info" value="rooms_info[`$k`]"}
    + + {l s='--'} {if isset($room_info['id'])} {if isset($room_info['booked_dates']) && $room_info['booked_dates']} @@ -141,7 +141,7 @@ {if $k == 1} @@ -420,7 +420,7 @@ html += ''; html += ''; html += ''; html += ''; html += '
    - + - - + + {/foreach} diff --git a/classes/Customer.php b/classes/Customer.php index 2e8c3bba5..62abf08c1 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -149,7 +149,8 @@ class CustomerCore extends ObjectModel 'last_passwd_gen' => array('setter' => null), 'secure_key' => array('setter' => null), 'deleted' => array(), - 'passwd' => array('setter' => 'setWsPasswd') + 'passwd' => array('setter' => 'setWsPasswd'), + 'phone' => array() ), 'associations' => array( 'groups' => array('resource' => 'group'), @@ -179,7 +180,6 @@ class CustomerCore extends ObjectModel 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret'), 'ape' => array('type' => self::TYPE_STRING, 'validate' => 'isApe'), - 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'outstanding_allow_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'copy_post' => false), 'show_public_prices' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), @@ -206,8 +206,12 @@ class CustomerCore extends ObjectModel $this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP'); parent::__construct($id); + if ($this->email) { + $this->phone = CustomerGuestDetail::getCustomerPhone($this->email, false); + } + if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { - self::$definition['fields']['phone']['required'] = true; + $this->webserviceParameters['fields']['phone']['required'] = true; } } @@ -260,7 +264,7 @@ class CustomerCore extends ObjectModel } $success = parent::add($autodate, $null_values); $this->updateGroup($this->groupBox); - + $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); return $success; } @@ -285,9 +289,22 @@ class CustomerCore extends ObjectModel $objOldCustomer = new Customer($this->id); $success = parent::update(true); + $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email, false)); return $success; } + public function updateCustomerAdditionalDetails($idCustomerGuest) + { + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest); + $objCustomerGuestDetail->id_customer = 0; + $objCustomerGuestDetail->id_gender = $this->id_gender; + $objCustomerGuestDetail->firstname = $this->firstname; + $objCustomerGuestDetail->lastname = $this->lastname; + $objCustomerGuestDetail->email = $this->email; + $objCustomerGuestDetail->phone = $this->phone; + return $objCustomerGuestDetail->save(); + } + public function delete() { if (!count(Order::getCustomerOrders((int)$this->id))) { @@ -327,6 +344,11 @@ class CustomerCore extends ObjectModel CartRule::deleteByIdCustomer((int)$this->id); // delete customer data from customerGuest table + $objCustomerGuestDetail = new CustomerGuestDetail(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); + $objCustomerGuestDetail->delete(); + $objCustomerGuestDetail = new CustomerGuestDetail(); + $objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->id); + return parent::delete(); } diff --git a/classes/CustomerGuestDetail.php b/classes/CustomerGuestDetail.php index 2bc07b422..84889e592 100644 --- a/classes/CustomerGuestDetail.php +++ b/classes/CustomerGuestDetail.php @@ -45,34 +45,64 @@ class CustomerGuestDetailCore extends ObjectModel ), ); - public static function getCartCustomerGuest($id_cart) + + /** + * Get the customer guest id by id cart. + * + * @param int id_cart + * @return int|false id_customer_guest_detail if exists + */ + public static function getCustomerGuestIdByIdCart($id_cart) { return Db::getInstance()->getValue(' SELECT `id_customer_guest_detail` FROM `'._DB_PREFIX_.'cart_customer_guest` - WHERE `id_cart` = '.(int)$id_cart + WHERE `id_cart` = '.(int) $id_cart ); } - public static function saveCartCustomerGuest($idCart, $idCustomerGuestDetail) + /** + * set the customer guest id for the id cart. + * + * @param int id_cart + * @param int id_customer_guest_detail + * @return bool True on success, false on failure + */ + public static function saveCustomerGuestInCart($idCart, $idCustomerGuestDetail) { - return Db::getInstance()->insert('cart_customer_guest', array( - 'id_cart' => (int) $idCart, - 'id_customer_guest_detail' => (int) $idCustomerGuestDetail - )); + return Db::getInstance()->insert( + 'cart_customer_guest', + array( + 'id_cart' => (int) $idCart, + 'id_customer_guest_detail' => (int) $idCustomerGuestDetail + ) + ); } - public static function deleteCartCustomerGuest($idCart) + /** + * removes the customer guest id for the id cart. + * + * @param int id_cart + * @return bool True on success, false on failure + */ + public static function deleteCustomerGuestInCart($idCart) { - return Db::getInstance()->delete('cart_customer_guest', + return Db::getInstance()->delete( + 'cart_customer_guest', ' `id_cart`='.(int) $idCart ); } + /** + * Removes this guest's ID from all related cart entries. + * + * @return bool True on success, false on failure + */ public function deleteCartCustomerGuestByIdGuest() { - return Db::getInstance()->delete('cart_customer_guest', - ' `id_customer_guest_detail`='.(int) $this->id + return Db::getInstance()->delete( + 'cart_customer_guest', + '`id_customer_guest_detail` = ' . (int) $this->id ); } @@ -83,42 +113,74 @@ class CustomerGuestDetailCore extends ObjectModel return parent::delete(); } + /** + * Deletes the guest profiles created by customer. + * + * @param int id_customer + * @param int offset + * @return bool True on success, false on failure + */ public function deleteCustomerGuestByIdCustomer($idCustomer, $offset = 0) { $res = true; - if ($guests = $this->getCustomerGuestsByIdCustomer($idCustomer, false, false, false, $offset)) { + if (($guests = $this->getCustomerGuestsByIdCustomer($idCustomer)) + && ($guests = array_slice($guests, $offset)) + ) { foreach ($guests as $guest) { $objCustomerGuestDetail = new CustomerGuestDetail((int) $guest['id_customer_guest_detail']); - $objCustomerGuestDetail->delete(); + $res &= $objCustomerGuestDetail->delete(); } } return $res; } - public function getCustomerGuestsByIdCustomer($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) + /** + * Retrieves guest profiles created by a customer using the "booking for someone else" feature. + * + * @param int $idCustomer The customer ID + * @param string $firstname Optional first name filter + * @param string $lastname Optional last name filter + * @param string $email Optional email filter + * @return array List of matching guest profiles + */ + public function getCustomerGuestsByIdCustomer($idCustomer, $firstname = '', $lastname = '', $email = '') { - return Db::getInstance()->executeS(' - SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone` - FROM `'._DB_PREFIX_.'customer_guest_detail` cgd - LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest` ccg - ON (ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`) - WHERE cgd.`id_customer` = '.(int)$idCustomer. - (($firstname !== false && $firstname != '') ? ' AND cgd.`firstname` LIKE "%'.$firstname.'%"' : ' '). - (($lastname !== false && $lastname != '') ? ' AND cgd.`lastname` LIKE "%'.$lastname.'%"' : ' '). - (($email !== false && $email != '') ? ' AND cgd.`email` LIKE "%'.$email.'%"' : ' '). - 'GROUP BY cgd.`id_customer_guest_detail`'. - ' Order BY date_add DESC '. - (($offset) ? ' LIMIT 999999 OFFSET '.(int) $offset : ' ') - ); + $sql = 'SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone` + FROM `' . _DB_PREFIX_ . 'customer_guest_detail` cgd + LEFT JOIN `' . _DB_PREFIX_ . 'cart_customer_guest` ccg + ON ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail` + WHERE cgd.`id_customer` = '.(int) $idCustomer; + + if ($firstname !== '') { + $sql .= ' AND cgd.`firstname` LIKE "%'.pSQL($firstname).'%"'; + } + + if ($lastname !== '') { + $sql .= ' AND cgd.`lastname` LIKE "%'.pSQL($lastname).'%"'; + } + + if ($email !== '') { + $sql .= ' AND cgd.`email` LIKE "%'.pSQL($email).'%"'; + } + + $sql .= ' GROUP BY cgd.`id_customer_guest_detail` ORDER BY cgd.`date_add` DESC'; + + return Db::getInstance()->executeS($sql); } - public static function getCustomerGuestDetail($id_customer_guest_detail) + /** + * Retrieves guest information using the Id. + * + * @param int id_customer_guest_detail + * @return array customer guest details. + */ + public static function getCustomerGuestDetail($idCustomerGuestDetail) { return Db::getInstance()->getRow(' SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone` FROM `'._DB_PREFIX_.'customer_guest_detail` - WHERE `id_customer_guest_detail` = '.(int)$id_customer_guest_detail + WHERE `id_customer_guest_detail` = '.(int) $idCustomerGuestDetail ); } diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 187facb07..a02f50f0c 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -400,9 +400,9 @@ abstract class PaymentModuleCore extends Module } // save customer guest information - if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestIdByIdCart($this->context->cart->id)) { if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail( - $id_customer_guest_detail + $idCustomerGuestDetail ))) { $objOrderCustomerGuestDetail = new OrderCustomerGuestDetail(); $objOrderCustomerGuestDetail->id_gender = $objCustomerGuestDetail->id_gender; @@ -1229,9 +1229,9 @@ abstract class PaymentModuleCore extends Module ); } // send mail to customer guest if customer booked for someone other. - if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) { + if ($idCustomerGuestDetail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) { if ($objOrderCustomerGuestDetail = new OrderCustomerGuestDetail( - $id_customer_guest_detail + $idCustomerGuestDetail )) { if (Validate::isEmail($objOrderCustomerGuestDetail->email)) { $data['{firstname}'] = $objOrderCustomerGuestDetail->firstname; @@ -1384,7 +1384,7 @@ abstract class PaymentModuleCore extends Module } // End foreach $order_detail_list // delete cart feature prices after booking creation success - HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart); + HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart); if (count($cart_rules)) { foreach ($cart_rules as $idCartRule => $cartRule) { diff --git a/classes/checkoutProcess/CheckoutCustomerDetailsStep.php b/classes/checkoutProcess/CheckoutCustomerDetailsStep.php index a51cb3169..c75c4f5f6 100644 --- a/classes/checkoutProcess/CheckoutCustomerDetailsStep.php +++ b/classes/checkoutProcess/CheckoutCustomerDetailsStep.php @@ -39,9 +39,9 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore } } elseif (Tools::getValue('proceed_to_payment')) { $guestInfoComplete = true; - if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestIdByIdCart($this->context->cart->id)) { $guestInfoComplete = false; - $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuestDetail); if ($objCustomerGuestDetail->validateGuestInfo()) { $guestInfoComplete = true; } diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index 14d091f91..76bfa40d6 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -121,14 +121,15 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'bool' ), - 'PS_CUSTOMER_GUEST_MAX_NUM' => array( - 'title' => $this->l('Maximum Customers guests'), - 'hint' => $this->l('Maximum number of guests a customer can add using the "booking for someone else" feature. Set as 0 for no limit.'), + 'PS_CUSTOMER_GUEST_MAX_LIMIT' => array( + 'title' => $this->l('Maximum Guests per Customer'), 'validation' => 'isUnsignedInt', 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'class' => 'fixed-width-xl', + 'hint' => $this->l('Enter the maximum number of guest profiles a customer can create when using the "Booking for Someone Else" option.'), + 'desc' => $this->l('Set as 0 for no limit.') ), ), 'submit' => array( diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 3a0af4c64..6e83dd3bb 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -141,11 +141,6 @@ class AdminCustomersControllerCore extends AdminController 'align' => 'text-right', 'badge_success' => true ), - 'phone' => array( - 'title' => $this->l('Phone'), - 'optional' => true, - 'visible_default' => false, - ), 'active' => array( 'title' => $this->l('Enabled'), 'align' => 'text-center', @@ -1438,27 +1433,30 @@ class AdminCustomersControllerCore extends AdminController // Check tab access is allowed to edit if ($this->tabAccess['edit'] == 1) { if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { - $objCustomerGuestDetail->id_gender = Tools::getValue('id_gender'); - $objCustomerGuestDetail->firstname = Tools::getValue('firstname'); - $objCustomerGuestDetail->lastname = Tools::getValue('lastname'); - $objCustomerGuestDetail->phone = Tools::getValue('phone'); - if ($objCustomerGuestDetail->save()) { - $gender = new Gender($objCustomerGuestDetail->id_gender, $this->context->language->id); - $response['data']['gender'] = $gender->name; - $response['data']['firstname'] = $objCustomerGuestDetail->firstname; - $response['data']['lastname'] = $objCustomerGuestDetail->lastname ; - $response['data']['email'] = $objCustomerGuestDetail->email; - $response['data']['phone'] = $objCustomerGuestDetail->phone; - $response['data']['id'] = $objCustomerGuestDetail->id; - $response['msg'] = $this->l('Guest details are updated.'); - } else { - $response['errors'][] = $this->l('Unable to save guest details.'); + $response['errors'] = $objCustomerGuestDetail->validateController(); + if (!$response['errors']) { + $objCustomerGuestDetail->id_gender = Tools::getValue('id_gender'); + $objCustomerGuestDetail->firstname = Tools::getValue('firstname'); + $objCustomerGuestDetail->lastname = Tools::getValue('lastname'); + $objCustomerGuestDetail->phone = Tools::getValue('phone'); + if ($objCustomerGuestDetail->save()) { + $gender = new Gender($objCustomerGuestDetail->id_gender, $this->context->language->id); + $response['data']['gender'] = $gender->name; + $response['data']['firstname'] = $objCustomerGuestDetail->firstname; + $response['data']['lastname'] = $objCustomerGuestDetail->lastname ; + $response['data']['email'] = $objCustomerGuestDetail->email; + $response['data']['phone'] = $objCustomerGuestDetail->phone; + $response['data']['id'] = $objCustomerGuestDetail->id; + $response['msg'] = $this->l('Guest details are updated.'); + } else { + $response['errors'][] = Tools::displayError('Unable to save guest details.'); + } } } else { - $response['errors'][] = $this->l('Guest details not found.'); + $response['errors'][] = Tools::displayError('Guest details not found.'); } } else { - $response['errors'][] = $this->l('You do not have permission to edit this.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this.'); } if ($response['errors']) { diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index ac66b6486..f8b1642f3 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -556,12 +556,12 @@ class OrderOpcControllerCore extends ParentOrderController $this->_assignPayment(); // GUEST BOOKING if ($this->isLogged) { - if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestIdByIdCart($this->context->cart->id)) { $this->context->smarty->assign( - 'customer_guest_detail', CustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail) + 'customer_guest_detail', CustomerGuestDetail::getCustomerGuestDetail($idCustomerGuestDetail) ); } - $this->context->smarty->assign('id_customer_guest_detail', $id_customer_guest_detail); + $this->context->smarty->assign('id_customer_guest_detail', $idCustomerGuestDetail); } Tools::safePostVars(); @@ -1085,10 +1085,10 @@ class OrderOpcControllerCore extends ParentOrderController $this->context->cart->id_customer, $firstname, $lastname, - $email, + $email )) { $response['status'] = true; - $response['guestDetails'] = $guestDetails; + $response['guest_details'] = $guestDetails; } return json_encode($response); @@ -1107,10 +1107,10 @@ class OrderOpcControllerCore extends ParentOrderController $customerGuestDetailLastname = Tools::getValue('customer_guest_detail_lastname'); $customerGuestDetailEmail = Tools::getValue('customer_guest_detail_email'); $customerGuestDetailPhone = Tools::getValue('customer_guest_detail_phone'); - if ($id_customer_guest_detail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->cart->id)) { - $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); - } else if ($id_customer_guest_detail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->customer->id, null)) { - $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); + if ($idCustomerGuestDetail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->cart->id)) { + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuestDetail); + } else if ($idCustomerGuestDetail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->customer->id, null)) { + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuestDetail); } else { $objCustomerGuestDetail = new CustomerGuestDetail(); } @@ -1166,19 +1166,19 @@ class OrderOpcControllerCore extends ParentOrderController $objCustomerGuestDetail->phone = $customerGuestDetailPhone; $objCustomerGuestDetail->id_customer = $this->context->customer->id; if ($objCustomerGuestDetail->save()) { - if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_NUM')) { + if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_LIMIT')) { $objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); } // To prevent duplications for the same cart. - CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); - CustomerGuestDetail::saveCartCustomerGuest($this->context->cart->id, $objCustomerGuestDetail->id); + CustomerGuestDetail::deleteCustomerGuestInCart($this->context->cart->id); + CustomerGuestDetail::saveCustomerGuestInCart($this->context->cart->id, $objCustomerGuestDetail->id); Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1))); } } $this->context->smarty->assign('customerGuestDetailErrors', $customerGuestDetailErrors); } else { - CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); + CustomerGuestDetail::deleteCustomerGuestInCart($this->context->cart->id); Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1))); } diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 23012b781..173ff0178 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -950,7 +950,7 @@ 0 - + 5 diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index df3f26a0e..2db984950 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -187,17 +187,15 @@ $(document).ready(function() setCustomerGuestDetailForm(guestDetail); } } else if (!((keyCode < 65 || keyCode > 122) && (keyCode < 48 || keyCode > 57) && (keyCode != 8))) { - $('.customer_guest_detail_ul').remove(); clearTimeout(debounceTimeout); // Clear the existing timeout debounceTimeout = setTimeout(() => { let firstName = ''; let lastName = ''; let email = ''; - let target = false if ($(e.target).prop('id') == 'customer_guest_detail_firstname') { - firstName = $('#customer_guest_detail_firstname').val() + firstName = $('#customer_guest_detail_firstname').val(); } else if ($(e.target).prop('id') == 'customer_guest_detail_lastname') { - lastName = $('#customer_guest_detail_lastname').val() + lastName = $('#customer_guest_detail_lastname').val(); } else if ($(e.target).prop('id') == 'customer_guest_detail_email') { email = $('#customer_guest_detail_email').val(); } @@ -219,11 +217,12 @@ $(document).ready(function() email : email, }, success: function(data) { + $('.customer_guest_detail_ul').remove(); if (data.status) { let listElem = $('
      ').addClass('customer_guest_detail_ul'); - $.each(data.guestDetails, function(index, guestDetail) { - let itemElem = $('
    • ').addClass('customer_guest_detail_li').text(guestDetail.firstname + ' '+ guestDetail.lastname + ' ('+ guestDetail.email+')'); - $(itemElem).attr('data-guest_detail', JSON.stringify(guestDetail)); + $.each(data.guest_details, function(index, guest_detail) { + let itemElem = $('
    • ').addClass('customer_guest_detail_li').text(guest_detail.firstname + ' '+ guest_detail.lastname + ' ('+ guest_detail.email+')'); + $(itemElem).attr('data-guest_detail', JSON.stringify(guest_detail)); $(listElem).append(itemElem); }); if ($(targetElem).prop('id') == 'customer_guest_detail_email') { @@ -233,6 +232,8 @@ $(document).ready(function() } } }); + } else { + $('.customer_guest_detail_ul').remove(); } }, 200); } From 893a93783687cc6d312e30e28d2360f0c76cf353 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 15 May 2025 19:21:25 +0530 Subject: [PATCH 131/143] added comment on the functions in customer guest details class --- classes/CustomerGuestDetail.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/classes/CustomerGuestDetail.php b/classes/CustomerGuestDetail.php index 08944062a..e7ed8b46b 100644 --- a/classes/CustomerGuestDetail.php +++ b/classes/CustomerGuestDetail.php @@ -184,6 +184,12 @@ class CustomerGuestDetailCore extends ObjectModel ); } + /** + * Retrieves guest information using the email. + * + * @param int email + * @return int|false id customer guest details. + */ public static function getIdCustomerGuest($email, $idCustomer = null, $idCart = 0) { return Db::getInstance()->getValue( @@ -196,6 +202,11 @@ class CustomerGuestDetailCore extends ObjectModel ); } + /** + * Validates the Guest profile details. + * + * @return bool return true or false after validating the guest profile. + */ public function validateGuestInfo() { $isValid = true; From a06240e2f6fe9fa8cb341c20c7b916039a14f996 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 16 May 2025 13:16:49 +0530 Subject: [PATCH 132/143] Updated some text and fixed display issue caused due to smarty.post --- .../controllers/products/configuration.tpl | 25 +++++++++------ .../products/helpers/form/form.tpl | 31 ------------------- controllers/admin/AdminProductsController.php | 16 +++++----- 3 files changed, 24 insertions(+), 48 deletions(-) diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 26d38423b..0419331c0 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -71,7 +71,7 @@
    - {if isset($smarty.post.rooms_info) && is_array($smarty.post.rooms_info) && count($smarty.post.rooms_info)} + {if isset($smarty.post.rooms_info) && is_array($smarty.post.rooms_info) && count($smarty.post.rooms_info) && !isset($bulk_delete_rooms)} {assign var="rooms_info" value=$smarty.post.rooms_info} {elseif isset($htl_room_info) && is_array($htl_room_info) && count($htl_room_info)} {assign var="rooms_info" value=$htl_room_info} @@ -81,7 +81,7 @@ {assign var="var_name_room_info" value="rooms_info[`$key`]"} - {hook h='displayHotelRoomListTableRowColumn' index=$key id_room=$room_info['id']} + {* Since the data can also be used from post incase of errors, which will cause issues with the id index *} + {if isset($room_info['id'])} + {hook h='displayHotelRoomListTableRowColumn' index=$key id_room=$room_info['id']} + {else} + {hook h='displayHotelRoomListTableRowColumn' index=$key} + {/if} '; html += ''; html += '
    - -
    - + @@ -109,7 +105,7 @@ {if isset($room_info['id'])} - {if isset($room_info['booked_dates']) && $room_info['booked_dates']} + {if isset($room_info['booked_dates']) && json_decode($room_info['booked_dates'])} {/if} @@ -166,18 +162,35 @@
    @@ -926,17 +939,33 @@ }); $('[name="rooms_checkbox"]').on('change', function() { - if ($(this).hasClass('select_all')) { - $(this).addClass('unselect_all').removeClass('select_all'); - $('[name="bulk_update_room[]"]').prop('checked', true); - } else { - $(this).addClass('select_all').removeClass('unselect_all'); - $('[name="bulk_update_room[]"]').prop('checked', false); - } + BulkUpdateRoomModal.toggleBulkUpdateButton(); + }); + + $('#select-all-rooms').on('click', function(e) { + e.preventDefault(); + $('[type="checkbox"][name="bulk_update_room[]"]').each(function(){ + if (!$(this).prop('disabled')) { + $(this).prop('checked', true); + } + }); + BulkUpdateRoomModal.toggleBulkUpdateButton(); + }); + + $('#unselect-all-rooms').on('click', function(e) { + e.preventDefault(); + $('[type="checkbox"][name="bulk_update_room[]"]').each(function(){ + $(this).prop('checked', false); + }); BulkUpdateRoomModal.toggleBulkUpdateButton(); }); + $('#bulk-delete-rooms-button').on('click', function(e) { + e.preventDefault(); + BulkUpdateRoomModal.submitBulkDelete(); + }); + $(document).on('change', 'select[name="bulk_update_room_status"], select[name="bulk_create_room_status"]', function(){ var status_val = $(this).val(); if (status_val == rm_status.STATUS_TEMPORARY_INACTIVE.id) { @@ -1121,6 +1150,12 @@ } }); }, + submitBulkDelete: function() { + if (confirm("{l s='Delete selected rooms?'}")) { + $('#product_form').append(''); + $('form#product_form').submit(); + } + }, addInvalidRowDataMarkers: function(rowsToHighlight) { if (rowsToHighlight.length != 0) { rowsToHighlight.map(function (rowIndex) { diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 3f9ddbf98..ae67d801c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1430,6 +1430,11 @@ class AdminProductsControllerCore extends AdminController } else { $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } + } + // Room bulk deletion process + else if (Tools::isSubmit('submitBulkDeleteRooms')) { + $this->action = 'bulkDeleteRooms'; + $this->display = 'edit'; } elseif (Tools::isSubmit('submitProductCustomization')) { if ($this->tabAccess['edit'] === '1') { $this->action = 'productCustomization'; @@ -3470,47 +3475,75 @@ class AdminProductsControllerCore extends AdminController } } + public function processBulkDeleteRooms() + { + if ($this->tabAccess['edit'] == 1) { + if ($idRooms = Tools::getValue('bulk_update_room')) { + foreach ($idRooms as $idRoom) { + $objRoomInfo = new HotelRoomInformation((int)$idRoom); + if ($objRoomInfo->getFutureBookings($idRoom)) { + $this->errors[] = sprintf(Tools::displayError('The %s room cannot be deleted as this room contains future booking.'), $objRoomInfo->room_num); + } else { + $objRoomInfo->delete(); + } + } + } else { + $this->errors[] = Tools::displayError('You must select at least one room to delete.'); + } + } else { + $this->errors[] = Tools::displayError('You do not have the permission for this action.'); + } + + if (empty($this->errors)) { + $this->redirect_after = self::$currentIndex.'&id_product='.$this->id_object.'&update'.$this->table.'&conf=2&key_tab=Configuration&token='.$this->token; + } + } + public function processConfiguration() { // Check if save of configuration tab is submitted - if (Tools::getValue('checkConfSubmit')) { - $id_product = Tools::getValue('id_product'); - $id_hotel = Tools::getValue('id_hotel'); + if ($this->tabAccess['edit'] == 1) { + if (Tools::getValue('checkConfSubmit')) { + $id_product = Tools::getValue('id_product'); + $id_hotel = Tools::getValue('id_hotel'); - if (!$id_product || !Validate::isUnsignedInt($id_product)) { - $this->errors[] = Tools::displayError('There is some problem while setting room information.'); - } - if (!$id_hotel || !Validate::isUnsignedInt($id_hotel)) { - $this->errors[] = Tools::displayError('Please select a hotel.'); - } + if (!$id_product || !Validate::isUnsignedInt($id_product)) { + $this->errors[] = Tools::displayError('There is some problem while setting room information.'); + } + if (!$id_hotel || !Validate::isUnsignedInt($id_hotel)) { + $this->errors[] = Tools::displayError('Please select a hotel.'); + } - $this->validateConfigurationPostData(); - if (!count($this->errors)) { - $roomsInfo = Tools::getValue('rooms_info'); - if (is_array($roomsInfo) && count($roomsInfo)) { - foreach ($roomsInfo as $roomInfo) { - $objHotelRoomInfo = null; - if (isset($roomInfo['id']) && $roomInfo['id']) { - $objHotelRoomInfo = new HotelRoomInformation($roomInfo['id']); - } else { - $objHotelRoomInfo = new HotelRoomInformation(); - } - $objHotelRoomInfo->id_product = $id_product; - $objHotelRoomInfo->id_hotel = $id_hotel; - $objHotelRoomInfo->room_num = $roomInfo['room_num']; - $objHotelRoomInfo->id_status = $roomInfo['id_status']; - $objHotelRoomInfo->floor = $roomInfo['floor']; - $objHotelRoomInfo->comment = $roomInfo['comment']; - if ($objHotelRoomInfo->save() - && $objHotelRoomInfo->id_status != HotelRoomInformation::STATUS_TEMPORARY_INACTIVE - ) { - // directly deleting the dates since we are validating the dates using hooks before this. - $objRoomDisableDates = new HotelRoomDisableDates(); - $objRoomDisableDates->deleteRoomDisableDates($objHotelRoomInfo->id); + $this->validateConfigurationPostData(); + if (!count($this->errors)) { + $roomsInfo = Tools::getValue('rooms_info'); + if (is_array($roomsInfo) && count($roomsInfo)) { + foreach ($roomsInfo as $roomInfo) { + $objHotelRoomInfo = null; + if (isset($roomInfo['id']) && $roomInfo['id']) { + $objHotelRoomInfo = new HotelRoomInformation($roomInfo['id']); + } else { + $objHotelRoomInfo = new HotelRoomInformation(); + } + $objHotelRoomInfo->id_product = $id_product; + $objHotelRoomInfo->id_hotel = $id_hotel; + $objHotelRoomInfo->room_num = $roomInfo['room_num']; + $objHotelRoomInfo->id_status = $roomInfo['id_status']; + $objHotelRoomInfo->floor = $roomInfo['floor']; + $objHotelRoomInfo->comment = $roomInfo['comment']; + if ($objHotelRoomInfo->save() + && $objHotelRoomInfo->id_status != HotelRoomInformation::STATUS_TEMPORARY_INACTIVE + ) { + // directly deleting the dates since we are validating the dates using hooks before this. + $objRoomDisableDates = new HotelRoomDisableDates(); + $objRoomDisableDates->deleteRoomDisableDates($objHotelRoomInfo->id); + } } } } } + } else { + $this->errors[] = Tools::displayError('You do not have the permission for this action.'); } } @@ -3570,9 +3603,8 @@ class AdminProductsControllerCore extends AdminController ); if ($this->tabAccess['edit'] == 1) { $idRoom = Tools::getValue('id'); - $objRoomInfo = new HotelRoomInformation((int)$idRoom); - $objHotelRoomInformation = new HotelRoomInformation(); - if ($objHotelRoomInformation->getFutureBookings($idRoom)) { + $objRoomInfo = new HotelRoomInformation((int) $idRoom); + if ($objRoomInfo->getFutureBookings($idRoom)) { $this->errors[] = $this->l('This room cannot be deleted as this room contains future booking.'); } if (empty($this->errors)) { From 65ba68d517c03cbf2f2af271d23188aaade8a05c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 15 May 2025 18:50:06 +0530 Subject: [PATCH 130/143] Updated the functions name, added vaidation in admin guest user update process, and code optimized --- .../customers/helpers/view/view.tpl | 4 +- classes/Customer.php | 30 ++++- classes/CustomerGuestDetail.php | 120 +++++++++++++----- classes/PaymentModule.php | 10 +- .../CheckoutCustomerDetailsStep.php | 4 +- .../AdminCustomerPreferencesController.php | 7 +- .../admin/AdminCustomersController.php | 42 +++--- controllers/front/OrderOpcController.php | 26 ++-- install/data/xml/configuration.xml | 2 +- .../hotel-reservation-theme/js/order-opc.js | 15 ++- 10 files changed, 172 insertions(+), 88 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 432be8ad9..467ea386e 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -688,8 +688,8 @@
    {$customer_guest['firstname']} {$customer_guest['lastname']} {$customer_guest['phone']}
    - + @@ -104,7 +104,12 @@ {if isset($room_info['id'])} {if isset($room_info['booked_dates']) && json_decode($room_info['booked_dates'])} @@ -124,7 +129,7 @@ {assign var="var_name_room_info" value="rooms_info[`$k`]"}
    - + @@ -193,7 +198,7 @@
  • -  {l s='Create Multiple'} +  {l s='Create Rooms'}
  • @@ -615,7 +620,7 @@ var prefix = 'rooms_info['+lengthRooms+']'; html = '
    '; - html += ''; + html += ''; html += ''; html += ''; @@ -938,7 +943,7 @@ DisableDatesObj.allowCalendarActions(); }); - $('[name="bulk_update_room[]"]').on('change', function(){ + $('[name="selected_room_ids[]"]').on('change', function(){ BulkUpdateRoomModal.toggleBulkUpdateButton(); }); @@ -948,7 +953,7 @@ $('#select-all-rooms').on('click', function(e) { e.preventDefault(); - $('[type="checkbox"][name="bulk_update_room[]"]').each(function(){ + $('[type="checkbox"][name="selected_room_ids[]"]').each(function(){ if (!$(this).prop('disabled')) { $(this).prop('checked', true); } @@ -958,7 +963,7 @@ $('#unselect-all-rooms').on('click', function(e) { e.preventDefault(); - $('[type="checkbox"][name="bulk_update_room[]"]').each(function(){ + $('[type="checkbox"][name="selected_room_ids[]"]').each(function(){ $(this).prop('checked', false); }); @@ -1099,7 +1104,7 @@ }, getSelectedRooms: function(){ let selectedRooms = []; - $('[type="checkbox"][name="bulk_update_room[]"]').each(function(){ + $('[type="checkbox"][name="selected_room_ids[]"]').each(function(){ if ($(this).prop('checked')) { selectedRooms.push($(this).val()); } diff --git a/admin/themes/default/template/controllers/products/helpers/form/form.tpl b/admin/themes/default/template/controllers/products/helpers/form/form.tpl index b5cf41519..5a97a1cec 100644 --- a/admin/themes/default/template/controllers/products/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/products/helpers/form/form.tpl @@ -246,37 +246,6 @@ } return typeIsPack; } *} - $("#product_form").validate({ - ignore: '.updateCurrentText', - {* rules: { - inputPackItems: { - required: { - depends: checkIfProductTypeIsPack - }, - } - }, *} - {* messages: { - inputPackItems: { - required: "" - } - }, *} - // override jquery validate plugin defaults for bootstrap 3 - highlight: function(element) { - $(element).closest('.form-group').addClass('has-error'); - }, - unhighlight: function(element) { - $(element).closest('.form-group').removeClass('has-error'); - }, - errorElement: 'span', - errorClass: 'help-block', - errorPlacement: function(error, element) { - if(element.parent('.input-group').length) { - error.insertAfter(element.parent()); - } else { - error.insertAfter(element); - } - } - }); }); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 7e0f488ae..97458ddeb 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3542,7 +3542,7 @@ class AdminProductsControllerCore extends AdminController public function processBulkDeleteRooms() { if ($this->tabAccess['edit'] == 1) { - if ($idRooms = Tools::getValue('bulk_update_room')) { + if ($idRooms = Tools::getValue('selected_room_ids')) { foreach ($idRooms as $idRoom) { $objRoomInfo = new HotelRoomInformation((int)$idRoom); if ($objRoomInfo->getFutureBookings($idRoom)) { @@ -3560,6 +3560,8 @@ class AdminProductsControllerCore extends AdminController if (empty($this->errors)) { $this->redirect_after = self::$currentIndex.'&id_product='.$this->id_object.'&update'.$this->table.'&conf=2&key_tab=Configuration&token='.$this->token; + } else { + $this->context->smarty->assign('bulk_delete_rooms', true); } } @@ -3591,10 +3593,10 @@ class AdminProductsControllerCore extends AdminController } $objHotelRoomInfo->id_product = $id_product; $objHotelRoomInfo->id_hotel = $id_hotel; - $objHotelRoomInfo->room_num = $roomInfo['room_num']; + $objHotelRoomInfo->room_num = trim($roomInfo['room_num']); $objHotelRoomInfo->id_status = $roomInfo['id_status']; - $objHotelRoomInfo->floor = $roomInfo['floor']; - $objHotelRoomInfo->comment = $roomInfo['comment']; + $objHotelRoomInfo->floor = trim($roomInfo['floor']); + $objHotelRoomInfo->comment = trim($roomInfo['comment']); if ($objHotelRoomInfo->save() && $objHotelRoomInfo->id_status != HotelRoomInformation::STATUS_TEMPORARY_INACTIVE ) { @@ -3616,7 +3618,7 @@ class AdminProductsControllerCore extends AdminController $roomsInfo = Tools::getValue('rooms_info'); if (is_array($roomsInfo) && count($roomsInfo)) { foreach ($roomsInfo as $key => $roomInfo) { - if (!$roomInfo['room_num']) { + if (!trim($roomInfo['room_num'])) { unset($_POST['rooms_info'][$key]); } } @@ -5416,7 +5418,7 @@ class AdminProductsControllerCore extends AdminController $this->ajaxDie(json_encode($response)); } - public function ajaxProcessbulkCreateRooms() + public function ajaxProcessBulkCreateRooms() { $response = array('status' => false); if ($this->tabAccess['edit'] === '1') { @@ -5497,7 +5499,7 @@ class AdminProductsControllerCore extends AdminController $objHotelRoomInfo->id_product = $objProduct->id; $objHotelRoomInfo->id_hotel = $idHotel; $objHotelRoomInfo->id_status = $roomsInfo['id_status']; - $objHotelRoomInfo->room_num = $roomNum; + $objHotelRoomInfo->room_num = trim($roomNum); if (isset($roomsInfo['floor']) && $roomsInfo['floor'] != '') { $objHotelRoomInfo->floor = $roomsInfo['floor']; From bc24f6beafbcb71902ca955193159e7b17b85b75 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 16 May 2025 15:19:58 +0530 Subject: [PATCH 133/143] Removed non required comment --- controllers/admin/AdminAddressesController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 13aef7481..51e7a7817 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -474,7 +474,6 @@ class AdminAddressesControllerCore extends AdminController $this->_redirect = false; // set deleted=1 as customer can have only one address and this address is for an order only $_POST['deleted'] = 1; - // Clearing the cache for customer address. // if the deleted address is the customer current address then we will create a new one using the same information. if (($customerAddressId = Address::getFirstCustomerAddressId((int) $address->id_customer)) && $customerAddressId == $address->id From 2d6bc3ef6ede674718a98c3c024ef45a843e64c1 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 16 May 2025 15:43:57 +0530 Subject: [PATCH 134/143] added more validation to customer guest, fixed issue after merge --- .../admin/AdminCustomersController.php | 20 +++++++++++-------- controllers/front/AuthController.php | 8 -------- controllers/front/IdentityController.php | 11 +--------- controllers/front/OrderOpcController.php | 11 +--------- .../templates/hook/roomTypePageSearch.tpl | 2 +- 5 files changed, 15 insertions(+), 37 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 5dda3e009..39d33f6b7 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1224,14 +1224,6 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Phone number is required.'); } } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - if ($phone && !Validate::isPhoneNumber($phone)) { - $this->errors[] = Tools::displayError('Invaid phone number.'); - } elseif ($phone && Tools::strlen($phone) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']); - } - $customer = new Customer(); $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase()); @@ -1478,6 +1470,18 @@ class AdminCustomersControllerCore extends AdminController if ($this->tabAccess['edit'] == 1) { if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { $response['errors'] = $objCustomerGuestDetail->validateController(); + if (!Tools::getValue('lastname')) { + $response['errors']['lastname'] = Tools::displayError('lastname is required'); + } + if (!Tools::getValue('firstname')) { + $response['errors']['firstname'] = Tools::displayError('firstname is required'); + } + if (!Tools::getValue('email')) { + $response['errors']['email'] = Tools::displayError('email is required'); + } + if (!Tools::getValue('phone')) { + $response['errors']['phone'] = Tools::displayError('phone is required'); + } if (!$response['errors']) { $objCustomerGuestDetail->id_gender = Tools::getValue('id_gender'); $objCustomerGuestDetail->firstname = Tools::getValue('firstname'); diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 573ba8a0f..7f2dd8e4e 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -422,16 +422,8 @@ class AuthControllerCore extends FrontController $addresses_types[] = 'address_invoice'; } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone')) { $this->errors[] = Tools::displayError('Phone number is required.'); - } else { - if (Tools::getValue('phone') && !Validate::isPhoneNumber(Tools::getValue('phone'))) { - $this->errors[] = Tools::displayError('Invald phone number.'); - } elseif (Tools::getValue('phone') && Tools::strlen(Tools::getValue('phone')) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']); - } } if (!Tools::getValue('is_new_customer', 1)) { diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 04fb339de..917e301f4 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -89,17 +89,8 @@ class IdentityControllerCore extends FrontController } } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - if ($phone && !Validate::isPhoneNumber($phone)) { - $this->errors[] = Tools::displayError('Invaid phone number.'); - } elseif ($phone && Tools::strlen($phone) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']);; - } else { - $this->customer->phone = $phone; - } - if (!count($this->errors)) { + $this->customer->phone = $phone; $this->customer->id_default_group = (int)$prev_id_default_group; $this->customer->firstname = Tools::ucwords($this->customer->firstname); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index dcc3c7cd0..cc4400375 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -120,16 +120,7 @@ class OrderOpcControllerCore extends ParentOrderController $this->errors[] = Tools::displayError('Phone number is a required field.', false); } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - if (!Validate::isPhoneNumber($phone)) { - $this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false); - } elseif (Tools::strlen($phone) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Mobile phone number is too long. (%s chars max).'), $rules['size']['phone']); - } else { - $this->context->customer->phone = $phone; - } - + $this->context->customer->phone = $phone; $_POST['lastname'] = $_POST['customer_lastname']; $_POST['firstname'] = $_POST['customer_firstname']; $this->errors = array_merge($this->errors, $this->context->customer->validateController()); diff --git a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl index 993330afe..4ff2f46f8 100644 --- a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl @@ -35,7 +35,7 @@
    - {$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']} {$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} - {$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if}) {/if} + {$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']} {if (isset($search_data['date_from']))}{$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} - {if isset($search_data['date_to'])}{$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if}) {/if}
    From 56e9a1884d8b0ac528fdbd939e02ba61afa52409 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 16 May 2025 18:40:17 +0530 Subject: [PATCH 135/143] Fixed responsive design issues for proprties list, renamed properties controller to our properties controller --- classes/controller/FrontController.php | 2 +- controllers/front/ContactController.php | 6 +- ...roller.php => OurPropertiesController.php} | 37 ++- install/data/xml/meta.xml | 4 +- install/langs/bg/data/meta.xml | 4 +- install/langs/bn/data/meta.xml | 6 +- install/langs/br/data/meta.xml | 6 +- install/langs/cs/data/meta.xml | 4 +- install/langs/de/data/meta.xml | 4 +- install/langs/en/data/meta.xml | 4 +- install/langs/es/data/meta.xml | 4 +- install/langs/fa/data/meta.xml | 4 +- install/langs/fr/data/meta.xml | 4 +- install/langs/he/data/meta.xml | 4 +- install/langs/hr/data/meta.xml | 6 +- install/langs/hu/data/meta.xml | 6 +- install/langs/id/data/meta.xml | 4 +- install/langs/it/data/meta.xml | 4 +- install/langs/lt/data/meta.xml | 6 +- install/langs/mk/data/meta.xml | 6 +- install/langs/no/data/meta.xml | 6 +- install/langs/pl/data/meta.xml | 4 +- install/langs/pt/data/meta.xml | 4 +- install/langs/ro/data/meta.xml | 4 +- install/langs/ru/data/meta.xml | 4 +- install/langs/si/data/meta.xml | 6 +- install/langs/sr/data/meta.xml | 6 +- install/langs/sv/data/meta.xml | 6 +- install/langs/tw/data/meta.xml | 4 +- install/langs/vn/data/meta.xml | 6 +- install/langs/zh/data/meta.xml | 6 +- .../classes/WkCustomNavigationLink.php | 130 ++++---- modules/blockuserinfo/nav.tpl | 5 - .../classes/HotelHelper.php | 2 +- .../AdminHotelGeneralSettingsController.php | 262 ++++++++-------- .../hotelreservationsystem.php | 2 +- .../views/js/HotelReservationAdmin.js | 8 +- .../hotel_general_settings/helpers/index.php | 33 ++ .../helpers/options/index.php | 32 ++ .../helpers/options/options.tpl | 60 ++++ .../admin/hotel_general_settings/index.php | 33 ++ .../hotel-reservation-theme/contact-form.tpl | 2 +- .../css/contact-form.css | 6 - themes/hotel-reservation-theme/css/global.css | 7 +- .../modules/blockuserinfo/blockuserinfo.css | 5 - .../css/our-properties.css | 149 +++++++++ .../css/properties.css | 286 ------------------ themes/hotel-reservation-theme/header.tpl | 158 +--------- .../js/{properties.js => our-properties.js} | 7 +- .../modules/blockuserinfo/nav.tpl | 5 - .../{properties.tpl => our-properties.tpl} | 16 +- 51 files changed, 622 insertions(+), 767 deletions(-) rename controllers/front/{PropertiesController.php => OurPropertiesController.php} (82%) create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/options/index.php create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/options/options.tpl create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php create mode 100644 themes/hotel-reservation-theme/css/our-properties.css delete mode 100644 themes/hotel-reservation-theme/css/properties.css rename themes/hotel-reservation-theme/js/{properties.js => our-properties.js} (93%) rename themes/hotel-reservation-theme/{properties.tpl => our-properties.tpl} (86%) diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index bda5ecd12..6c261e009 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1192,7 +1192,7 @@ class FrontControllerCore extends Controller 'token' => Tools::getToken(), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int)Tools::getValue('content_only'), - 'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => Configuration::get('WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER'), + 'WK_DISPLAY_PROPERTIES_LINK_IN_HEADER' => Configuration::get('WK_DISPLAY_PROPERTIES_LINK_IN_HEADER'), )); $this->context->smarty->assign($this->initLogoAndFavicon()); diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index ace49d894..731780e78 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -286,7 +286,7 @@ class ContactControllerCore extends FrontController $shopAddress = ''; $shopAddress_obj = $objShop->getAddress(); if (isset($shopAddress_obj) && $shopAddress_obj instanceof Address) { - $shopAddress = AddressFormat::generateAddress($shopAddress_obj, array(), ' - ', ' '); + $shopAddress = AddressFormat::generateAddress($shopAddress_obj, array(), ', ', ' '); } $gblHtlAddress = $shopAddress; @@ -317,12 +317,12 @@ class ContactControllerCore extends FrontController $contactKey = md5(uniqid(microtime(), true)); $this->context->cookie->__set('contactFormKey', $contactKey); - $displayHotelMap = Configuration::get('WK_CONTACT_DISPLAY_HOTEL_MAP'); + $displayHotelMap = Configuration::get('WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP'); $this->context->smarty->assign( array( 'hotelsInfo' => $hotelsInfo, 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), - 'displayHotels' => Configuration::get('WK_CONTACT_DISPLAY_HOTEL_LIST'), + 'displayHotels' => Configuration::get('WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST'), 'gblHtlPhone' => $gblHtlPhone, 'gblHtlEmail' => $gblHtlEmail, 'displayHotelMap' => $displayHotelMap, diff --git a/controllers/front/PropertiesController.php b/controllers/front/OurPropertiesController.php similarity index 82% rename from controllers/front/PropertiesController.php rename to controllers/front/OurPropertiesController.php index 6736c9ac7..cb651ba1b 100644 --- a/controllers/front/PropertiesController.php +++ b/controllers/front/OurPropertiesController.php @@ -21,9 +21,9 @@ * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 */ -class PropertiesControllerCore extends FrontController +class OurPropertiesControllerCore extends FrontController { - public $php_self = 'properties'; + public $php_self = 'our-properties'; /** * Assign template vars related to page content @@ -38,29 +38,28 @@ class PropertiesControllerCore extends FrontController $hotelsInfo = array(); $hotelLocationArray = 0; $pageLimit = 0; - $displayHotelMap = Configuration::get('WK_PROPERTIES_DISPLAY_HOTEL_MAP'); + $displayHotelMap = Configuration::get('WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP'); if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) { $objModule = Module::getInstanceByName('hotelreservationsystem'); $objHotelInfo = new HotelBranchInformation(); if ($hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1, 1)) { - foreach ($hotelsInfo as &$hotel) { + $hotelIconDefault = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + foreach ($hotelsInfo as $hotelKey => $hotel) { if (isset($hotel['id_cover_img']) && $hotel['id_cover_img'] - && Validate::isLoadedObject( - $objHotelImage = new HotelImage($hotel['id_cover_img']) - ) + && Validate::isLoadedObject($objHotelImage = new HotelImage($hotel['id_cover_img'])) ) { $htlImgLink = $this->context->link->getMediaLink($objHotelImage->getImageLink($hotel['id_cover_img'], ImageType::getFormatedName('medium'))); if ((bool)Tools::file_get_contents($htlImgLink)) { - $hotel['image_url'] = $htlImgLink; + $hotelsInfo[$hotelKey]['image_url'] = $htlImgLink; } else { - $hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + $hotelsInfo[$hotelKey]['image_url'] = $hotelIconDefault; } } else { - $hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + $hotelsInfo[$hotelKey]['image_url'] = $hotelIconDefault; } - $hotel['view_rooms_link'] = $this->context->link->getCategoryLink( + $hotelsInfo[$hotelKey]['view_rooms_link'] = $this->context->link->getCategoryLink( new Category($hotel['id_category'], $this->context->language->id), null, $this->context->language->id @@ -69,10 +68,9 @@ class PropertiesControllerCore extends FrontController // To store max number pages. $pageLimit = ceil(count($hotelsInfo)/10); - - if (!($page = Tools::getValue('pagination'))) { - $page = 1; - } else if (!$pageLimit || ($page > $pageLimit)) { + if (!($page = Tools::getValue('pagination')) + || (!$pageLimit || ($page > $pageLimit)) + ) { $page = 1; } @@ -133,18 +131,18 @@ class PropertiesControllerCore extends FrontController 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), 'displayHotelMap' => $displayHotelMap, 'WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id), - 'currentIndex' => $this->context->link->getPageLink('properties') + 'currentIndex' => $this->context->link->getPageLink('our-properties') ) ); - $this->setTemplate(_PS_THEME_DIR_.'properties.tpl'); + $this->setTemplate(_PS_THEME_DIR_.'our-properties.tpl'); } public function setMedia() { parent::setMedia(); - $this->addJS(_THEME_JS_DIR_.'properties.js'); - $this->addCSS(_THEME_CSS_DIR_.'properties.css'); + $this->addJS(_THEME_JS_DIR_.'our-properties.js'); + $this->addCSS(_THEME_CSS_DIR_.'our-properties.css'); // GOOGLE MAP if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { Media::addJsDef( @@ -152,6 +150,7 @@ class PropertiesControllerCore extends FrontController 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), ) ); + $this->addJS( 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY. '&libraries=places&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code diff --git a/install/data/xml/meta.xml b/install/data/xml/meta.xml index baf678639..4c9a0b225 100644 --- a/install/data/xml/meta.xml +++ b/install/data/xml/meta.xml @@ -148,8 +148,8 @@ products-comparison 1 - - properties + + our-properties 1 diff --git a/install/langs/bg/data/meta.xml b/install/langs/bg/data/meta.xml index 75cac4ceb..2cb836a57 100644 --- a/install/langs/bg/data/meta.xml +++ b/install/langs/bg/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/bn/data/meta.xml b/install/langs/bn/data/meta.xml index fcab2be9b..57422b652 100644 --- a/install/langs/bn/data/meta.xml +++ b/install/langs/bn/data/meta.xml @@ -126,11 +126,11 @@ order-slip - - আমাদের সম্পত্তি + + আমাদের সম্পত্তিসমূহ - properties + our-properties অর্ডার diff --git a/install/langs/br/data/meta.xml b/install/langs/br/data/meta.xml index c4a4e3040..064e8ab57 100644 --- a/install/langs/br/data/meta.xml +++ b/install/langs/br/data/meta.xml @@ -120,11 +120,11 @@ acompanhar-meu-pedido - - Hon tiez + + Nossas propriedades - properties + our-properties Nota do pedido diff --git a/install/langs/cs/data/meta.xml b/install/langs/cs/data/meta.xml index af7021abc..c566a1a06 100644 --- a/install/langs/cs/data/meta.xml +++ b/install/langs/cs/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Naše nemovitosti - properties + our-properties Dobropis diff --git a/install/langs/de/data/meta.xml b/install/langs/de/data/meta.xml index 122c98d9f..f79a747c2 100644 --- a/install/langs/de/data/meta.xml +++ b/install/langs/de/data/meta.xml @@ -120,11 +120,11 @@ bestellungsverfolgung - + Unsere Immobilien - properties + our-properties Bestellschein diff --git a/install/langs/en/data/meta.xml b/install/langs/en/data/meta.xml index 6ef63e6ce..531c61efb 100644 --- a/install/langs/en/data/meta.xml +++ b/install/langs/en/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/es/data/meta.xml b/install/langs/es/data/meta.xml index aff9d5fd1..ba7665bca 100644 --- a/install/langs/es/data/meta.xml +++ b/install/langs/es/data/meta.xml @@ -120,11 +120,11 @@ seguimiento-pedido - + Nuestras propiedades - properties + our-properties Albarán diff --git a/install/langs/fa/data/meta.xml b/install/langs/fa/data/meta.xml index 61169ac9e..6cccce71b 100644 --- a/install/langs/fa/data/meta.xml +++ b/install/langs/fa/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + املاک ما - properties + our-properties رسید سفارش diff --git a/install/langs/fr/data/meta.xml b/install/langs/fr/data/meta.xml index 7fa6887f3..5939be426 100644 --- a/install/langs/fr/data/meta.xml +++ b/install/langs/fr/data/meta.xml @@ -120,11 +120,11 @@ suivi-commande - + Nos propriétés - properties + our-properties Avoirs diff --git a/install/langs/he/data/meta.xml b/install/langs/he/data/meta.xml index 2f8901f8b..758bcf4fb 100644 --- a/install/langs/he/data/meta.xml +++ b/install/langs/he/data/meta.xml @@ -120,11 +120,11 @@ מעקב-הזמנות - + הנכסים שלנו - properties + our-properties שוברי הזמנה diff --git a/install/langs/hr/data/meta.xml b/install/langs/hr/data/meta.xml index b30583cc6..7057dfacb 100644 --- a/install/langs/hr/data/meta.xml +++ b/install/langs/hr/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/hu/data/meta.xml b/install/langs/hu/data/meta.xml index 645914dfb..8d36562c3 100644 --- a/install/langs/hu/data/meta.xml +++ b/install/langs/hu/data/meta.xml @@ -126,11 +126,11 @@ order-slip - - Our hotels + + Our Properties - properties + our-properties Order diff --git a/install/langs/id/data/meta.xml b/install/langs/id/data/meta.xml index eb35396ec..77819f8cd 100644 --- a/install/langs/id/data/meta.xml +++ b/install/langs/id/data/meta.xml @@ -120,11 +120,11 @@ pantau-order - + Properti kami - properties + our-properties Slip order diff --git a/install/langs/it/data/meta.xml b/install/langs/it/data/meta.xml index 015e87498..22485f8c0 100644 --- a/install/langs/it/data/meta.xml +++ b/install/langs/it/data/meta.xml @@ -126,11 +126,11 @@ buono-ordine - + Le nostre proprietà - properties + our-properties Ordine diff --git a/install/langs/lt/data/meta.xml b/install/langs/lt/data/meta.xml index a540934af..3a18628ef 100644 --- a/install/langs/lt/data/meta.xml +++ b/install/langs/lt/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/mk/data/meta.xml b/install/langs/mk/data/meta.xml index 1ed8250c1..541576642 100644 --- a/install/langs/mk/data/meta.xml +++ b/install/langs/mk/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Order slip diff --git a/install/langs/no/data/meta.xml b/install/langs/no/data/meta.xml index 520a9144c..9fb17959f 100644 --- a/install/langs/no/data/meta.xml +++ b/install/langs/no/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Order slip diff --git a/install/langs/pl/data/meta.xml b/install/langs/pl/data/meta.xml index 69ccaf61d..0934c53e1 100644 --- a/install/langs/pl/data/meta.xml +++ b/install/langs/pl/data/meta.xml @@ -120,11 +120,11 @@ sledzenie-zamowienia - + Nasze nieruchomości - properties + our-properties Pokwitowania diff --git a/install/langs/pt/data/meta.xml b/install/langs/pt/data/meta.xml index 7df1881fe..25504b1e0 100644 --- a/install/langs/pt/data/meta.xml +++ b/install/langs/pt/data/meta.xml @@ -120,11 +120,11 @@ acompanhar-encomenda - + Nossas propriedades - properties + our-properties Nota de Encomenda diff --git a/install/langs/ro/data/meta.xml b/install/langs/ro/data/meta.xml index 2f7d3e2c8..1183e23ba 100644 --- a/install/langs/ro/data/meta.xml +++ b/install/langs/ro/data/meta.xml @@ -120,11 +120,11 @@ returnari - + Proprietățile noastre - properties + our-properties Bon de comandă diff --git a/install/langs/ru/data/meta.xml b/install/langs/ru/data/meta.xml index 9bc9533da..f32b4d38c 100644 --- a/install/langs/ru/data/meta.xml +++ b/install/langs/ru/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Наши объекты - properties + our-properties Бланк заказа diff --git a/install/langs/si/data/meta.xml b/install/langs/si/data/meta.xml index bd7005158..33e1e78b2 100644 --- a/install/langs/si/data/meta.xml +++ b/install/langs/si/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/sr/data/meta.xml b/install/langs/sr/data/meta.xml index 9b5583bfc..1c68f04c5 100644 --- a/install/langs/sr/data/meta.xml +++ b/install/langs/sr/data/meta.xml @@ -114,11 +114,11 @@ my-account - - Our hotels + + Our Properties - properties + our-properties Order follow diff --git a/install/langs/sv/data/meta.xml b/install/langs/sv/data/meta.xml index 335207a91..0c8036887 100644 --- a/install/langs/sv/data/meta.xml +++ b/install/langs/sv/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/tw/data/meta.xml b/install/langs/tw/data/meta.xml index 6399d418a..c1a2ca7ed 100644 --- a/install/langs/tw/data/meta.xml +++ b/install/langs/tw/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + 我們的物業 - properties + our-properties 訂購單 diff --git a/install/langs/vn/data/meta.xml b/install/langs/vn/data/meta.xml index 485fbd516..69a0bba3d 100644 --- a/install/langs/vn/data/meta.xml +++ b/install/langs/vn/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Tài sản của chúng tôi + + Các bất động sản của chúng tôi - properties + our-properties Phiếu tín dụng diff --git a/install/langs/zh/data/meta.xml b/install/langs/zh/data/meta.xml index 4b15cc6a6..9fb5a12ce 100644 --- a/install/langs/zh/data/meta.xml +++ b/install/langs/zh/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Order slip diff --git a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php index 5346c4320..5911514a4 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -149,37 +149,6 @@ class WkCustomNavigationLink extends ObjectModel public function insertDemoData($populateData = null) { - //insert home link to the list - $languages = Language::getLanguages(false); - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = 'Home'; - } - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->is_custom_link = 0; - $objCustomNavigationLink->link = 'index'; - $objCustomNavigationLink->save(); - - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = 'Our hotels'; - } - - $https_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; - $objLink = new Link($https_link, $https_link); - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->link = $objLink->getPageLink('properties'); - $objCustomNavigationLink->is_custom_link = 1; - $objCustomNavigationLink->save(); - // enter modules links $modsElems = array(); // if module is installing or resetting @@ -206,51 +175,86 @@ class WkCustomNavigationLink extends ObjectModel } } + //insert home link to the list + $languages = Language::getLanguages(false); + $https_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; + $objLink = new Link($https_link, $https_link); + + $navigationLinks = array( + array( + 'name' => 'Home', + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 0, + 'link' => 'index', + ), + array( + 'name' => 'Our Properties', + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 1, + 'link' => $objLink->getPageLink('our-properties'), + ), + ); + if ($modsElems) { $indexLink = Context::getContext()->shop->getBaseURI(); foreach ($modsElems as $name => $modElm) { - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = $name; - } - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->link = $indexLink.'#'.$modElm; - $objCustomNavigationLink->is_custom_link = 1; - $objCustomNavigationLink->save(); + $navigationLinks[] = array( + 'name' => $name, + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 1, + 'link' => $indexLink.'#'.$modElm + ); } } + // enter CMS pages data if ($cmsPagesCMS = CMS::getCMSPages(Configuration::get('PS_LANG_DEFAULT'), 1)) { $showAtNavigation = 0; foreach ($cmsPagesCMS as $cmsPage) { - $objCustomNavigationLink = new WkCustomNavigationLink(); - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = $cmsPage['id_cms']; - $objCustomNavigationLink->show_at_navigation = $showAtNavigation; - $objCustomNavigationLink->show_at_footer = 1; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->is_custom_link = 0; - $objCustomNavigationLink->save(); + $navigationLinks[] = array( + 'id_cms' => $cmsPage['id_cms'], + 'show_at_navigation' => $showAtNavigation, + 'show_at_footer' => 1, + 'is_custom_link' => 0, + ); $showAtNavigation = !$showAtNavigation; } } - //insert contact link to the list - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = 'Contact Us'; + + $navigationLinks[] = array( + 'name' => 'Contact Us', + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 0, + 'link' => 'contact', + ); + foreach ($navigationLinks as $navigationLink) { + $objCustomNavigationLink = new WkCustomNavigationLink(); + if (isset($navigationLink['name'])) { + foreach ($languages as $language) { + $objCustomNavigationLink->name[$language['id_lang']] = $navigationLink['name']; + } + } + + $objCustomNavigationLink->position = $this->getHigherPosition(); + $objCustomNavigationLink->id_cms = $navigationLink['id_cms']; + $objCustomNavigationLink->show_at_navigation = $navigationLink['show_at_navigation']; + $objCustomNavigationLink->show_at_footer = $navigationLink['show_at_footer']; + $objCustomNavigationLink->active = 1; + if (isset($navigationLink['link'])) { + $objCustomNavigationLink->link = $navigationLink['link']; + } + + $objCustomNavigationLink->is_custom_link = $navigationLink['is_custom_link']; + $objCustomNavigationLink->save(); } - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->is_custom_link = 0; - $objCustomNavigationLink->link = 'contact'; - $objCustomNavigationLink->save(); return true; } diff --git a/modules/blockuserinfo/nav.tpl b/modules/blockuserinfo/nav.tpl index ffd9f239d..8b124e6f5 100644 --- a/modules/blockuserinfo/nav.tpl +++ b/modules/blockuserinfo/nav.tpl @@ -48,11 +48,6 @@ {/if} {if !isset($ajaxCustomerLogin)} - {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} - - {/if} {/if} {/block} diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 168477269..05d066e7e 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -1050,7 +1050,7 @@ class HotelHelper Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', '0987654321'); Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', 'hotelprime@htl.com'); - Configuration::updateValue('WK_CONTACT_DISPLAY_HOTEL_LIST', 0); + Configuration::updateValue('WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST', 0); Configuration::updateValue('WK_TITLE_HEADER_BLOCK', $home_banner_default_title); Configuration::updateValue('WK_CONTENT_HEADER_BLOCK', $home_banner_default_content); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index c4018fe58..ca6e55912 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -40,6 +40,17 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController } $hotelNameDisable = (count($hotelsInfo) > 1 ? true : false); $locationDisable = ((count($hotelsInfo) < 2) && !Configuration::get('WK_HOTEL_NAME_ENABLE')) ? true : false; + + $countryList = array(); + $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); + foreach (Country::getCountries($this->context->language->id) as $country) { + $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); + } + $stateList = array(); + $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); + foreach (State::getStates($this->context->language->id) as $state) { + $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); + } $this->fields_options = array( 'hotelsearchpanel' => array( 'icon' => 'icon-search', @@ -147,23 +158,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'identifier' => 'id', 'list' => $hotelsInfo, ), - 'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => array( - 'title' => $this->l('Display "Our Hotels" tab in menu'), - 'cast' => 'intval', - 'type' => 'bool', - 'default' => '0', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - ), - array( - 'id' => 'active_off', - 'value' => 0, - ), - ), - 'hint' => $this->l('Display "Our Hotels" tab in menu in top in the front office'), - ), 'WK_HTL_ESTABLISHMENT_YEAR' => array( 'title' => $this->l('Website Launch Year'), 'hint' => $this->l('The year when your hotel site was launched.'), @@ -178,6 +172,40 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'name' => 'WK_HOTEL_HEADER_IMAGE', 'url' => _PS_IMG_, ), + 'WK_DISPLAY_PROPERTIES_LINK_IN_HEADER' => array( + 'title' => $this->l('Display Our Properties link in Header'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Display Our Properties link in header in the front office'), + ), + 'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST' => array( + 'title' => $this->l('Display Contact Page Hotel List'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Enable to display hotels list on the contact us page.'), + ), ), 'submit' => array('title' => $this->l('Save')), ), @@ -197,23 +225,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'hint' => $this->l('The email used for customer service. It will be shown on navigation bar.'), 'class' => 'fixed-width-xxl', ), - 'WK_CONTACT_DISPLAY_HOTEL_LIST' => array( - 'title' => $this->l('Display Hotels On Contact Page'), - 'cast' => 'intval', - 'type' => 'bool', - 'default' => '0', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - ), - array( - 'id' => 'active_off', - 'value' => 0, - ), - ), - 'hint' => $this->l('Enable to display hotels list on the contact us page.'), - ), ), 'submit' => array( 'title' => $this->l('Save'), @@ -222,7 +233,83 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'websitedetail' => array( 'title' => $this->l('Website Contact Details'), 'icon' => 'icon-user', - 'fields' => $this->_getDefaultFieldsContent(), + 'fields' => array( + 'PS_SHOP_NAME' => array( + 'title' => $this->l('Website name'), + 'hint' => $this->l('Displayed in emails and page titles.'), + 'validation' => 'isGenericName', + 'required' => true, + 'type' => 'text', + 'no_escape' => true, + ), + 'PS_SHOP_EMAIL' => array( + 'title' => $this->l('Website email'), + 'hint' => $this->l('Displayed in emails sent to customers and on Contact Us page.'), + 'validation' => 'isEmail', + 'required' => true, + 'type' => 'text' + ), + 'PS_SHOP_PHONE' => array( + 'title' => $this->l('Phone'), + 'validation' => 'isGenericName', + 'required' => true, + 'type' => 'text', + 'hint' => $this->l('The phone number of the main branch.'), + ), + 'PS_SHOP_ADDR1' => array( + 'title' => $this->l('Address line 1'), + 'validation' => 'isAddress', + 'type' => 'text', + 'hint' => $this->l('The address of the main branch.'), + 'isCleanHtml' => true, + 'required' => true, + ), + 'PS_SHOP_ADDR2' => array( + 'title' => $this->l('Address line 2'), + 'validation' => 'isAddress', + 'type' => 'text' + ), + 'PS_SHOP_CODE' => array( + 'title' => $this->l('Zip/postal code'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + 'PS_SHOP_CITY' => array( + 'title' => $this->l('City'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + 'PS_SHOP_COUNTRY_ID' => array( + 'title' => $this->l('Country'), + 'validation' => 'isInt', + 'type' => 'select', + 'list' => $countryList, + 'identifier' => 'id', + 'cast' => 'intval', + 'defaultValue' => (int)$this->context->country->id + ), + 'PS_SHOP_STATE_ID' => array( + 'title' => $this->l('State'), + 'validation' => 'isInt', + 'type' => 'select', + 'list' => $stateList, + 'identifier' => 'id', + 'cast' => 'intval' + ), + 'PS_SHOP_DETAILS' => array( + 'title' => $this->l('Registration number'), + 'hint' => $this->l('Website registration information (e.g. SIRET or RCS).'), + 'validation' => 'isGenericName', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5 + ), + 'PS_SHOP_FAX' => array( + 'title' => $this->l('Fax'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + ), 'submit' => array( 'title' => $this->l('Save'), ), @@ -344,8 +431,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController ), 'hint' => $this->l('If yes, only active hotels will be displayed on map.'), ), - 'WK_PROPERTIES_DISPLAY_HOTEL_MAP' => array( - 'title' => $this->l('Display Hotels Map On Properties Page'), + 'WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP' => array( + 'title' => $this->l('Display Our Properties page Google map'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0', @@ -359,10 +446,10 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'value' => 0, ), ), - 'hint' => $this->l('Enable to display map with hotels locations on the properties page.'), + 'hint' => $this->l('Enable to display map with hotels locations on the our properties page.'), ), - 'WK_CONTACT_DISPLAY_HOTEL_MAP' => array( - 'title' => $this->l('Display Hotels Map On Contact Page'), + 'WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP' => array( + 'title' => $this->l('Display Contact Us page Google map'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0', @@ -387,101 +474,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController } - protected function _getDefaultFieldsContent() - { - $this->context = Context::getContext(); - $countryList = array(); - $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); - foreach (Country::getCountries($this->context->language->id) as $country) { - $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); - } - $stateList = array(); - $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); - foreach (State::getStates($this->context->language->id) as $state) { - $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); - } - - $formFields = array( - 'PS_SHOP_NAME' => array( - 'title' => $this->l('Website name'), - 'hint' => $this->l('Displayed in emails and page titles.'), - 'validation' => 'isGenericName', - 'required' => true, - 'type' => 'text', - 'no_escape' => true, - ), - 'PS_SHOP_EMAIL' => array( - 'title' => $this->l('Website email'), - 'hint' => $this->l('Displayed in emails sent to customers and on Contact Us page.'), - 'validation' => 'isEmail', - 'required' => true, - 'type' => 'text' - ), - 'PS_SHOP_PHONE' => array( - 'title' => $this->l('Phone'), - 'validation' => 'isGenericName', - 'required' => true, - 'type' => 'text', - 'hint' => $this->l('The phone number of the main branch.'), - ), - 'PS_SHOP_ADDR1' => array( - 'title' => $this->l('Address line 1'), - 'validation' => 'isAddress', - 'type' => 'text', - 'hint' => $this->l('The address of the main branch.'), - 'isCleanHtml' => true, - 'required' => true, - ), - 'PS_SHOP_ADDR2' => array( - 'title' => $this->l('Address line 2'), - 'validation' => 'isAddress', - 'type' => 'text' - ), - 'PS_SHOP_CODE' => array( - 'title' => $this->l('Zip/postal code'), - 'validation' => 'isGenericName', - 'type' => 'text' - ), - 'PS_SHOP_CITY' => array( - 'title' => $this->l('City'), - 'validation' => 'isGenericName', - 'type' => 'text' - ), - 'PS_SHOP_COUNTRY_ID' => array( - 'title' => $this->l('Country'), - 'validation' => 'isInt', - 'type' => 'select', - 'list' => $countryList, - 'identifier' => 'id', - 'cast' => 'intval', - 'defaultValue' => (int)$this->context->country->id - ), - 'PS_SHOP_STATE_ID' => array( - 'title' => $this->l('State'), - 'validation' => 'isInt', - 'type' => 'select', - 'list' => $stateList, - 'identifier' => 'id', - 'cast' => 'intval' - ), - 'PS_SHOP_DETAILS' => array( - 'title' => $this->l('Registration number'), - 'hint' => $this->l('Website registration information (e.g. SIRET or RCS).'), - 'validation' => 'isGenericName', - 'type' => 'textarea', - 'cols' => 30, - 'rows' => 5 - ), - 'PS_SHOP_FAX' => array( - 'title' => $this->l('Fax'), - 'validation' => 'isGenericName', - 'type' => 'text' - ), - ); - - return $formFields; - } - public function beforeUpdateOptions() { if (isset($_POST['PS_SHOP_STATE_ID']) && $_POST['PS_SHOP_STATE_ID'] != '0') { diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 2b56dd0c6..acbfbe7f2 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -695,7 +695,7 @@ class HotelReservationSystem extends Module 'WK_HOTEL_NAME_ENABLE', 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER', 'WK_CUSTOMER_SUPPORT_EMAIL', - 'WK_CONTACT_DISPLAY_HOTEL_LIST' + 'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST' ); foreach ($configKeys as $key) { if (!Configuration::deleteByName($key)) { diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index 47de743b7..5e4294a1c 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -835,12 +835,12 @@ function toggleGoogleMapsFields() { if ($('#WK_GOOGLE_ACTIVE_MAP_on').attr('checked') == 'checked') { $('#conf_id_WK_MAP_HOTEL_ACTIVE_ONLY').parent().show(); - $('#conf_id_WK_CONTACT_DISPLAY_HOTEL_MAP').parent().show(); - $('#conf_id_WK_PROPERTIES_DISPLAY_HOTEL_MAP').parent().show(); + $('#conf_id_WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP').parent().show(); + $('#conf_id_WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP').parent().show(); } else { $('#conf_id_WK_MAP_HOTEL_ACTIVE_ONLY').parent().hide(); - $('#conf_id_WK_CONTACT_DISPLAY_HOTEL_MAP').parent().hide(); - $('#conf_id_WK_PROPERTIES_DISPLAY_HOTEL_MAP').parent().hide(); + $('#conf_id_WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP').parent().hide(); + $('#conf_id_WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP').parent().hide(); } } diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php new file mode 100644 index 000000000..dd2519dc2 --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php @@ -0,0 +1,33 @@ + + function ajaxStoreStates(id_state_selected) { + $.ajax({ + url: "index.php", + cache: false, + data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(), + success: function(html) + { + if (html == 'false') { + $("#conf_id_PS_SHOP_STATE_ID").parent().fadeOut(); + $('#PS_SHOP_STATE_ID option[value=0]').attr("selected", "selected"); + } else { + $("#PS_SHOP_STATE_ID").html(html); + $("#conf_id_PS_SHOP_STATE_ID").parent().fadeIn(); + $('#PS_SHOP_STATE_ID option[value=' + id_state_selected + ']').attr("selected", "selected"); + } + } + }); + } + + $(document).ready(function() { + {if isset($categoryData.fields.PS_SHOP_STATE_ID.value)} + if ($('#PS_SHOP_COUNTRY_ID') && $('#PS_SHOP_STATE_ID')) { + ajaxStoreStates({$categoryData.fields.PS_SHOP_STATE_ID.value}); + $('#PS_SHOP_COUNTRY_ID').change(function() { + ajaxStoreStates(); + }); + } + {/if} + }); + + {/if} +{/block} diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php new file mode 100644 index 000000000..dd2519dc2 --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php @@ -0,0 +1,33 @@ + +
    diff --git a/themes/hotel-reservation-theme/css/contact-form.css b/themes/hotel-reservation-theme/css/contact-form.css index 7e6ee9769..5ffae05e0 100644 --- a/themes/hotel-reservation-theme/css/contact-form.css +++ b/themes/hotel-reservation-theme/css/contact-form.css @@ -274,9 +274,3 @@ outline: none; color: #427fed; } -.margin-bottom-30 { - margin-bottom: 30px; -} -.margin-top-30 { - margin-top: 30px; -} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index cd790b7c6..76406880b 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -9144,4 +9144,9 @@ a.link { font-weight: 700; color: #0000ff; text-decoration: none; -} \ No newline at end of file +} + +div a.our_properties_link{ + color: #fff; + font-size: 17px; + font-weight: 400;} diff --git a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css index 979d70364..e97d787ca 100644 --- a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css +++ b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css @@ -37,11 +37,6 @@ #user_info_acc span.caret { border-top-color: #fff; } -div.our_hotel_tab a{ - color: #fff; - font-size: 17px; - font-weight: 400;} - @media (max-width: 450px) { .hide_xs { display: none; } diff --git a/themes/hotel-reservation-theme/css/our-properties.css b/themes/hotel-reservation-theme/css/our-properties.css new file mode 100644 index 000000000..efc8c340a --- /dev/null +++ b/themes/hotel-reservation-theme/css/our-properties.css @@ -0,0 +1,149 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ + +.htl-img { + max-width: 200px;} +.properties-page { + padding: 10px;} +.page-heading { + font-size: 32px;} +.empty-properties-container{ + margin: 30px;} +.our-properties-header { + font-size: 42px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300;} +.our-properties-desc { + font-size: 16px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300; + line-height: 30px;} +.properties-page .hotels-container { + display: flex; + flex-wrap: wrap; + justify-content: flex-start;} +.hotels-container .hotel-header { + margin-bottom: 40px; + text-align: center;} +.hotels-container .hotel-header>span { + font-size: 30px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + border-bottom: 1px solid rgba(0, 0, 0, 1);} +.properties-page .hotel-address-container { + border-radius: 4px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); + float: left; + padding: 15px 0px; + width: 100%;} +.hotel-address-container .hotel-name { + font-size: 18px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + margin-bottom: 15px;} +.hotel-address-container span.htl-address-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png);} +.hotel-address-container img.htl-img { + border-radius: 6px;} +.empty-properties-image-container { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/no-hotel.png) ; + background-repeat:no-repeat; + background-position: center center; + padding: 200px 0px 10px 0px; + display: block;} +.hotel-address-container span.htl-phone-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 15px 0px 2px; + background-position: 37px; + margin-right: 5px; + font-size: 14px;} +.hotel-address-container span.htl-email-icon { + padding: 1px 10px 1px; + background-position: 19px; + margin-right: 5px;} +span.htl-map-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 20px 0px 0px; + background-position: 0px 0px; + margin-right: 5px; + font-size: 14px;} +.view_rooms_btn, .htl-map-direction-btn { + border-radius: 4px; + padding: 10px 12px; + text-transform: uppercase;} +.htl-map-direction-btn{ + background-color: #DEDEDE; + color: #333333; } +.view_rooms_btn { + background-color: #1292FF; + border-color: #1292FF; + font-weight: 600;} +.view_rooms_btn:hover { + background-color: #3c89cb; + border-color: #3a75a7;} +.pagination-container { + text-align: center;} +.hotel-branch-info-actions{ + display: flex; + gap: 10px;} +.pagination-container .pagination > li > a, .pagination-container .pagination > li > span { + border: unset;} +.pagination-container .pagination > li .active { + border: 1px solid #333333; + border-radius: 12px; + z-index: 10;} +.hotel-address-container p.hotel-branch-info-value { + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; + line-height: 25px;} +.hotel-address-container .htl-map-direction-btn span { + font-size: 12px; + color: rgba(0, 0, 0, 1); + font-weight: 400;} + +@media screen and (max-width: 726px) { + .hotel-branch-info-actions{ + flex-direction: column;} +} + + /* ==== google map ==== */ +#googleMapWrapper { + clear: both; + height: 500px;} +#map { + width: 100%; + height: 100%;} +#map .view-link { + padding-top: 4px;} +.gm-btn-get-directions { + text-decoration: none; + color: #427fed; + font-weight: bold;} +.gm-btn-get-directions:hover { + text-decoration: underline; + color: #427fed;} +.gm-btn-get-directions:focus { + outline: none; + color: #427fed;} diff --git a/themes/hotel-reservation-theme/css/properties.css b/themes/hotel-reservation-theme/css/properties.css deleted file mode 100644 index c96b81421..000000000 --- a/themes/hotel-reservation-theme/css/properties.css +++ /dev/null @@ -1,286 +0,0 @@ -/** -* NOTICE OF LICENSE -* -* This source file is subject to the Open Software License version 3.0 -* that is bundled with this package in the file LICENSE.md -* It is also available through the world-wide-web at this URL: -* https://opensource.org/license/osl-3-0-php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to support@qloapps.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to a newer -* versions in the future. If you wish to customize this module for your needs -* please refer to https://store.webkul.com/customisation-guidelines for more information. -* -* @author Webkul IN -* @copyright Since 2010 Webkul -* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 -*/ - -.margin-top-50 { - margin-top: 50px; -} -.margin-bottom-30 { - margin-bottom: 30px; -} -.margin-bottom-20 { - margin-bottom: 20px; -} -.margin-top-20 { - margin-top: 20px; -} -.htl-contact-page { - padding: 10px; -} -.page-heading { - font-size: 32px; -} -.empty-properties-container{ - margin: 30px; -} -.htl-contact-page .contact-header { - font-size: 42px; - color: rgba(0, 0, 0, 1); - text-align: center; - font-weight: 300; - margin-bottom: 20px; -} -.htl-contact-page .contact-desc { - font-size: 16px; - color: rgba(0, 0, 0, 1); - text-align: center; - font-weight: 300; - margin-bottom: 20px; - line-height: 30px; -} -.htl-contact-page .contact-form-box { - padding: 30px; - border-radius: 4px; - box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); -} -.htl-contact-page .contact-form-box .control-label { - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; -} -.htl-contact-page .contact-form-box .form-control, .htl-contact-page .uploader span.filename { - border: 1px solid rgba(0, 0, 0, 1); - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; -} -.htl-contact-page .uploader span.filename { - font-size: 12px; -} -.htl-contact-page .contact-form-box #contact_type { - width: 90%; - text-align: left; -} -.title-container { - margin-left: 150px; - margin-right: 150px; - color: #333333;} -.htl-contact-page .contact_type_ul { - font-size: 14px; - font-weight: 400; - top: 45px; - padding: 0px; - width: 100%; - border-bottom: 1px solid rgba(0, 0, 0, 1); - border-left: 1px solid rgba(0, 0, 0, 1); - border-right: 1px solid rgba(0, 0, 0, 1); - max-height: 145px; - overflow-y: auto; -} -.htl-contact-page .contact_type_ul li { - cursor: default; - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; - padding: 11px; -} -.htl-contact-page .contact_type_ul li:hover, .htl-contact-page .contact_type_ul li:focus, .htl-contact-page .contact_type_ul li:active { - background-color: #379bf0; - color: #FFFFFF; -} -.htl-contact-page .contact_btn { - font-size: 14px; - color: rgba(255, 255, 255, 1); - font-weight: 600; - text-transform: uppercase; - border-radius: 4px; - padding: 0 20px; -} -.htl-contact-page .global-address-header { - font-weight: 400; - font-size: 12px; - color: rgba(0, 0, 0, .6); - text-transform: uppercase; - margin-bottom: 5px; -} -.htl-contact-page .global-address-value { - font-weight: 400; - font-size: 14px; - margin-bottom: 10px; - color: rgba(0, 0, 0, 1); - line-height: 22px; -} -.htl-contact-page .htl-global-address-div { - padding: 20px; - border-radius: 4px; - margin-bottom: 10px; - box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); -} -@media screen and (min-width: 767px) { - .htl-contact-page .htl-global-address-div { - margin-top: 60px; - } -} -.htl-contact-page .hotels-container { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; -} -.hotels-container .hotel-header { - margin-bottom: 40px; - text-align: center; -} -.hotels-container .hotel-header>span { - font-size: 30px; - font-weight: 400; - color: rgba(0, 0, 0, 1); - border-bottom: 1px solid rgba(0, 0, 0, 1); -} -.htl-contact-page span.action { - background:#379bf0!important; -} -.htl-contact-page .hotel-address-container { - border-radius: 4px; - box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); - float: left; - padding: 15px 0px; - width: 100%; -} -.htl-contact-page .hotel-city-container>span { - font-size: 20px; - font-weight: 400; - color: rgba(0, 0, 0, 1); -} -.hotel-address-container .hotel-name { - font-size: 18px; - font-weight: 400; - color: rgba(0, 0, 0, 1); - margin-bottom: 15px; -} -.hotel-address-container span.htl-address-icon { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); -} -.hotel-address-container img.htl-img { - border-radius: 6px; -} -.empty-properties-image-container { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/no-hotel.png) ; - background-repeat:no-repeat; - background-position: center center; - padding: 200px 0px 10px 0px; - display: block; -} -.hotel-address-container span.htl-phone-icon { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); - padding: 1px 15px 0px 2px; - background-position: 37px; - margin-right: 5px; - font-size: 14px; -} -.hotel-address-container span.htl-email-icon { - padding: 1px 10px 1px; - background-position: 19px; - margin-right: 5px; -} -.htl-contact-page .hotel-city-container { - margin-bottom: 10px; -} -span.htl-map-icon { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); - padding: 1px 20px 0px 0px; - background-position: 0px 0px; - margin-right: 5px; - font-size: 14px; -} -.view_rooms_btn, .htl-map-direction-btn { - border-radius: 4px; - padding: 10px 12px; - text-transform: uppercase; -} - -.htl-map-direction-btn{ - background-color: #DEDEDE; - color: #333333; -} -.view_rooms_btn { - background-color: #1292FF; - border-color: #1292FF; - font-weight: 600; -} -.view_rooms_btn:hover { - background-color: #3c89cb; - border-color: #3a75a7; -} -.pagination-container { - text-align: center; -} -.hotel-branch-info-actions{ - display: flex; - gap: 10px; -} -.pagination-container .pagination > li > a, .pagination-container .pagination > li > span { - border: unset; -} -.pagination-container .pagination > li .active { - border: 1px solid #333333; - border-radius: 12px; - z-index: 10; -} -.hotel-address-container p.hotel-branch-info-value { - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; - line-height: 25px; -} -.hotel-address-container .htl-map-direction-btn span { - font-size: 12px; - color: rgba(0, 0, 0, 1); - font-weight: 400; -} -/* ==== google map ==== */ -#googleMapWrapper { - clear: both; - height: 500px; -} -#map { - width: 100%; - height: 100%; -} - -#map .view-link { - padding-top: 4px; -} - -.gm-btn-get-directions { - text-decoration: none; - color: #427fed; - font-weight: bold; -} - -.gm-btn-get-directions:hover { - text-decoration: underline; - color: #427fed; -} - -.gm-btn-get-directions:focus { - outline: none; - color: #427fed; -} diff --git a/themes/hotel-reservation-theme/header.tpl b/themes/hotel-reservation-theme/header.tpl index 4de30a7cc..721a71cef 100644 --- a/themes/hotel-reservation-theme/header.tpl +++ b/themes/hotel-reservation-theme/header.tpl @@ -1,154 +1,4 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - - - - - - - - {$meta_title|escape:'html':'UTF-8'} - {if isset($meta_description) AND $meta_description} - - {/if} - {if isset($meta_keywords) AND $meta_keywords} - - {/if} - - - - - - - {if isset($css_files)} - {foreach from=$css_files key=css_uri item=media} - {if $css_uri == 'lteIE9'} - - {else} - - {/if} - {/foreach} - {/if} - {if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)} - {$js_def} - {foreach from=$js_files item=js_uri} - - {/foreach} - {/if} - {block name='displayHeader'} - {$HOOK_HEADER} - {/block} - - - - - - - - - - - {if !isset($content_only) || !$content_only} - {if isset($restricted_country_mode) && $restricted_country_mode} -
    -

    {l s='You cannot place a new order from your country.'}{if isset($geolocation_country) && $geolocation_country} {$geolocation_country|escape:'html':'UTF-8'}{/if}

    -
    - {/if} -
    -
    - -
    -
    -
    - {if $show_breadcrump} - {block name='breadcrumb'} - {include file="$tpl_dir./breadcrumb.tpl"} - {/block} - {/if} -
    -
    {hook h="displayTopColumn"}
    -
    -
    - {if isset($left_column_size) && !empty($left_column_size)} -
    {$HOOK_LEFT_COLUMN}
    - {/if} - {if isset($left_column_size) && isset($right_column_size)}{assign var='cols' value=(12 - $left_column_size - $right_column_size)}{else}{assign var='cols' value=12}{/if} -
    - {/if} +/home/users/vishal.singh/www/html/Review/QloApps-gli-2489/tools/smarty/sysplugins/smarty_internal_compile_foreach.php + 33,56: public $optional_attributes = array('name', 'key', 'properties'); + 142,27: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { + 142,88: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { \ No newline at end of file diff --git a/themes/hotel-reservation-theme/js/properties.js b/themes/hotel-reservation-theme/js/our-properties.js similarity index 93% rename from themes/hotel-reservation-theme/js/properties.js rename to themes/hotel-reservation-theme/js/our-properties.js index c48b6944d..ba9408875 100644 --- a/themes/hotel-reservation-theme/js/properties.js +++ b/themes/hotel-reservation-theme/js/our-properties.js @@ -21,7 +21,6 @@ */ $(document).ready(function() { - //By Webkul JS for Map locations of the hotels on google Map if (typeof hotelLocationArray != 'undefined' && $('#map').length @@ -30,6 +29,12 @@ $(document).ready(function() { ) { initMap(); } + + $(document).on('click', 'ul.pagination li a', function(e){ + e.preventDefault(); + $('#pagination').val($(this).data('pagination')); + $('form#our-properties-list').submit(); + }); }); function initMap() { diff --git a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl index 0c17e55b6..b68943311 100644 --- a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl +++ b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl @@ -47,10 +47,5 @@ {/if} {if !isset($ajaxCustomerLogin)}
    - {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} - - {/if} {/if} {/block} diff --git a/themes/hotel-reservation-theme/properties.tpl b/themes/hotel-reservation-theme/our-properties.tpl similarity index 86% rename from themes/hotel-reservation-theme/properties.tpl rename to themes/hotel-reservation-theme/our-properties.tpl index 12ade303e..094f83dff 100644 --- a/themes/hotel-reservation-theme/properties.tpl +++ b/themes/hotel-reservation-theme/our-properties.tpl @@ -25,8 +25,8 @@ {if isset($hotelsInfo) && $hotelsInfo} {block name='our_properties_list_title'}
    -

    {l s='Our Hotels'}

    -
    +

    {l s='Our Properties'}

    +

    {$WK_HTL_SHORT_DESC|escape:'html':'UTF-8'}

    @@ -38,7 +38,7 @@ {block name='our_properties_location'} {if isset($hotelLocationArray) && $hotelLocationArray && isset($displayHotelMap) && $displayHotelMap} -
    +
    @@ -55,11 +55,11 @@ {hook h='displayPropertiesListBefore'} {/block} -
    +
    {block name='our_properties_list'}
    {foreach $hotelsInfo as $hotel} -
    +
    @@ -74,9 +74,9 @@ {$hotel['email']}

    - {l s='View Rooms'} + {l s='View Rooms'} {if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap} - {l s='View on map'} + {l s='View on map'} {/if}
    @@ -91,7 +91,7 @@ {/block} {if (isset($pageLimit)) && $pageLimit > 1} -
    +
    From 2233c55efdb846f1405bfa1899bcb231ecae3213 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 17 May 2025 12:54:10 +0530 Subject: [PATCH 136/143] Fixed some minor issues and improved ajax responses --- .../controllers/carts/helpers/view/view.tpl | 43 ++++---- controllers/admin/AdminCartsController.php | 63 ++++++------ controllers/admin/AdminOrdersController.php | 99 ++++++++++++------- 3 files changed, 112 insertions(+), 93 deletions(-) diff --git a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl index 09decd44b..2fd68d44f 100644 --- a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl @@ -195,30 +195,31 @@ {if isset($room['selected_services']) && $room['selected_services']} {foreach $room['selected_services'] as $service}
    -
    -
    -
    -

    {$service['name']|escape:'html':'UTF-8'}

    - {if $service.allow_multiple_quantity} -
    - {l s='Quantity:'} {$service.quantity} -
    - {/if} -
    +
    +
    +
    +
    {$service['name']|escape:'html':'UTF-8'}
    + {if $service.allow_multiple_quantity} +
    + {l s='Quantity:'} {$service.quantity} +
    + {/if}
    -
    - {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} - {l s='Convenience fee'} - {/if} - {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} - {l s='Auto added'} - {/if} -
    -
    - {convertPrice price=$service.total_price} -
    +
    + {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} + {l s='Convenience fee'} + {/if} + {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} + {l s='Auto added'} + {/if} +
    +
    + {convertPrice price=$service.total_price} +
    +
    +

    {/foreach} {/if}
    diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 5449fa338..557fca655 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1148,11 +1148,6 @@ class AdminCartsControllerCore extends AdminController $objRoomTypeServPrice = new RoomTypeServiceProductPrice(); foreach ($serviceProducts as $key => $servProduct) { $serviceProducts[$key]['price_tax_exc'] = $objRoomTypeServPrice->getServicePrice($servProduct['id_product'], 0, 1, null, null, false, $idCart); - if ($additionalServices - && (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) - ) { - unset($serviceProducts[$key]); - } } } @@ -1190,7 +1185,7 @@ class AdminCartsControllerCore extends AdminController ); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred. please try again.'); + $response['errors'][] = Tools::displayError('Some error occurred. please try again.'); } $this->ajaxDie(json_encode($response)); @@ -1218,15 +1213,15 @@ class AdminCartsControllerCore extends AdminController public function ajaxProcessUpdateServiceProduct() { - if ($this->tabAccess['edit'] === '1') { + if ($this->tabAccess['edit'] === '1') { $operator = Tools::getValue('operator', 'up'); $idServiceProduct = Tools::getValue('id_product'); $idCartBooking = Tools::getValue('id_cart_booking'); $qty = Tools::getValue('qty'); - + if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - + if ($operator == 'up') { $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) { @@ -1248,7 +1243,7 @@ class AdminCartsControllerCore extends AdminController $this->errors[] = Tools::displayError('This Service is not available with selected room.'); } } - + if (empty($this->errors)) { if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( $idCartBooking, @@ -1263,7 +1258,7 @@ class AdminCartsControllerCore extends AdminController } else { $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); } - + } } else { $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); @@ -1369,28 +1364,28 @@ class AdminCartsControllerCore extends AdminController $priceAdditionType = 0; if (empty($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service quantity is required'); + $response['errors'][] = Tools::displayError('Service quantity is required'); } elseif (!Validate::isUnsignedInt($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service quantity'); + $response['errors'][] = Tools::displayError('Invalid service quantity'); } } // Validate service data provided if (empty($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service name is required'); + $response['errors'][] = Tools::displayError('Service name is required'); } elseif (!Validate::isCatalogName($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service name'); + $response['errors'][] = Tools::displayError('Invalid service name'); } if (empty($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service price is required'); + $response['errors'][] = Tools::displayError('Service price is required'); } elseif (!Validate::isPrice($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service price'); + $response['errors'][] = Tools::displayError('Invalid service price'); } // if no validation errors then add service @@ -1457,28 +1452,28 @@ class AdminCartsControllerCore extends AdminController $response['service_panel'] = $this->getBookingServicesTabContent($objHtlCartBooking->id); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while adding service to the room'); + $response['errors'][] = Tools::displayError('Some error occurred while adding service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = Tools::displayError('Room not found'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Adding a new custom service is not allowed.'); + $response['errors'][] = Tools::displayError('Adding a new custom service is not allowed.'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -1562,14 +1557,14 @@ class AdminCartsControllerCore extends AdminController if ($objProduct->allow_multiple_quantity) { if (!isset($serviceQuantities[$idServiceProduct])) { $response['hasError'] = true; - $response['errors'] = $this->l('Quantity not provided for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Quantity not provided for service').': '.$objProduct->name; } else if (!Validate::isUnsignedInt($serviceQuantities[$idServiceProduct])) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid quantity provided for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Invalid quantity provided for service').': '.$objProduct->name; } } elseif ($serviceQuantities[$idServiceProduct] > 1) { $response['hasError'] = true; - $response['errors'] = $this->l('Can not order multiple quanitity for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name; } if (!$objProduct->allow_multiple_quantity) { @@ -1580,12 +1575,10 @@ class AdminCartsControllerCore extends AdminController || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) ) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid unit price for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objProduct->name; } - } else { - die($idServiceProduct); - $response['errors'] = $this->l('Some services not found. please try after refreshing the page'); + $response['errors'][] = Tools::displayError('Some services not found. please try after refreshing the page'); } } @@ -1609,7 +1602,7 @@ class AdminCartsControllerCore extends AdminController )) { $originalPrice = Product::getPriceStatic($idServiceProduct, false); // if price is different than the original service price then update the price - if ($operator == 'up' && $originalPrice != $price) { + if ($operator == 'up' && $originalPrice != $unitPrice) { if ($specificPriceInfo = SpecificPrice::getSpecificPrice( (int)$idServiceProduct, 0, @@ -1649,20 +1642,20 @@ class AdminCartsControllerCore extends AdminController if (!$result) { $response['hasError'] = true; - $response['errors'] = $this->l('Error while updating services, please try again after refresing the page'); + $response['errors'][] = Tools::displayError('Error while updating services, please try again after refresing the page'); } } } else { $response['hasError'] = true; - $response['errors'] = $this->l('No service found'); + $response['errors'][] = Tools::displayError('No service found'); } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Room info not found'); + $response['errors'][] = Tools::displayError('Room info not found'); } } else { $response['hasError'] = true; - $response['errors'] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index a719d7d26..64d22fd82 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3515,18 +3515,18 @@ class AdminOrdersControllerCore extends AdminController $response['msg'] = $this->l('Guest details are updated.'); } else { - $response['errors'][] = $this->l('Unable to save guest details.'); + $response['errors'][] = Tools::displayError('Unable to save guest details.'); } } else { - $response['errors'][] = $this->l('Guest details not found.'); + $response['errors'][] = Tools::displayError('Guest details not found.'); } } else { - $response['errors'][] = $this->l('Guest details not found.'); + $response['errors'][] = Tools::displayError('Guest details not found.'); } } } } else { - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } if ($response['errors']) { @@ -5068,7 +5068,6 @@ class AdminOrdersControllerCore extends AdminController } } - if ($qty_diff != 0) { $cartQty = $qty_diff; $op = 'up'; @@ -5679,7 +5678,9 @@ class AdminOrdersControllerCore extends AdminController )) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypServiceProductCartDetail); $serviceQuantity = $objRoomTypeServiceProductCartDetail->quantity; - if ($objRoomTypeServiceProductCartDetail->delete()) { + if ($objRoomTypeServiceProductCartDetail->delete() + && Validate::isLoadedObject(new Product((int) $service['id_product'])) + ) { $objCart = new Cart($service['id_cart']); $objCart->updateQty((int)abs($serviceQuantity), $service['id_product'], null, false, 'down'); } @@ -6588,25 +6589,25 @@ class AdminOrdersControllerCore extends AdminController if ($objOrderDetail->product_allow_multiple_quantity) { if (!isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { $response['hasError'] = true; - $response['errors'] = $this->l('Quantity not provided for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Quantity not provided for service').': '.$objRoomTypeServiceOrderDetail->name; } else if (!Validate::isUnsignedInt($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid quantity provided for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Invalid quantity provided for service').': '.$objRoomTypeServiceOrderDetail->name; } } elseif ($serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) { $response['hasError'] = true; - $response['errors'] = $this->l('Can not order multiple quanitity for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objRoomTypeServiceOrderDetail->name; } if (!isset($serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]) || !ValidateCore::isPrice($serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]) ) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid unit price for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objRoomTypeServiceOrderDetail->name; } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Service not found for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Service not found for service').': '.$objRoomTypeServiceOrderDetail->name; } } @@ -6704,7 +6705,7 @@ class AdminOrdersControllerCore extends AdminController if (!$result) { $response['hasError'] = true; - $response['errors'] = $this->l('Error while updating service, please try again after refresing the page'); + $response['errors'][] = Tools::displayError('Error while updating service, please try again after refresing the page'); } else { $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( $objOrderDetail->id_order, @@ -6719,11 +6720,11 @@ class AdminOrdersControllerCore extends AdminController } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Service not found'); + $response['errors'][] = Tools::displayError('Service not found'); } } else { $response['hasError'] = true; - $response['errors'] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -6954,12 +6955,12 @@ class AdminOrdersControllerCore extends AdminController ); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = Tools::displayError('Room not found'); } } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -6982,7 +6983,7 @@ class AdminOrdersControllerCore extends AdminController $objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to, $objHotelBookingDetail->id_room - )) { + )) { $name = Tools::getValue('new_service_name'); $price = Tools::getValue('new_service_price'); $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); @@ -7003,28 +7004,28 @@ class AdminOrdersControllerCore extends AdminController $priceAdditionType = 0; if (empty($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service quantity is required'); + $response['errors'][] = Tools::displayError('Service quantity is required'); } elseif (!Validate::isUnsignedInt($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service quantity'); + $response['errors'][] = Tools::displayError('Invalid service quantity'); } } // Validate service data provided if (empty($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service name is required'); + $response['errors'][] = Tools::displayError('Service name is required'); } elseif (!Validate::isCatalogName($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service name'); + $response['errors'][] = Tools::displayError('Invalid service name'); } if (empty($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service price is required'); + $response['errors'][] = Tools::displayError('Service price is required'); } elseif (!Validate::isPrice($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service price'); + $response['errors'][] = Tools::displayError('Invalid service price'); } // if no validation errors then add service @@ -7232,7 +7233,7 @@ class AdminOrdersControllerCore extends AdminController ); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while updating the order'); + $response['errors'][] = Tools::displayError('Some error occurred while updating the order'); } // at last delete the specific price created for the service @@ -7242,42 +7243,42 @@ class AdminOrdersControllerCore extends AdminController } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while updating the order'); + $response['errors'][] = Tools::displayError('Some error occurred while updating the order'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } // at last delete the created service $objServiceProduct->delete(); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = Tools::displayError('Room not found'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Adding a new custom service is not allowed.'); + $response['errors'][] = Tools::displayError('Adding a new custom service is not allowed.'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -7289,15 +7290,39 @@ class AdminOrdersControllerCore extends AdminController $response = array('hasError' => false); // Check tab access is allowed to edit if ($this->tabAccess['edit'] == 1) { - $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); - - if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { + $idRoomTypeServiceProductOrderDetail = Tools::getValue('id_room_type_service_product_order_detail'); + if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($idRoomTypeServiceProductOrderDetail))) { $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); $priceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; $priceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; $quantity = $objRoomTypeServiceProductOrderDetail->quantity; $res = true; $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); + $objHotelCartBookingData = new HotelCartBookingData(); + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + + if ($roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $objHotelBookingDetail->id_cart, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room + )) { + if ($idRoomTypServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists( + $objRoomTypeServiceProductOrderDetail->id_product, + $objRoomTypeServiceProductOrderDetail->id_cart, + $roomHtlCartInfo['id'] + )) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail($idRoomTypServiceProductCartDetail); + if ($objRoomTypeServiceProductCartDetail->delete() + // Since the service product is deleted after adding them directly from the order the cart will throw exception on the service delete process. + && Validate::isLoadedObject(new Product($objRoomTypeServiceProductOrderDetail->id_product)) + ) { + $objCart = new Cart($objRoomTypeServiceProductOrderDetail->id_cart); + $objCart->updateQty((int) abs($quantity), $objRoomTypeServiceProductOrderDetail->id_product, null, false, 'down'); + } + } + } if ($res &= $objRoomTypeServiceProductOrderDetail->delete()) { $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); @@ -7502,7 +7527,7 @@ class AdminOrdersControllerCore extends AdminController } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } die(json_encode($response)); } From dddd6881305708b0ec3ed3a938215000495b06d3 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 19 May 2025 10:51:02 +0530 Subject: [PATCH 137/143] Added ellipsis (...) to hotel name when it exceeds parent div width --- modules/wkroomsearchblock/views/css/wk-global-search.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index d54af2d05..39628251b 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -79,6 +79,11 @@ padding-right: 20px; background: url("../../views/img/icon-hotel.svg") no-repeat 10px 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat calc(100% - 10px) 50%; background-color: #FFF;} + #id_hotel_button{ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } #search_hotel_block_form .input-date { display: grid; cursor: text;} From 678f593752a87eeb5fcec798d373eab659cc5f6e Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 19 May 2025 13:14:01 +0530 Subject: [PATCH 138/143] Revert change to header.tpl --- themes/hotel-reservation-theme/header.tpl | 158 +++++++++++++++++++++- 1 file changed, 154 insertions(+), 4 deletions(-) diff --git a/themes/hotel-reservation-theme/header.tpl b/themes/hotel-reservation-theme/header.tpl index 721a71cef..4de30a7cc 100644 --- a/themes/hotel-reservation-theme/header.tpl +++ b/themes/hotel-reservation-theme/header.tpl @@ -1,4 +1,154 @@ -/home/users/vishal.singh/www/html/Review/QloApps-gli-2489/tools/smarty/sysplugins/smarty_internal_compile_foreach.php - 33,56: public $optional_attributes = array('name', 'key', 'properties'); - 142,27: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { - 142,88: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { \ No newline at end of file +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + + + + + + {$meta_title|escape:'html':'UTF-8'} + {if isset($meta_description) AND $meta_description} + + {/if} + {if isset($meta_keywords) AND $meta_keywords} + + {/if} + + + + + + + {if isset($css_files)} + {foreach from=$css_files key=css_uri item=media} + {if $css_uri == 'lteIE9'} + + {else} + + {/if} + {/foreach} + {/if} + {if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)} + {$js_def} + {foreach from=$js_files item=js_uri} + + {/foreach} + {/if} + {block name='displayHeader'} + {$HOOK_HEADER} + {/block} + + + + + + + + + + + {if !isset($content_only) || !$content_only} + {if isset($restricted_country_mode) && $restricted_country_mode} +
    +

    {l s='You cannot place a new order from your country.'}{if isset($geolocation_country) && $geolocation_country} {$geolocation_country|escape:'html':'UTF-8'}{/if}

    +
    + {/if} +
    +
    + +
    +
    +
    + {if $show_breadcrump} + {block name='breadcrumb'} + {include file="$tpl_dir./breadcrumb.tpl"} + {/block} + {/if} +
    +
    {hook h="displayTopColumn"}
    +
    +
    + {if isset($left_column_size) && !empty($left_column_size)} +
    {$HOOK_LEFT_COLUMN}
    + {/if} + {if isset($left_column_size) && isset($right_column_size)}{assign var='cols' value=(12 - $left_column_size - $right_column_size)}{else}{assign var='cols' value=12}{/if} +
    + {/if} From 45269f7d3da9e6d2191dfa050d4b0b9a66260595 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 19 May 2025 16:53:18 +0530 Subject: [PATCH 139/143] Fixed: undefined index issues and display issue --- themes/hotel-reservation-theme/_partials/room_type_list.tpl | 2 +- themes/hotel-reservation-theme/header.tpl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 7af810b91..5613be05c 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -20,7 +20,7 @@ {block name='displayRoomTypeListBefore'} {hook h='displayRoomTypeListBefore'} {/block} -{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types} +{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types && isset($booking_data['rm_data'])} {foreach from=$booking_data['rm_data'] key=room_k item=room_v} {if $room_v['data']['available']|count || isset($display_all_room_types) && $display_all_room_types }
    diff --git a/themes/hotel-reservation-theme/header.tpl b/themes/hotel-reservation-theme/header.tpl index 4de30a7cc..bc3339ca1 100644 --- a/themes/hotel-reservation-theme/header.tpl +++ b/themes/hotel-reservation-theme/header.tpl @@ -121,6 +121,11 @@ {block name='displayTop'} {if isset($HOOK_TOP)}{$HOOK_TOP}{/if} {/block} + {if isset($WK_DISPLAY_PROPERTIES_LINK_IN_HEADER) && $WK_DISPLAY_PROPERTIES_LINK_IN_HEADER} + + {/if}
    From 14886b285dacdd0d1f50b6448d2018121adad9ea Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 19 May 2025 17:22:20 +0530 Subject: [PATCH 140/143] removed select hotel from hoteloptions --- .../wkroomsearchblock/views/templates/front/hotel-options.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl index ad3409356..ee292d0a2 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} - + {if isset($hotels_info) && is_array($hotels_info)} {foreach from=$hotels_info item=hotel_info}