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,