indentation updated

This commit is contained in:
azhar bhat
2025-03-26 19:36:28 +05:30
parent 3400508ade
commit a934de1cb7

View File

@@ -1144,80 +1144,80 @@ class AdminCartsControllerCore extends AdminController
// Process when admin changes extra demands of any room while order creation process form.tpl
public function ajaxProcessChangeRoomDemands()
{
if ($this->tabAccess['edit'] === '1') {
$response = array('status' => false);
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
$roomDemands = Tools::getValue('room_demands');
$roomDemands = json_decode($roomDemands, true);
$roomDemands = json_encode($roomDemands);
$objCartbookingCata->extra_demands = $roomDemands;
if ($objCartbookingCata->save()) {
$response['status'] = true;
if ($this->tabAccess['edit'] === '1') {
$response = array('status' => false);
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
$roomDemands = Tools::getValue('room_demands');
$roomDemands = json_decode($roomDemands, true);
$roomDemands = json_encode($roomDemands);
$objCartbookingCata->extra_demands = $roomDemands;
if ($objCartbookingCata->save()) {
$response['status'] = true;
}
}
}
$this->ajaxDie(json_encode($response));
}
$this->ajaxDie(json_encode($response));
}
}
public function ajaxProcessUpdateServiceProduct()
{
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)) {
// validate quanitity
if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) {
if ($objProduct->allow_multiple_quantity) {
if (!Validate::isUnsignedInt($qty)) {
$this->errors[] = Tools::displayError('The quantity code you\'ve entered is invalid.');
// } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) {
// $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity));
$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)) {
// validate quanitity
if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) {
if ($objProduct->allow_multiple_quantity) {
if (!Validate::isUnsignedInt($qty)) {
$this->errors[] = Tools::displayError('The quantity code you\'ve entered is invalid.');
// } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) {
// $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity));
}
} else {
$qty = 1;
}
} else {
$qty = 1;
$this->errors[] = Tools::displayError('This Service is not available.');
}
} else {
$this->errors[] = Tools::displayError('This Service is not available.');
$this->errors[] = Tools::displayError('This Service is not available with selected room.');
}
} else {
$this->errors[] = Tools::displayError('This Service is not available with selected room.');
}
}
if (empty($this->errors)) {
if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct(
$idCartBooking,
$idServiceProduct,
$qty,
$objHotelCartBookingData->id_cart,
$operator
)) {
$this->ajaxDie(json_encode(array(
'hasError' => false
)));
} else {
$this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.');
if (empty($this->errors)) {
if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct(
$idCartBooking,
$idServiceProduct,
$qty,
$objHotelCartBookingData->id_cart,
$operator
)) {
$this->ajaxDie(json_encode(array(
'hasError' => false
)));
} 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.');
}
} else {
$this->errors[] = Tools::displayError('Room not found. Please try reloading the page.');
$this->ajaxDie(json_encode(array(
'hasError' => true,
'errors' => $this->errors
)));
}
$this->ajaxDie(json_encode(array(
'hasError' => true,
'errors' => $this->errors
)));
}
}
public static function getOrderTotalUsingTaxCalculationMethod($id_cart)