From bd3d7092bb3ffa1b5ccb86d3b059d6c8ee8546e5 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 22 Apr 2024 16:41:13 +0530 Subject: [PATCH 01/21] Fixed:Need to arrange the options in correct order at order list page in mobile view. --- admin/themes/default/template/helpers/list/list_header.tpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl index bf7678e4f..d8e313a11 100644 --- a/admin/themes/default/template/helpers/list/list_header.tpl +++ b/admin/themes/default/template/helpers/list/list_header.tpl @@ -553,10 +553,11 @@ From 4014f2db9e6c74d58bbb10b70b6c145c75a79359 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 22 Apr 2024 17:45:01 +0530 Subject: [PATCH 02/21] Fixed:Getting a fatal error when removing the product from the cart from a different tab before creating order. --- controllers/admin/AdminOrdersController.php | 3 +++ .../hotelreservationsystem/classes/HotelCartBookingData.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9c6d1fe61..13ce8e303 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1666,6 +1666,9 @@ class AdminOrdersControllerCore extends AdminController if ($this->tabAccess['edit'] === '1') { $objCart = new Cart($id_cart); if (Validate::isLoadedObject($objCart)) { + $this->context->cart = $objCart; + + $this->errors = HotelCartBookingData::validateCartBookings(); $orderTotal = $objCart->getOrderTotal(true, Cart::BOTH); if ($objCart->is_advance_payment) { $advancePaymentAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index dc32346d2..9e9028b49 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -928,8 +928,8 @@ class HotelCartBookingData extends ObjectModel public static function validateCartBookings() { $context = Context::getContext(); - $errors = array(); + $objModule = Module::getInstanceByName('hotelreservationsystem'); // validate room types if bookable from front office if ($cartProducts = $context->cart->getProducts()) { @@ -939,6 +939,9 @@ class HotelCartBookingData extends ObjectModel $objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']); } } + } else { + $error = true; + $errors[] = $objModule->l('No booking found in the cart.', 'HotelOrderRestrictDate'); } // validate service products @@ -955,7 +958,6 @@ class HotelCartBookingData extends ObjectModel } // validate room types for restriction date - $objModule = Module::getInstanceByName('hotelreservationsystem'); if ($cartProducts = $context->cart->getProducts()) { $objHotelCartBookingData = new HotelCartBookingData(); $objHotelBookingDetail = new HotelBookingDetail(); From 60d003c3eda2983958d0d6e108bc521f5102949e Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 27 Apr 2024 12:30:17 +0530 Subject: [PATCH 03/21] Fixxed:: Issues in the process of Bok now from back office --- .../template/controllers/orders/form.tpl | 1033 +++++++++-------- controllers/admin/AdminOrdersController.php | 112 +- controllers/front/OrderOpcController.php | 4 +- .../classes/HotelCartBookingData.php | 114 +- .../RoomTypeServiceProductCartDetail.php | 2 +- .../AdminHotelRoomsBookingController.php | 14 +- 6 files changed, 632 insertions(+), 647 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 933d0a6cc..dc225fd9a 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1731,539 +1731,542 @@
{block name="leadin"}{/block}
{include file='controllers/orders/_current_cart_details_data.tpl'} -
-
- - {l s='Customer'} -
-
- -
-
-
-
- - - - -
-
- -
-
-
-
-
-
- {*
- + {* If cart has errors the do not allow to proceed with this cart *} + {if !$hasCartErrors} +
+
+ + {l s='Customer'} +
+
+ +
+
+
+
+ + + + +
+
+ +
+
+
+
+
+
+ {*
+ - -
-
- - - - - - - - - - - -
{l s='ID'}{l s='Date'}{l s='Total'}
-
-
- - - - - - - - - - - - - - -
{l s='ID'}{l s='Date'}{l s='Products'}{l s='Total paid'}{l s='Payment'}{l s='Status'}
-
-
-
-->*} -
+ +
+
+ + + + + + + + + + + +
{l s='ID'}{l s='Date'}{l s='Total'}
+
+
+ + + + + + + + + + + + + + +
{l s='ID'}{l s='Date'}{l s='Products'}{l s='Total paid'}{l s='Payment'}{l s='Status'}
+
+
+
-->*} +
- + + {/if} {strip} {addJsDef max_child_age=$max_child_age} {addJsDef max_child_in_room=$max_child_in_room} diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 13ce8e303..c69117ec1 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -374,19 +374,7 @@ class AdminOrdersControllerCore extends AdminController $this->errors[] = $this->l('You have to select a shop before creating new orders.'); } - $id_cart = (int)Tools::getValue('id_cart'); - $cart = new Cart((int)$id_cart); - if ($id_cart && !Validate::isLoadedObject($cart)) { - $this->errors[] = $this->l('This cart does not exists'); - } - if ($id_cart && Validate::isLoadedObject($cart) && !$cart->id_customer) { - $this->errors[] = $this->l('The cart must have a customer'); - } - if (count($this->errors) && !Tools::getValue('submitAddorder')) { - return false; - } - - // check page is whether ad new order page or order detail page + // check page is new order creation page and cart id is set if ((Tools::isSubmit('addorder') && ($id_cart = Tools::getValue('cart_id'))) || (Tools::isSubmit('submitAddOrder') && ($id_cart = Tools::getValue('id_cart'))) ) { @@ -395,15 +383,10 @@ class AdminOrdersControllerCore extends AdminController $cart_order_exists = $cart->orderExists(); if (!$cart_order_exists) { $this->context->cart = $cart; - if ($this->context->employee->isSuperAdmin()) { - $backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN'; - } else { - $backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES'; - } - if (!Configuration::get($backOrderConfigKey)) { - $objHotelCartBookingData = new HotelCartBookingData(); - $objHotelCartBookingData->removeBackdateRoomsFromCart($this->context->cart->id); - } + + // validate cart for removing invalid data from cart before new order creation + $this->errors = array_merge($this->errors, HotelCartBookingData::validateCartBookings()); + $this->context->currency = new Currency((int)$cart->id_currency); $cart_detail_data = array(); $cart_detail_data_obj = new HotelCartBookingData(); @@ -420,61 +403,69 @@ class AdminOrdersControllerCore extends AdminController $this->context->smarty->assign('cart_normal_data', $normalCartProduct); } + if (empty($cart_detail_data) && empty($normalCartProduct)) { + // if no rooms added in the cart and user visits add order page then redirect to BOOK NOW page + Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking')); + } + + $payment_modules = array(); + foreach (PaymentModule::getInstalledPaymentModules() as $p_module) { + $payment_modules[] = Module::getInstanceById((int)$p_module['id_module']); + } + + $paymentTypes = array(); + foreach ($this->getPaymentsTypes() as $paymentType) { + if ($paymentType['value'] != OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT) { + $paymentTypes[] = $paymentType; + } + } + + $occupancyRequiredForBooking = false; + if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { + $occupancyRequiredForBooking = true; + } + $objHotelAdvancedPayment = new HotelAdvancedPayment(); $this->context->smarty->assign(array( 'order_total' => $cart->getOrderTotal(true), 'is_advance_payment_active' => $objHotelAdvancedPayment->isAdvancePaymentAvailableForCurrentCart(), 'advance_payment_amount_without_tax' => $cart->getOrderTotal(false, Cart::ADVANCE_PAYMENT), 'advance_payment_amount_with_tax' => $cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT), + 'cart' => $cart, + 'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id), + 'langs' => Language::getLanguages(true, Context::getContext()->shop->id), + 'payment_modules' => $payment_modules, + 'payment_types' => $paymentTypes, + 'currency' => new Currency((int)$cart->id_currency), + 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), + 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), + 'occupancy_required_for_booking' => $occupancyRequiredForBooking, )); - if (empty($cart_detail_data) && empty($normalCartProduct)) { - // if no rooms added in the cart and user visits add order page then redirect to BOOK NOW page - Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking')); - } + } else { + Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking')); } $this->context->smarty->assign('is_order_created', $cart_order_exists); + } else { + Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking')); } + //end parent::renderForm(); unset($this->toolbar_btn['save']); $this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch')); - $payment_modules = array(); - foreach (PaymentModule::getInstalledPaymentModules() as $p_module) { - $payment_modules[] = Module::getInstanceById((int)$p_module['id_module']); - } - - $paymentTypes = array(); - foreach ($this->getPaymentsTypes() as $paymentType) { - if ($paymentType['value'] != OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT) { - $paymentTypes[] = $paymentType; - } - } - - $occupancyRequiredForBooking = false; - if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { - $occupancyRequiredForBooking = true; - } - $this->context->smarty->assign(array( + 'hasCartErrors' => count($this->errors) ? 1 : 0, 'recyclable_pack' => (int)Configuration::get('PS_RECYCLABLE_PACK'), 'gift_wrapping' => (int)Configuration::get('PS_GIFT_WRAPPING'), - 'cart' => $cart, - 'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id), - 'langs' => Language::getLanguages(true, Context::getContext()->shop->id), - 'payment_modules' => $payment_modules, - 'payment_types' => $paymentTypes, 'show_toolbar' => $this->show_toolbar, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => $this->toolbar_scroll, 'PS_CATALOG_MODE' => Configuration::get('PS_CATALOG_MODE'), 'title' => array($this->l('Orders'), $this->l('Create order')), - 'currency' => new Currency((int)$cart->id_currency), - 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), - 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), - 'occupancy_required_for_booking' => $occupancyRequiredForBooking, )); + $this->content .= $this->createTemplate('form.tpl')->fetch(); } @@ -1713,23 +1704,6 @@ class AdminOrdersControllerCore extends AdminController } } - // Validate if booking dates are allowed - if ($this->context->employee->isSuperAdmin()) { - $backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN'; - } else { - $backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES'; - } - if (!Configuration::get($backOrderConfigKey)) { - $objCartBookingData = new HotelCartBookingData(); - if ($cartBookingData = $objCartBookingData->getCartCurrentDataByCartId($cart->id)) { - foreach ($cartBookingData as $cartRoom) { - if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) { - $this->errors[] = Tools::displayError('You cannot book rooms before today date.'); - } - } - } - } - if (!count($this->errors)) { $this->context->currency = new Currency((int) $objCart->id_currency); $this->context->customer = new Customer((int) $objCart->id_customer); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 465c6a7ca..9de4e2b55 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -424,7 +424,7 @@ class OrderOpcControllerCore extends ParentOrderController public function initContent() { // validate room types before payment by customer - $orderRestrictErr = HotelCartBookingData::validateCartBookings(); + $this->errors = HotelCartBookingData::validateCartBookings(); parent::initContent(); @@ -492,7 +492,7 @@ class OrderOpcControllerCore extends ParentOrderController // $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->context->smarty->assign( array( - 'orderRestrictErr' => $orderRestrictErr, + 'orderRestrictErr' => count($this->errors) ? 0 : 1, // 'allDemands' => $allDemands, // 'defaultcurrencySign' => $objCurrency->sign, 'THEME_DIR' => _THEME_DIR_, diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 9e9028b49..59e2bdd9e 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -925,26 +925,34 @@ class HotelCartBookingData extends ObjectModel return true; } + // validate cart data if not available then remove from cart public static function validateCartBookings() { $context = Context::getContext(); $errors = array(); $objModule = Module::getInstanceByName('hotelreservationsystem'); + // For admin cart validations use this variable + $forAdminCart = 0; + if (isset($context->employee->id)) { + $forAdminCart = 1; + } + // validate room types if bookable from front office if ($cartProducts = $context->cart->getProducts()) { - $objHotelCartBookingData = new HotelCartBookingData(); - foreach ($cartProducts as $product) { - if ($product['booking_product'] && !$product['show_at_front']) { - $objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']); + if (!$forAdminCart) { + $objHotelCartBookingData = new HotelCartBookingData(); + foreach ($cartProducts as $product) { + if ($product['booking_product'] && !$product['show_at_front']) { + $objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']); + } } } } else { - $error = true; $errors[] = $objModule->l('No booking found in the cart.', 'HotelOrderRestrictDate'); } - // validate service products + // validate service products if not active not then remove from cart if ($cartProducts = $context->cart->getProducts()) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); foreach ($cartProducts as $product) { @@ -957,6 +965,19 @@ class HotelCartBookingData extends ObjectModel } } + // for admin/employee remove bookings of the back dates from cart if not allowed + if ($forAdminCart) { + if ($context->employee->isSuperAdmin()) { + $backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN'; + } else { + $backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES'; + } + if (!Configuration::get($backOrderConfigKey)) { + $objHotelCartBookingData = new HotelCartBookingData(); + $objHotelCartBookingData->removeBackdateRoomsFromCart($context->cart->id); + } + } + // validate room types for restriction date if ($cartProducts = $context->cart->getProducts()) { $objHotelCartBookingData = new HotelCartBookingData(); @@ -979,43 +1000,43 @@ class HotelCartBookingData extends ObjectModel } foreach ($cartData as $roomData) { - if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) { - if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from']) - || strtotime($maxOrderDate) < strtotime($roomData['date_to']) - ) { - $objHotelBranchInformation = new HotelBranchInformation( - $roomData['id_hotel'], - $context->language->id - ); - $errors[] = sprintf( - 'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.', - $objHotelBranchInformation->hotel_name, - Tools::displayDate($maxOrderDate), - Tools::displayDate($roomData['date_from']), - Tools::displayDate($roomData['date_to']) - ); - $error = true; + if (!$forAdminCart) { + if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) { + if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from']) + || strtotime($maxOrderDate) < strtotime($roomData['date_to']) + ) { + $objHotelBranchInformation = new HotelBranchInformation( + $roomData['id_hotel'], + $context->language->id + ); + $errors[] = sprintf( + 'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.', + $objHotelBranchInformation->hotel_name, + Tools::displayDate($maxOrderDate), + Tools::displayDate($roomData['date_from']), + Tools::displayDate($roomData['date_to']) + ); + } } - } - $preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']); - if ($preparationTime !== false) { - $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days')); - if (strtotime($minOrderDate) > strtotime($roomData['date_from']) - || strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to']) - ) { - $objHotelBranchInformation = new HotelBranchInformation( - $roomData['id_hotel'], - $context->language->id - ); - $errors[] = sprintf( - 'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.', - $objHotelBranchInformation->hotel_name, - Tools::displayDate($minOrderDate), - Tools::displayDate($roomData['date_from']), - Tools::displayDate($roomData['date_to']) - ); - $error = true; + $preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']); + if ($preparationTime !== false) { + $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days')); + if (strtotime($minOrderDate) > strtotime($roomData['date_from']) + || strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to']) + ) { + $objHotelBranchInformation = new HotelBranchInformation( + $roomData['id_hotel'], + $context->language->id + ); + $errors[] = sprintf( + 'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.', + $objHotelBranchInformation->hotel_name, + Tools::displayDate($minOrderDate), + Tools::displayDate($roomData['date_from']), + Tools::displayDate($roomData['date_to']) + ); + } } } @@ -1027,32 +1048,27 @@ class HotelCartBookingData extends ObjectModel 'only_search_data' => 1, ); $bookingSearchData = $objHotelBookingDetail->dataForFrontSearch($bookingParams); - $isRmBooked = 0; + $isRoomBooked = 0; if (count($bookingSearchData['rm_data'][$product['id_product']]['data']['available']) < count($roomData['id_rms'])) { foreach ($roomData['id_rms'] as $searchRoomData) { - if($isRmBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){ + if($isRoomBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){ break; } } - if ($isRmBooked) { + if ($isRoomBooked) { $errors[] = sprintf($objModule->l('The Room \'%s\' has been booked by another customer from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to']))); - $error = true; } else { $errors[] = sprintf($objModule->l('The Room \'%s\' is no longer avalable from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to']))); - $error = true; } } } } } else { - $error = true; $errors[] = $objModule->l('You can not book rooms from "', 'HotelOrderRestrictDate'). $product['name'] .$objModule->l('". Please remove rooms from "', 'HotelOrderRestrictDate'). $product['name'] . $objModule->l('" from cart to proceed.', 'HotelOrderRestrictDate'); } } } - $context->controller->errors = array_merge($context->controller->errors, $errors); - return $errors; } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index 5fad5a10b..e40082572 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -94,7 +94,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel )) { $updateQty = $product['quantity']; if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) { - $objHotelCartBookingData = new HotelCartBookingData($idHtlCartData); + $objHotelCartBookingData = new HotelCartBookingData($htlCartBookingId); $numdays = HotelHelper::getNumberOfDays($objHotelCartBookingData->date_from, $objHotelCartBookingData->date_to); $updateQty *= $numdays; } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index 0edf2d641..58115fe8f 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -42,6 +42,9 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $objCart = new Cart($this->context->cookie->id_cart); if (Validate::isLoadedObject($objCart) && !$objCart->orderExists()) { $this->context->cart = $objCart; + + // validate cart for removing invalid data from cart + HotelCartBookingData::validateCartBookings(); } else { $this->context->cookie->id_cart = 0; // remove invalid id_cart $this->context->cart = new Cart(); @@ -61,17 +64,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $objCustomer->deleted = 0; $objCustomer->logged = 0; $objCustomer->id_guest = (int) $this->context->cookie->id_guest; - - $this->context->customer = $objCustomer; - if ($this->context->employee->isSuperAdmin()) { - $backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN'; - } else { - $backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES'; - } - if (!Configuration::get($backOrderConfigKey)) { - $htlCart = new HotelCartBookingData(); - $htlCart->removeBackdateRoomsFromCart($this->context->cart->id); - } } protected function createNewCart() From 15db13081bd2fd3f7e48bbae365d4a255c3ad57f Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 27 Apr 2024 13:03:46 +0530 Subject: [PATCH 04/21] Fixxed:: Issues in the process of Book now from back office --- .../template/controllers/orders/form.tpl | 2293 +++++++++++++++++ .../template/controllers/orders/form.tpl | 986 ++++--- controllers/admin/AdminOrdersController.php | 11 +- 3 files changed, 2787 insertions(+), 503 deletions(-) create mode 100644 admin/adminhtl/themes/default/template/controllers/orders/form.tpl diff --git a/admin/adminhtl/themes/default/template/controllers/orders/form.tpl b/admin/adminhtl/themes/default/template/controllers/orders/form.tpl new file mode 100644 index 000000000..933d0a6cc --- /dev/null +++ b/admin/adminhtl/themes/default/template/controllers/orders/form.tpl @@ -0,0 +1,2293 @@ +{* +* 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 +*} + + +
{block name="leadin"}{/block}
+{include file='controllers/orders/_current_cart_details_data.tpl'} +
+
+ + {l s='Customer'} +
+
+ +
+
+
+
+ + + + +
+
+ +
+
+
+
+
+
+ {*
+ + + +
+
+ + + + + + + + + + + +
{l s='ID'}{l s='Date'}{l s='Total'}
+
+
+ + + + + + + + + + + + + + +
{l s='ID'}{l s='Date'}{l s='Products'}{l s='Total paid'}{l s='Payment'}{l s='Status'}
+
+
+
-->*} +
+ + +{strip} + {addJsDef max_child_age=$max_child_age} + {addJsDef max_child_in_room=$max_child_in_room} + {addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL} + {addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL} + {addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL} + {addJsDefL name='rooms_txt'}{l s='Rooms' js=1}{/addJsDefL} + {addJsDefL name='remove_txt'}{l s='Remove' js=1}{/addJsDefL} + {addJsDefL name='adult_txt'}{l s='Adult' js=1}{/addJsDefL} + {addJsDefL name='adults_txt'}{l s='Adults' js=1}{/addJsDefL} + {addJsDefL name='child_txt'}{l s='Child' js=1}{/addJsDefL} + {addJsDefL name='children_txt'}{l s='Children' js=1}{/addJsDefL} + {addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL} + {addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL} + {addJsDefL name='all_children_txt'}{l s='All Children' js=1}{/addJsDefL} + {addJsDefL name='max_occupancy_reached_txt'}{l s='Maximum room occupancy reached' js=1}{/addJsDefL} + {addJsDefL name='max_adults_txt'}{l s='Maximum adult occupancy reached' js=1}{/addJsDefL} + {addJsDefL name='max_children_txt'}{l s='Maximum children occupancy reached' js=1}{/addJsDefL} + {addJsDefL name='no_children_allowed_txt'}{l s='Only adults can be accommodated' js=1}{/addJsDefL} + {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL} + + +{/strip} + +
+
+
diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index dc225fd9a..584276e38 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1732,258 +1732,84 @@
{block name="leadin"}{/block}
{include file='controllers/orders/_current_cart_details_data.tpl'} {* If cart has errors the do not allow to proceed with this cart *} - {if !$hasCartErrors} -
-
- - {l s='Customer'} -
-
- -
-
-
-
- - - - -
-
- -
-
-
-
-
-
- {*
- - - -
-
- - - - - - - - - - - -
{l s='ID'}{l s='Date'}{l s='Total'}
-
-
- - - - - - - - - - - - - - -
{l s='ID'}{l s='Date'}{l s='Products'}{l s='Total paid'}{l s='Payment'}{l s='Status'}
-
-
-
-->*} +
+
+ + {l s='Customer'}
- -