From b379e54ee93e80f7febeffee69b426e93346b3a5 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Tue, 24 Feb 2026 17:59:39 +0530 Subject: [PATCH 1/4] Fix: Price not updating on order creation when employee lacks 'Booking Carts' edit permission --- .../orders/_current_cart_details_data.tpl | 9 ++++- .../_add_order_extra_services_tab_content.tpl | 2 +- ..._services_service_products_tab_content.tpl | 2 +- controllers/admin/AdminCartsController.php | 40 +++++++++++++++---- controllers/admin/AdminOrdersController.php | 5 +++ 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl index e3405fa99..15527c661 100644 --- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -119,8 +119,15 @@ {/if} {assign var=shown_room_type_price value=$data.feature_price_tax_excl} + {if isset($can_edit_booking_carts)} + {assign var=can_edit_booking_cart_price value=$can_edit_booking_carts} + {elseif isset($can_edit)} + {assign var=can_edit_booking_cart_price value=$can_edit} + {else} + {assign var=can_edit_booking_cart_price value=0} + {/if}
- + {$currency->prefix}{$currency->suffix}
diff --git a/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl index 048757a04..a52ee69d2 100644 --- a/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl @@ -90,7 +90,7 @@ {$cartCurrency->sign} - + {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} {l s='/ night'} {/if} diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index 8fb331302..d359a9673 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -153,7 +153,7 @@ {$currencySign} {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} - {l s='/ night'} + {l s='/ nnnnight'} {/if} diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index f76331422..963b37d16 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -687,6 +687,7 @@ class AdminCartsControllerCore extends AdminController 'cart_detail_data' => $cart_detail_data, 'cart' => $objCart, 'currency' => new Currency((int)$this->context->cart->id_currency), + 'can_edit_booking_carts' => ($this->tabAccess['edit'] === 1), 'occupancy_required_for_booking' => $occupancyRequiredForBooking, 'ajax' => true )); @@ -1257,7 +1258,8 @@ class AdminCartsControllerCore extends AdminController 'serviceProducts' => $serviceProducts, 'selectedRoomServiceProduct' => $selectedRoomServiceProduct, 'customServiceAllowed' => Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'), - 'loaderImg' => $this->context->link->getMediaLink(_PS_IMG_.'admin/ajax-loader.gif') + 'loaderImg' => $this->context->link->getMediaLink(_PS_IMG_.'admin/ajax-loader.gif'), + 'can_edit' => $this->tabAccess['edit'], )); $response['html_exta_demands'] = $this->context->smarty->fetch( @@ -1566,6 +1568,7 @@ class AdminCartsControllerCore extends AdminController 'serviceProducts' => $serviceProducts, 'selectedRoomServiceProduct' => $selectedRoomServiceProduct, 'customServiceAllowed' => Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'), + 'can_edit' => $this->tabAccess['edit'], )); $servicesTpl = $this->context->smarty->fetch( @@ -1581,7 +1584,9 @@ class AdminCartsControllerCore extends AdminController { $response = array('hasError' => false); // Check tab access is allowed to edit - if ($this->tabAccess['add'] === 1) { + $canAdd = ($this->tabAccess['add'] === 1); + $canEdit = ($this->tabAccess['edit'] === 1); + if ($canAdd || $canEdit) { $idCartBooking = Tools::getValue('id_hotel_cart_booking'); if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { $objCart = new Cart($objHotelCartBookingData->id_cart); @@ -1608,11 +1613,30 @@ class AdminCartsControllerCore extends AdminController $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name; } - if (!isset($serviceUnitPrices[$idServiceProduct]) - || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) - ) { - $response['hasError'] = true; - $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objProduct->name; + if ($canEdit) { + if (!isset($serviceUnitPrices[$idServiceProduct]) + || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) + ) { + $response['hasError'] = true; + $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objProduct->name; + } + } else { + $serviceUnitPrices[$idServiceProduct] = Product::getPriceStatic($idServiceProduct, false); + if ($specificPriceInfo = SpecificPrice::getSpecificPrice( + (int)$idServiceProduct, + 0, + $objCart->id_currency, + 0, + 0, + 1, + 0, + 0, + $objCart->id, + 0, + $objHotelCartBookingData->id + )) { + $serviceUnitPrices[$idServiceProduct] = $specificPriceInfo['price']; + } } } else { $response['errors'][] = Tools::displayError('Some services not found. please try after refreshing the page'); @@ -1659,7 +1683,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 != $unitPrice) { + if ($canEdit && $operator == 'up' && $originalPrice != $unitPrice) { if ($specificPriceInfo = SpecificPrice::getSpecificPrice( (int)$idServiceProduct, 0, diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30026bcca..6d823d039 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -431,6 +431,10 @@ class AdminOrdersControllerCore extends AdminController } $objHotelAdvancedPayment = new HotelAdvancedPayment(); + $adminCartsAccess = Profile::getProfileAccess( + (int) $this->context->employee->id_profile, + (int) Tab::getIdFromClassName('AdminCarts') + ); $this->context->smarty->assign(array( 'order_total' => $cart->getOrderTotal(true), 'is_advance_payment_active' => $objHotelAdvancedPayment->isAdvancePaymentAvailableForCurrentCart(), @@ -443,6 +447,7 @@ class AdminOrdersControllerCore extends AdminController 'payment_types' => $paymentTypes, 'PAYMENT_TYPE_PAY_AT_HOTEL' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL, 'currency' => new Currency((int)$cart->id_currency), + 'can_edit_booking_carts' => (!empty($adminCartsAccess['edit']) && (int) $adminCartsAccess['edit'] === 1), '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, From 6194c8082c2a6866467b1e120d4317353295502c Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Tue, 24 Feb 2026 18:09:28 +0530 Subject: [PATCH 2/4] Remove unused text --- .../modals/_extra_services_service_products_tab_content.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index d359a9673..8fb331302 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -153,7 +153,7 @@ {$currencySign} {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} - {l s='/ nnnnight'} + {l s='/ night'} {/if} From 8bf25f2b7a41afad6378c90a2676d3edfbb22ef0 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Tue, 24 Feb 2026 18:57:50 +0530 Subject: [PATCH 3/4] Remove unused code --- controllers/admin/AdminCartsController.php | 29 ++++------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 963b37d16..f453ccc58 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1613,30 +1613,11 @@ class AdminCartsControllerCore extends AdminController $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name; } - if ($canEdit) { - if (!isset($serviceUnitPrices[$idServiceProduct]) - || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) - ) { - $response['hasError'] = true; - $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objProduct->name; - } - } else { - $serviceUnitPrices[$idServiceProduct] = Product::getPriceStatic($idServiceProduct, false); - if ($specificPriceInfo = SpecificPrice::getSpecificPrice( - (int)$idServiceProduct, - 0, - $objCart->id_currency, - 0, - 0, - 1, - 0, - 0, - $objCart->id, - 0, - $objHotelCartBookingData->id - )) { - $serviceUnitPrices[$idServiceProduct] = $specificPriceInfo['price']; - } + if (!isset($serviceUnitPrices[$idServiceProduct]) + || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) + ) { + $response['hasError'] = true; + $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objProduct->name; } } else { $response['errors'][] = Tools::displayError('Some services not found. please try after refreshing the page'); From 1dd2a3509a1ff0a79407c38093fa5a60ee140403 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Wed, 27 May 2026 12:13:34 +0530 Subject: [PATCH 4/4] Update for the new customer , voucher and Address Co-authored-by: Name --- .../template/controllers/orders/form.tpl | 57 +++++++++++++------ controllers/admin/AdminOrdersController.php | 15 +++++ .../AdminHotelRoomsBookingController.php | 6 ++ .../helpers/view/_partials/booking-rooms.tpl | 6 +- 4 files changed, 65 insertions(+), 19 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 1de5ef4e7..2da478ade 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -27,6 +27,8 @@ var id_cart = {$cart->id|intval}; {/if} var id_customer = 0; + var can_edit_booking_carts = {if isset($can_edit_booking_carts) && $can_edit_booking_carts}true{else}false{/if}; + var can_add_addresses = {if isset($can_add_addresses) && $can_add_addresses}true{else}false{/if}; var admin_order_tab_link = "{$link->getAdminLink('AdminOrders')|addslashes}"; var changed_shipping_price = false; var shipping_price_selected_carrier = ''; @@ -620,6 +622,10 @@ $(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(guestButtonVal); } {/literal} + + if (!can_edit_booking_carts || !can_add_addresses) { + $('#address_part').hide(); + } }); function resetBind() @@ -953,7 +959,9 @@ {if isset($cart->id) && $cart->id} id_cart = "{$cart->id}"; {/if} - $('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer)); + if (address_link) { + $('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer)); + } $.ajax({ type:"POST", url : "{$link->getAdminLink('AdminCarts')|addslashes}", @@ -1505,13 +1513,20 @@ if (addresses.length == 0) { $('#address_delivery, #address_invoice').hide(); - $("#new_address").show(); + if (can_edit_booking_carts && can_add_addresses) { + $('#address_part').show(); + $("#new_address").show(); + } else { + $('#address_part').hide(); + } } else { $('#addresses_err').hide(); $("#new_address").hide(); $('#address_delivery, #address_invoice').show(); + $('#address_part').show(); + $('#address_part .panel-heading').show(); } $('#id_address_delivery').html(addresses_delivery_options).hide(); @@ -1894,13 +1909,15 @@ - + {if isset($can_edit_booking_carts) && $can_edit_booking_carts && isset($can_add_customers) && $can_add_customers} + + {/if} @@ -1918,7 +1935,7 @@ Details @@ -2127,13 +2144,15 @@ - + {if isset($can_edit_booking_carts) && $can_edit_booking_carts && isset($can_add_vouchers) && $can_add_vouchers} + + {/if} @@ -2155,7 +2174,7 @@
-
+
{l s='Addresses'}
@@ -2189,6 +2208,7 @@
+ {if isset($can_edit_booking_carts) && $can_edit_booking_carts && isset($can_add_addresses) && $can_add_addresses} + {/if}