@@ -239,13 +240,13 @@
var prod_link = "{$link->getAdminLink('AdminProducts')}";
var rm_status = {$rm_status|@json_encode};
var currentRoomRow = 0;
- var datesMissing = "{$datesMissing}";
- var datesOverlapping = "{$datesOverlapping}";
$(document).ready(function() {
const DisableDatesModal = {
init: function() {
- this.addNewRow();
+ DisableDatesModal.addNewRow();
+ DisableDatesModal.hideErrors();
+ DisableDatesModal.removeAllInvalidRowDataMarkers();
},
addNewRow: function() {
$('#deactiveDatesModal tbody').append(this.disableDatesRowHtml);
@@ -260,33 +261,58 @@
$(dateRangeRow).find('.room_disable_reason').val(dateRange.reason);
});
},
- getValidationErrors: function() {
- let $return = false;
+ validateDisableDates: function(cb) {
+ DisableDatesModal.hideErrors();
+ DisableDatesModal.removeAllInvalidRowDataMarkers();
+ DisableDatesModal.disableRowDeleteActionButtons();
+
+ let idRoom = parseInt($('#deactiveDatesModal .room-disable-dates').attr('data-id-room'));
+ idRoom = idRoom == isNaN(idRoom) ? 0 : idRoom;
const disableDates = Array();
$('#deactiveDatesModal .room-disable-dates tbody tr').each(function(i, tr) {
- const dateFrom = $(tr).find('.disabled_date_from').val().trim();
- const dateTo = $(tr).find('.disabled_date_to').val().trim();
-
- if (!dateFrom.length || !dateTo.length) {
- $return = datesMissing;
- }
-
- disableDates.push({ dateFrom, dateTo });
+ const date_from = $(tr).find('.disabled_date_from').val().trim();
+ const date_to = $(tr).find('.disabled_date_to').val().trim();
+ disableDates.push({ date_from, date_to });
});
- $.each(disableDates, function(keyOuter, dateRangeOuter) {
- $.each(disableDates, function(keyInner, dateRangeInner) {
- if (keyInner != keyOuter) {
- if ((dateRangeOuter.dateFrom <= dateRangeInner.dateTo)
- && (dateRangeInner.dateFrom <= dateRangeOuter.dateTo)
- ) {
- $return = datesOverlapping;
+ $.ajax({
+ url: prod_link,
+ type: 'POST',
+ data: {
+ ajax: true,
+ action: 'validateDisableDates',
+ id_room: idRoom,
+ disable_dates: disableDates,
+ },
+ dataType: 'JSON',
+ success: function(response) {
+ if (response.status) {
+ if (typeof cb === 'function') {
+ cb();
}
+ } else {
+ DisableDatesModal.showErrors(response.errors);
+ DisableDatesModal.addInvalidRowDataMarkers(response.rows_to_highlight);
}
- });
+ },
+ complete: function () {
+ DisableDatesModal.enableRowDeleteActionButtons();
+ }
+ });
+ },
+ showErrors: function(errors) {
+ $('#deactiveDatesModal .errors-wrap').html(errors);
+ $('#deactiveDatesModal .errors-wrap').show();
+ },
+ hideErrors: function() {
+ $('#deactiveDatesModal .errors-wrap').hide();
+ $('#deactiveDatesModal .errors-wrap').html('');
+ },
+ addInvalidRowDataMarkers: function(rowsToHighlight) {
+ rowsToHighlight.map(function (rowIndex) {
+ const tr = $('#deactiveDatesModal .room-disable-dates tbody tr').eq(rowIndex);
+ DisableDatesModal.markRowDataInvalid(tr);
});
-
- return $return;
},
getDisableDatesInfo: function() {
const disableDates = Array();
@@ -300,6 +326,24 @@
return disableDates;
},
+ disableRowDeleteActionButtons: function() {
+ const disableDates = Array();
+ $('#deactiveDatesModal .room-disable-dates .remove-disable-dates-button').addClass('disabled');
+ },
+ enableRowDeleteActionButtons: function() {
+ const disableDates = Array();
+ $('#deactiveDatesModal .room-disable-dates .remove-disable-dates-button').removeClass('disabled');
+ },
+ markRowDataInvalid: function(tr) {
+ $(tr).css({ 'outline': '1px solid #D27C82', 'border-radius': '2px' });
+ },
+ removeAllInvalidRowDataMarkers: function(tr) {
+ $('#deactiveDatesModal .room-disable-dates tr').css('outline', '');
+ $(tr).css('outline', '');
+ },
+ removeRowDataMark: function(tr) {
+ $(tr).css('outline', '');
+ },
disableDatesRowHtml: `
@@ -322,8 +366,10 @@
$('#deactiveDatesModal').on('show.bs.modal', function(e) {
const triggerRoomRow = $(e.relatedTarget);
const roomRowIndex = parseInt($(triggerRoomRow).closest('tr').attr('data-row-index'));
+ const idRoom = parseInt($(triggerRoomRow).attr('data-id-room'));
$('#deactiveDatesModal table.room-disable-dates tbody').html('');
$('#deactiveDatesModal table.room-disable-dates').attr('data-room-row-index', roomRowIndex);
+ $('#deactiveDatesModal table.room-disable-dates').attr('data-id-room', idRoom);
let disableDates = $(triggerRoomRow).closest('tr').find('.disable_dates_json').val();
if (!disableDates) {
DisableDatesModal.init();
@@ -331,22 +377,27 @@
}
disableDates = JSON.parse(disableDates);
+ DisableDatesModal.hideErrors();
DisableDatesModal.populateWithDatesInfo(disableDates);
});
- // copy json formatted dates to room
- $(document).on('click', '.deactiveDatesModalSubmit', function() {
- const error = DisableDatesModal.getValidationErrors();
- if (error) {
- alert(error);
- return;
- }
-
+ // Disable dates data filling when model open
+ $('#deactiveDatesModal').on('hide.bs.modal', function(e) {
const disableDates = DisableDatesModal.getDisableDatesInfo();
const roomRowIndex = parseInt($('#deactiveDatesModal table.room-disable-dates').attr('data-room-row-index'));
const roomRow = $('#product-configuration .hotel-room tr.room_data_values[data-row-index='+roomRowIndex+']');
$(roomRow).find('.disable_dates_json').val(JSON.stringify(disableDates));
- $('#deactiveDatesModal').modal('hide');
+ });
+
+ // copy json formatted dates to room
+ $(document).on('click', '.deactiveDatesModalSubmit', function() {
+ DisableDatesModal.validateDisableDates(function () {
+ const disableDates = DisableDatesModal.getDisableDatesInfo();
+ const roomRowIndex = parseInt($('#deactiveDatesModal table.room-disable-dates').attr('data-room-row-index'));
+ const roomRow = $('#product-configuration .hotel-room tr.room_data_values[data-row-index='+roomRowIndex+']');
+ $(roomRow).find('.disable_dates_json').val(JSON.stringify(disableDates));
+ $('#deactiveDatesModal').modal('hide');
+ });
});
// Add new room detail
@@ -456,7 +507,7 @@
onClose: function(selectedDate) {
var dateTo = $(this).closest('tr').find('.disabled_date_to').val();
if (!dateTo || (dateTo && selectedDate >= dateTo)) {
- $('.disabled_date_to').datepicker('show');
+ $(this).closest('tr').find('.disabled_date_to').datepicker('show');
}
},
});
diff --git a/admin/themes/default/template/controllers/search/helpers/view/view.tpl b/admin/themes/default/template/controllers/search/helpers/view/view.tpl
index ce4853502..f7577de04 100644
--- a/admin/themes/default/template/controllers/search/helpers/view/view.tpl
+++ b/admin/themes/default/template/controllers/search/helpers/view/view.tpl
@@ -108,39 +108,39 @@ $(function() {
{/if}
- {if isset($products) && $products}
+ {if isset($num_products) && $num_products}
- {if $products|@count == 1}
+ {if $num_products == 1}
{l s='1 product'}
{else}
- {l s='%d products' sprintf=$products|@count}
+ {l s='%d products' sprintf=$num_products}
{/if}
{$products}
{/if}
- {if isset($customers) && $customers}
+ {if isset($num_customers) && $num_customers}
- {if $customers|@count == 1}
+ {if $num_customers == 1}
{l s='1 customer'}
{else}
- {l s='%d customers' sprintf=$customers|@count}
+ {l s='%d customers' sprintf=$num_customers}
{/if}
{$customers}
{/if}
- {if isset($orders) && $orders}
+ {if isset($num_orders) && $num_orders}
- {if $orders|@count == 1}
+ {if $num_orders == 1}
{l s='1 order'}
{else}
- {l s='%d orders' sprintf=$orders|@count}
+ {l s='%d orders' sprintf=$num_orders}
{/if}
{$orders}
diff --git a/classes/AdminTab.php b/classes/AdminTab.php
index 5aeee5083..e40c4affe 100644
--- a/classes/AdminTab.php
+++ b/classes/AdminTab.php
@@ -1174,7 +1174,7 @@ abstract class AdminTabCore
{
/* Classical fields */
foreach ($_POST as $key => $value) {
- if (array_key_exists($key, $object) && $key != 'id_'.$table) {
+ if (property_exists($object, $key) && $key != 'id_'.$table) {
/* Do not take care of password field if empty */
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
continue;
diff --git a/classes/Cart.php b/classes/Cart.php
index fe5e5a1a1..758ca95bd 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -568,10 +568,6 @@ class CartCore extends ObjectModel
$sql->where('cp.`id_product` = '.(int)$id_product);
}
$sql->where('p.`id_product` IS NOT NULL');
- // hide invisible products
- // if ($front) {
- // $sql->where('p.`is_invisible` = 0');
- // }
// Build ORDER BY
$sql->orderBy('cp.`date_add`, cp.`id_product`, cp.`id_product_attribute` ASC');
@@ -1991,7 +1987,9 @@ class CartCore extends ObjectModel
}
}
}
- $order_total_discount = min(Tools::ps_round($order_total_discount, 2), (float)$order_total_products) + (float)$order_shipping_discount;
+ if ($type != Cart::ADVANCE_PAYMENT) {
+ $order_total_discount = min(Tools::ps_round($order_total_discount, 2), (float)$order_total_products) + (float)$order_shipping_discount;
+ }
if ($type == Cart::ADVANCE_PAYMENT) {
// get order total without discount
$total_without_discount = $this->getOrderTotal() + $order_total_discount;
@@ -3523,7 +3521,7 @@ class CartCore extends ObjectModel
$module = Module::getInstanceByName($module_name);
if (Validate::isLoadedObject($module)) {
- if (array_key_exists('id_carrier', $module)) {
+ if (property_exists($module, 'id_carrier')) {
$module->id_carrier = $carrier->id;
}
if ($carrier->need_range) {
diff --git a/classes/Customer.php b/classes/Customer.php
index 519b96b23..718c47161 100644
--- a/classes/Customer.php
+++ b/classes/Customer.php
@@ -585,7 +585,7 @@ class CustomerCore extends ObjectModel
WHERE c.`id_customer` = '.(int)$this->id);
$result['last_visit'] = $result2['last_visit'];
- $result['age'] = ($result3['age'] != date('Y') ? $result3['age'] : '--');
+ $result['age'] = (isset($result3['age']) && $result3['age'] != date('Y') ? $result3['age'] : '--');
return $result;
}
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 44d4a95f1..d9d051da8 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -362,11 +362,11 @@ abstract class PaymentModuleCore extends Module
$order->with_occupancy = 0;
} else {
if (defined('_PS_ADMIN_DIR_')) {
- if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$order->with_occupancy = 1;
}
} else {
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$order->with_occupancy = 1;
}
}
diff --git a/classes/Product.php b/classes/Product.php
index 33d169e23..661ef09b1 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -77,6 +77,9 @@ class ProductCore extends ObjectModel
/** @var bool allow order for multiple quantities */
public $allow_multiple_quantity;
+ /** @var bool max allowed quantities */
+ public $max_quantity;
+
/** @var string available_now */
public $available_now;
@@ -240,7 +243,6 @@ class ProductCore extends ObjectModel
public $cache_has_attachments;
public $is_virtual;
public $booking_product;
- public $is_invisible;
public $id_pack_product_attribute;
public $cache_default_attribute;
@@ -297,7 +299,6 @@ class ProductCore extends ObjectModel
'cache_has_attachments' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'is_virtual' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'booking_product' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
- 'is_invisible' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'service_product_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
/* Shop fields */
@@ -308,6 +309,7 @@ class ProductCore extends ObjectModel
'ecotax' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'),
'minimal_quantity' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
'allow_multiple_quantity' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
+ 'max_quantity' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedInt'),
'price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'required' => true),
'wholesale_price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'),
'unity' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString'),
@@ -992,7 +994,7 @@ class ProductCore extends ObjectModel
public function deleteServiceInfo()
{
if (!RoomTypeServiceProduct::deleteRoomProductLink($this->id)
- ||RoomTypeServiceProductPrice::deleteRoomProductPrices($this->id)
+ || !RoomTypeServiceProductPrice::deleteRoomProductPrices($this->id)
) {
return false;
}
@@ -1339,7 +1341,6 @@ class ProductCore extends ObjectModel
.($sub_category? ' AND product_shop.`id_category_default` = '.(int)$sub_category : '')
.($front ? ' AND product_shop.`show_at_front` = 1':'')
.(!is_null($auto_add_to_cart) ? ' AND product_shop.`auto_add_to_cart` = '.$auto_add_to_cart:'')
- .($front ? ' AND p.`is_invisible` = 0':'')
.($available_for_order != 2 ? ' AND p.`available_for_order` = '.(int)$available_for_order:'')
.($active ? ' AND product_shop.`active` = 1' : '');
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
@@ -1384,7 +1385,6 @@ class ProductCore extends ObjectModel
.($sub_category? ' AND product_shop.`id_category_default` = '.(int)$sub_category : '')
.($front ? ' AND product_shop.`show_at_front` = 1':'')
.(!is_null($auto_add_to_cart) ? ' AND product_shop.`auto_add_to_cart` = '.$auto_add_to_cart:'')
- .($front ? ' AND p.`is_invisible` = 0':'')
.($available_for_order != 2 ? ' AND p.`available_for_order` = '.(int)$available_for_order:'')
.($active ? ' AND product_shop.`active` = 1' : '');
@@ -1429,7 +1429,6 @@ class ProductCore extends ObjectModel
AND p.`service_product_type` = '.(int)self::SERVICE_PRODUCT_WITH_ROOMTYPE. '
AND product_shop.`id_shop` = '.(int)$context->shop->id
.($front ? ' AND product_shop.`auto_add_to_cart` = 0 AND product_shop.`show_at_front` = 1':'')
- .($front ? ' AND p.`is_invisible` = 0':'')
.($active ? ' AND product_shop.`active` = 1' : '');
diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php
index 139b392ab..38119ed81 100644
--- a/classes/SpecificPrice.php
+++ b/classes/SpecificPrice.php
@@ -145,8 +145,7 @@ class SpecificPriceCore extends ObjectModel
FROM `'._DB_PREFIX_.'specific_price`
WHERE 1 '.self::filterOutField('id_product', $id_product).
($id_product_attribute ? ' AND id_product_attribute = '.(int) $id_product_attribute : '').'
- AND id_cart = '.(int) $id_cart.'
- GROUP BY `id_specific_price_rule`'
+ AND id_cart = '.(int) $id_cart
);
}
@@ -359,7 +358,7 @@ class SpecificPriceCore extends ObjectModel
AND IF(`from_quantity` > 1, `from_quantity`, 0) <= ';
$query .= (Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION') || !$id_cart || !$real_quantity) ? (int)$quantity : max(1, (int)$real_quantity);
- $query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC, `to` DESC, `from` DESC';
+ $query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `score` DESC, `to` DESC, `from` DESC';
SpecificPrice::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
}
diff --git a/classes/Theme.php b/classes/Theme.php
index ef1fedee7..ec6cb09f9 100644
--- a/classes/Theme.php
+++ b/classes/Theme.php
@@ -345,7 +345,7 @@ class ThemeCore extends ObjectModel
public function toggleResponsive()
{
// Object must have a variable called 'responsive'
- if (!array_key_exists('responsive', $this)) {
+ if (!property_exists($this, 'responsive')) {
throw new PrestaShopException('property "responsive" is missing in object '.get_class($this));
}
@@ -361,7 +361,7 @@ class ThemeCore extends ObjectModel
public function toggleDefaultLeftColumn()
{
- if (!array_key_exists('default_left_column', $this)) {
+ if (!property_exists($this, 'default_left_column')) {
throw new PrestaShopException('property "default_left_column" is missing in object '.get_class($this));
}
@@ -374,7 +374,7 @@ class ThemeCore extends ObjectModel
public function toggleDefaultRightColumn()
{
- if (!array_key_exists('default_right_column', $this)) {
+ if (!property_exists($this,'default_right_column')) {
throw new PrestaShopException('property "default_right_column" is missing in object '.get_class($this));
}
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index f95c48be7..223fbb009 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -3611,7 +3611,7 @@ class AdminControllerCore extends Controller
{
/* Classical fields */
foreach ($_POST as $key => $value) {
- if (array_key_exists($key, $object) && $key != 'id_'.$table) {
+ if (property_exists($object, $key) && $key != 'id_'.$table) {
/* Do not take care of password field if empty */
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
continue;
diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php
index cdd22e7a8..221396a35 100644
--- a/classes/controller/FrontController.php
+++ b/classes/controller/FrontController.php
@@ -441,7 +441,7 @@ class FrontControllerCore extends Controller
}
$occupancyRequiredForBooking = false;
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
$this->context->smarty->assign(array(
diff --git a/classes/order/OrderReturn.php b/classes/order/OrderReturn.php
index 10c549b4e..0c27a44e7 100644
--- a/classes/order/OrderReturn.php
+++ b/classes/order/OrderReturn.php
@@ -227,7 +227,20 @@ class OrderReturnCore extends ObjectModel
$bookingRow['date_to'],
$bookingRow['id_room'],
1,
- 0
+ 0,
+ null
+ );
+ $bookingRow['additional_services_tax_incl'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $bookingRow['id_order'],
+ 0,
+ 0,
+ $bookingRow['id_product'],
+ $bookingRow['date_from'],
+ $bookingRow['date_to'],
+ $bookingRow['id_room'],
+ 1,
+ 1,
+ null
);
if ($customerView) {
@@ -238,7 +251,9 @@ class OrderReturnCore extends ObjectModel
$returnsCustView[$dateJoin]['total_price_tax_incl'] += $bookingRow['total_price_tax_incl'];
$returnsCustView[$dateJoin]['total_paid_amount'] += $bookingRow['total_paid_amount'];
$returnsCustView[$dateJoin]['extra_demands_price_tax_incl'] += $bookingRow['extra_demands_price_tax_incl'];
+ $returnsCustView[$dateJoin]['extra_demands_price_tax_incl'] += $bookingRow['additional_services_tax_incl'];
$returnsCustView[$dateJoin]['extra_demands_price_tax_excl'] += $bookingRow['extra_demands_price_tax_excl'];
+ $returnsCustView[$dateJoin]['extra_demands_price_tax_excl'] += $bookingRow['additional_services_tax_excl'];
} else {
unset($bookingRow['id_room']);
unset($bookingRow['room_num']);
@@ -260,15 +275,20 @@ class OrderReturnCore extends ObjectModel
if (!$context) {
$context = Context::getContext();
}
- $sql = 'SELECT *
- FROM `'._DB_PREFIX_.'order_return` orr
- LEFT JOIN `'._DB_PREFIX_.'order_slip` ors
- ON (ors.`id_order_slip` = orr.`id_return_type` AND orr.`return_type` = '.(int) self::RETURN_TYPE_ORDER_SLIP.')
- WHERE orr.`id_customer` = '.(int)$customer_id.
- ($only_customer ? ' AND orr.`by_admin` = 0' : '').
- ($order_id ? ' AND orr.`id_order` = '.(int)$order_id : '').
- ($no_denied ? ' AND orr.`state` != 4' : '').'
- ORDER BY orr.`date_add` DESC';
+ $sql = 'SELECT orr.`id_order`, orr.`state`, orr.`id_order_return`, orr.`payment_mode`, orr.`id_transaction`,
+ orr.`id_return_type`, orr.`return_type`, ors.`id_cart_rule`, orr.`date_add`, orr.`date_upd`,
+ COUNT(ord.`id_order_return_detail`) AS total_rooms
+ FROM `'._DB_PREFIX_.'order_return` orr
+ LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord
+ ON (ord.`id_order_return` = orr.`id_order_return`)
+ LEFT JOIN `'._DB_PREFIX_.'order_slip` ors
+ ON (ors.`id_order_slip` = orr.`id_return_type` AND orr.`return_type` = '.(int) self::RETURN_TYPE_ORDER_SLIP.')
+ WHERE orr.`id_customer` = '.(int)$customer_id.
+ ($only_customer ? ' AND orr.`by_admin` = 0' : '').
+ ($order_id ? ' AND orr.`id_order` = '.(int)$order_id : '').
+ ($no_denied ? ' AND orr.`state` != 4' : '').'
+ GROUP BY orr.`id_order_return`
+ ORDER BY orr.`date_add` DESC';
$data = Db::getInstance()->executeS($sql);
foreach ($data as $k => $or) {
$state = new OrderReturnState($or['state']);
diff --git a/classes/stock/SupplyOrder.php b/classes/stock/SupplyOrder.php
index 2a62bd5fd..5df2e506b 100644
--- a/classes/stock/SupplyOrder.php
+++ b/classes/stock/SupplyOrder.php
@@ -486,7 +486,7 @@ class SupplyOrderCore extends ObjectModel
$this->id = $data[$this->def['primary']];
}
foreach ($data as $key => $value) {
- if (array_key_exists($key, $this)) {
+ if (property_exists($this, $key)) {
// formats prices and floats
if ($this->def['fields'][$key]['validate'] == 'isFloat' ||
$this->def['fields'][$key]['validate'] == 'isPrice') {
diff --git a/classes/stock/SupplyOrderDetail.php b/classes/stock/SupplyOrderDetail.php
index 517107e62..299aeaadf 100644
--- a/classes/stock/SupplyOrderDetail.php
+++ b/classes/stock/SupplyOrderDetail.php
@@ -338,7 +338,7 @@ class SupplyOrderDetailCore extends ObjectModel
$this->id = $data[$this->def['primary']];
}
foreach ($data as $key => $value) {
- if (array_key_exists($key, $this)) {
+ if (property_exists($this, $key)) {
// formats prices and floats
if ($this->def['fields'][$key]['validate'] == 'isFloat' ||
$this->def['fields'][$key]['validate'] == 'isPrice') {
diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php
index db54f518c..fd7802f8b 100644
--- a/controllers/admin/AdminCartsController.php
+++ b/controllers/admin/AdminCartsController.php
@@ -135,6 +135,7 @@ class AdminCartsControllerCore extends AdminController
$smartyVars['type'] = 'non_orderd';
}
}
+ $smartyVars['link'] = $this->context->link;
$tpl = $this->createTemplate('_orders.tpl');
$tpl->assign($smartyVars);
diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php
index 20725ae55..8b4c0d286 100644
--- a/controllers/admin/AdminCategoriesController.php
+++ b/controllers/admin/AdminCategoriesController.php
@@ -81,17 +81,18 @@ class AdminCategoriesControllerCore extends AdminController
'title' => $this->l('Position'),
'filter_key' => 'sa!position',
'position' => 'position',
- 'align' => 'center'
- ),
- 'active' => array(
- 'title' => $this->l('Displayed'),
- 'active' => 'status',
- 'type' => 'bool',
- 'class' => 'fixed-width-xs',
'align' => 'center',
- 'ajax' => true,
- 'orderby' => false
- )
+ 'class' => 'fixed-width-sm'
+ ),
+ // 'active' => array(
+ // 'title' => $this->l('Displayed'),
+ // 'active' => 'status',
+ // 'type' => 'bool',
+ // 'class' => 'fixed-width-xs',
+ // 'align' => 'center',
+ // 'ajax' => true,
+ // 'orderby' => false
+ // )
);
$this->bulk_actions = array(
@@ -421,7 +422,7 @@ class AdminCategoriesControllerCore extends AdminController
$obj = $this->loadObject(true);
$context = Context::getContext();
$id_shop = $context->shop->id;
- $selected_categories = array((isset($obj->id_parent) && $obj->isParentCategoryAvailable($id_shop))? (int)$obj->id_parent : (int)Tools::getValue('id_parent', Category::getRootCategory()->id));
+ $selected_categories = array((isset($obj->id_parent) && $obj->isParentCategoryAvailable($id_shop))? (int)$obj->id_parent : (int)Tools::getValue('id_parent', Configuration::get('PS_SERVICE_CATEGORY')));
$unidentified = new Group(Configuration::get('PS_UNIDENTIFIED_GROUP'));
$guest = new Group(Configuration::get('PS_GUEST_GROUP'));
$default = new Group(Configuration::get('PS_CUSTOMER_GROUP'));
@@ -479,25 +480,25 @@ class AdminCategoriesControllerCore extends AdminController
'class' => 'copy2friendlyUrl',
'hint' => $this->l('Invalid characters:').' <>;=#{}',
),
- array(
- 'type' => 'switch',
- 'label' => $this->l('Displayed'),
- 'name' => 'active',
- 'required' => false,
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- 'label' => $this->l('Enabled')
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- 'label' => $this->l('Disabled')
- )
- )
- ),
+ // array(
+ // 'type' => 'switch',
+ // 'label' => $this->l('Displayed'),
+ // 'name' => 'active',
+ // 'required' => false,
+ // 'is_bool' => true,
+ // 'values' => array(
+ // array(
+ // 'id' => 'active_on',
+ // 'value' => 1,
+ // 'label' => $this->l('Enabled')
+ // ),
+ // array(
+ // 'id' => 'active_off',
+ // 'value' => 0,
+ // 'label' => $this->l('Disabled')
+ // )
+ // )
+ // ),
array(
'type' => 'categories',
'label' => $this->l('Parent category'),
@@ -509,80 +510,80 @@ class AdminCategoriesControllerCore extends AdminController
'root_category' => Configuration::get('PS_SERVICE_CATEGORY')
)
),
- array(
- 'type' => 'textarea',
- 'label' => $this->l('Description'),
- 'name' => 'description',
- 'autoload_rte' => true,
- 'lang' => true,
- 'hint' => $this->l('Invalid characters:').' <>;=#{}'
- ),
- array(
- 'type' => 'file',
- 'label' => $this->l('Category Cover Image'),
- 'name' => 'image',
- 'display_image' => true,
- 'image' => $image_url ? $image_url : false,
- 'size' => $image_size,
- 'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1',
- 'hint' => $this->l('This is the main image for your category, displayed in the category page. The category description will overlap this image and appear in its top-left corner.'),
- 'format' => $format['category']
- ),
- array(
- 'type' => 'file',
- 'label' => $this->l('Category thumbnail'),
- 'name' => 'thumb',
- 'display_image' => true,
- 'image' => $thumb_url ? $thumb_url : false,
- 'size' => $thumb_size,
- 'format' => $format['medium']
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Meta title'),
- 'name' => 'meta_title',
- 'maxchar' => 70,
- 'lang' => true,
- 'rows' => 5,
- 'cols' => 100,
- 'hint' => $this->l('Forbidden characters:').' <>;=#{}'
- ),
- array(
- 'type' => 'textarea',
- 'label' => $this->l('Meta description'),
- 'name' => 'meta_description',
- 'maxchar' => 160,
- 'lang' => true,
- 'rows' => 5,
- 'cols' => 100,
- 'hint' => $this->l('Forbidden characters:').' <>;=#{}'
- ),
- array(
- 'type' => 'tags',
- 'label' => $this->l('Meta keywords'),
- 'name' => 'meta_keywords',
- 'lang' => true,
- 'hint' => $this->l('To add "tags," click in the field, write something, and then press "Enter."').' '.$this->l('Forbidden characters:').' <>;=#{}'
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Friendly URL'),
- 'name' => 'link_rewrite',
- 'lang' => true,
- 'required' => true,
- 'hint' => $this->l('Only letters, numbers, underscore (_) and the minus (-) character are allowed.')
- ),
- array(
- 'type' => 'group',
- 'label' => $this->l('Group access'),
- 'name' => 'groupBox',
- 'values' => Group::getGroups(Context::getContext()->language->id),
- 'info_introduction' => $this->l('You now have three default customer groups.'),
- 'unidentified' => $unidentified_group_information,
- 'guest' => $guest_group_information,
- 'customer' => $default_group_information,
- 'hint' => $this->l('Mark all of the customer groups which you would like to have access to this category.')
- )
+ // array(
+ // 'type' => 'textarea',
+ // 'label' => $this->l('Description'),
+ // 'name' => 'description',
+ // 'autoload_rte' => true,
+ // 'lang' => true,
+ // 'hint' => $this->l('Invalid characters:').' <>;=#{}'
+ // ),
+ // array(
+ // 'type' => 'file',
+ // 'label' => $this->l('Category Cover Image'),
+ // 'name' => 'image',
+ // 'display_image' => true,
+ // 'image' => $image_url ? $image_url : false,
+ // 'size' => $image_size,
+ // 'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1',
+ // 'hint' => $this->l('This is the main image for your category, displayed in the category page. The category description will overlap this image and appear in its top-left corner.'),
+ // 'format' => $format['category']
+ // ),
+ // array(
+ // 'type' => 'file',
+ // 'label' => $this->l('Category thumbnail'),
+ // 'name' => 'thumb',
+ // 'display_image' => true,
+ // 'image' => $thumb_url ? $thumb_url : false,
+ // 'size' => $thumb_size,
+ // 'format' => $format['medium']
+ // ),
+ // array(
+ // 'type' => 'text',
+ // 'label' => $this->l('Meta title'),
+ // 'name' => 'meta_title',
+ // 'maxchar' => 70,
+ // 'lang' => true,
+ // 'rows' => 5,
+ // 'cols' => 100,
+ // 'hint' => $this->l('Forbidden characters:').' <>;=#{}'
+ // ),
+ // array(
+ // 'type' => 'textarea',
+ // 'label' => $this->l('Meta description'),
+ // 'name' => 'meta_description',
+ // 'maxchar' => 160,
+ // 'lang' => true,
+ // 'rows' => 5,
+ // 'cols' => 100,
+ // 'hint' => $this->l('Forbidden characters:').' <>;=#{}'
+ // ),
+ // array(
+ // 'type' => 'tags',
+ // 'label' => $this->l('Meta keywords'),
+ // 'name' => 'meta_keywords',
+ // 'lang' => true,
+ // 'hint' => $this->l('To add "tags," click in the field, write something, and then press "Enter."').' '.$this->l('Forbidden characters:').' <>;=#{}'
+ // ),
+ // array(
+ // 'type' => 'text',
+ // 'label' => $this->l('Friendly URL'),
+ // 'name' => 'link_rewrite',
+ // 'lang' => true,
+ // 'required' => true,
+ // 'hint' => $this->l('Only letters, numbers, underscore (_) and the minus (-) character are allowed.')
+ // ),
+ // array(
+ // 'type' => 'group',
+ // 'label' => $this->l('Group access'),
+ // 'name' => 'groupBox',
+ // 'values' => Group::getGroups(Context::getContext()->language->id),
+ // 'info_introduction' => $this->l('You now have three default customer groups.'),
+ // 'unidentified' => $unidentified_group_information,
+ // 'guest' => $guest_group_information,
+ // 'customer' => $default_group_information,
+ // 'hint' => $this->l('Mark all of the customer groups which you would like to have access to this category.')
+ // )
),
'submit' => array(
'title' => $this->l('Save'),
@@ -736,6 +737,13 @@ class AdminCategoriesControllerCore extends AdminController
$this->errors[] = Tools::displayError('The category cannot be a parent of itself.');
}
}
+ // @todo remove this after adding link_rewrite form option
+ // currently have removed link_rewrite as it is currently not required
+ // so adding link_rewrite in $_POST
+ foreach (Language::getLanguages(true) as $lang) {
+ $_POST['link_rewrite_'.$lang['id_lang']] = Tools::link_rewrite(Tools::getValue('name_'.$lang['id_lang']));
+ }
+
$object = parent::processAdd();
//if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing
@@ -745,6 +753,22 @@ class AdminCategoriesControllerCore extends AdminController
return $object;
}
+ public function processUpdate()
+ {
+ // @todo remove this after adding link_rewrite form option
+ // currently have removed link_rewrite as it is currently not required
+ // so adding link_rewrite in $_POST
+ if (!Validate::isLoadedObject($this->object)) {
+ foreach (Language::getLanguages(true) as $lang) {
+ $_POST['link_rewrite_'.$lang['id_lang']] = Tools::link_rewrite(Tools::getValue('name_'.$lang['id_lang']));
+ }
+ } else {
+ foreach (Language::getLanguages(true) as $lang) {
+ $_POST['link_rewrite_'.$lang['id_lang']] = $this->object->link_rewrite[$lang['id_lang']];
+ }
+ }
+ }
+
protected function setDeleteMode()
{
if ($this->delete_mode == 'link' || $this->delete_mode == 'linkanddisable') {
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php
index 17cbc74d1..2e26d80bc 100644
--- a/controllers/admin/AdminNormalProductsController.php
+++ b/controllers/admin/AdminNormalProductsController.php
@@ -90,7 +90,7 @@ class AdminNormalProductsControllerCore extends AdminController
parent::__construct();
$this->imageType = 'jpg';
- $this->_defaultOrderBy = 'position';
+ $this->_defaultOrderBy = 'id_product';
$this->max_file_size = (int)(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
$this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
$this->allow_export = true;
@@ -99,7 +99,7 @@ class AdminNormalProductsControllerCore extends AdminController
$this->available_tabs_lang = array(
'Informations' => $this->l('Information'),
'Prices' => $this->l('Prices'),
- 'Seo' => $this->l('SEO'),
+ // 'Seo' => $this->l('SEO'),
'Images' => $this->l('Images'),
'Associations' => $this->l('Associations'),
);
@@ -108,7 +108,7 @@ class AdminNormalProductsControllerCore extends AdminController
$this->available_tabs = array_merge($this->available_tabs, array(
'Informations' => 0,
'Prices' => 1,
- 'Seo' => 2,
+ // 'Seo' => 2,
'Associations' => 3,
'Images' => 4,
));
@@ -948,7 +948,7 @@ class AdminNormalProductsControllerCore extends AdminController
$id_groups = Tools::getValue('spm_id_group');
$id_customers = Tools::getValue('spm_id_customer');
$prices = Tools::getValue('spm_price');
- $from_quantities = Tools::getValue('spm_from_quantity');
+ $from_quantities = 1;
$reductions = Tools::getValue('spm_reduction');
$reduction_types = Tools::getValue('spm_reduction_type');
$froms = Tools::getValue('spm_from');
@@ -1939,7 +1939,7 @@ class AdminNormalProductsControllerCore extends AdminController
if ($this->isTabSubmitted('Prices')) {
// $this->processAdvancedPayment();
$this->processPriceAddition();
- // $this->processSpecificPricePriorities();
+ $this->processSpecificPricePriorities();
}
if ($this->isTabSubmitted('Images')) {
$this->processImageLegends();
@@ -2016,6 +2016,20 @@ class AdminNormalProductsControllerCore extends AdminController
$default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages(false);
+
+ // we have removed seo tab as it is currently not required, but in product object requires link_rewrite
+ // so adding link_rewrite in $_POST
+ if (Configuration::get('PS_FORCE_FRIENDLY_PRODUCT') || !Validate::isLoadedObject($this->object)) {
+ foreach ($languages as $lang) {
+ $_POST['link_rewrite_'.$lang['id_lang']] = Tools::link_rewrite(Tools::getValue('name_'.$lang['id_lang']));
+ }
+ } else {
+ foreach ($languages as $lang) {
+ $_POST['link_rewrite_'.$lang['id_lang']] = $this->object->link_rewrite[$lang['id_lang']];
+ }
+ }
+ // end
+
// Check required fields
foreach ($rules['required'] as $field) {
if (!$this->isProductFieldUpdated($field)) {
@@ -2855,13 +2869,12 @@ class AdminNormalProductsControllerCore extends AdminController
$tree = new HelperTreeCategories('associated-categories-tree', 'Associated categories');
$tree->setTemplate('tree_associated_categories.tpl')
->setHeaderTemplate('tree_associated_header.tpl')
- ->setRootCategory((int)Configuration::get('PS_PRODUCTS_CATEGORY'))
+ ->setRootCategory((int)Configuration::get('PS_SERVICE_CATEGORY'))
->setUseCheckBox(true)
->setUseSearch(false)
->setFullTree(0)
->setSelectedCategories($categories)
->setUseBulkActions(false);
- // ->setDisablAllCategories(true);
$data->assign(array('default_category' => $default_category,
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index f928ddfc8..319248e72 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -252,7 +252,7 @@ class AdminOrdersControllerCore extends AdminController
}
$occupancyRequiredForBooking = false;
- if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
@@ -1661,9 +1661,13 @@ class AdminOrdersControllerCore extends AdminController
// hotel booking statuses
$htlOrderStatus = HotelBookingDetail::getAllHotelOrderStatus();
+
+ // applicable refund policies
+ $applicableRefundPolicies = HotelOrderRefundRules::getApplicableRefundRules($order->id);
$this->tpl_view_vars = array(
// refund info
'refund_allowed' => (int) $order->isReturnable(),
+ 'applicable_refund_policies' => $applicableRefundPolicies,
'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id),
'refundReqBookings' => $refundReqBookings,
'hasCompletelyRefunded' => $order->hasCompletelyRefunded(),
@@ -2704,7 +2708,7 @@ class AdminOrdersControllerCore extends AdminController
$objCartBookingData = new HotelCartBookingData();
$objCartBookingData->id_cart = $this->context->cart->id;
$objCartBookingData->id_guest = $this->context->cookie->id_guest;
- $objCartBookingData->id_customer = $this->context->customer->id;
+ $objCartBookingData->id_customer = $order->id_customer;
$objCartBookingData->id_currency = $order->id_currency;
$objCartBookingData->id_product = $room_info['id_product'];
$objCartBookingData->id_room = $room_info['id_room'];
@@ -3032,7 +3036,7 @@ class AdminOrdersControllerCore extends AdminController
$objBookingDetail->id_cart = $this->context->cart->id;
$objBookingDetail->id_room = $objCartBookingData->id_room;
$objBookingDetail->id_hotel = $objCartBookingData->id_hotel;
- $objBookingDetail->id_customer = $this->context->customer->id;
+ $objBookingDetail->id_customer = $order->id_customer;
$objBookingDetail->booking_type = $objCartBookingData->booking_type;
$objBookingDetail->id_status = 1;
$objBookingDetail->comment = $objCartBookingData->comment;
@@ -4213,6 +4217,8 @@ class AdminOrdersControllerCore extends AdminController
}
$product_informations = Tools::getValue('edit_product');
+ $old_date_from = date('Y-m-d', strtotime(trim(Tools::getValue('date_from'))));
+ $old_date_to = date('Y-m-d', strtotime(trim(Tools::getValue('date_to'))));
$new_date_from = trim(date('Y-m-d', strtotime($product_informations['date_from'])));
$new_date_to = trim(date('Y-m-d', strtotime($product_informations['date_to'])));
$obj_booking_detail = new HotelBookingDetail();
@@ -5268,6 +5274,8 @@ class AdminOrdersControllerCore extends AdminController
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;
diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php
index 5a0cd05de..1ea8b3f50 100644
--- a/controllers/admin/AdminPPreferencesController.php
+++ b/controllers/admin/AdminPPreferencesController.php
@@ -146,8 +146,8 @@ class AdminPPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'select',
'list' => array(
- array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')),
- array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)'))
+ array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')),
+ array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)'))
),
'identifier' => 'id',
),
@@ -181,8 +181,8 @@ class AdminPPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'select',
'list' => array(
- array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')),
- array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)'))
+ array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')),
+ array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)'))
),
'identifier' => 'id',
),
@@ -442,11 +442,11 @@ class AdminPPreferencesControllerCore extends AdminController
}
if (Tools::getValue('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
- $_POST['PS_FRONT_ROOM_UNIT_SELECTION_TYPE'] = HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY;
+ $_POST['PS_FRONT_ROOM_UNIT_SELECTION_TYPE'] = HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY;
}
if (Tools::getValue('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
- $_POST['PS_BACKOFFICE_ROOM_BOOKING_TYPE'] = HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY;
+ $_POST['PS_BACKOFFICE_ROOM_BOOKING_TYPE'] = HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY;
}
if (Tools::getIsset('PS_CATALOG_MODE')) {
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index d49a74365..521c134fd 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -2081,7 +2081,6 @@ class AdminProductsControllerCore extends AdminController
}
}
- // shreesh check if product is virtual, then set categories according to hotel
// if (Tools::getValue('is_virtual')) {
$id_hotel = Tools::getValue('id_hotel');
if (!$id_hotel || !Validate::isUnsignedInt($id_hotel)) {
@@ -2779,8 +2778,6 @@ class AdminProductsControllerCore extends AdminController
'product' => $obj,
'htl_info' => $hotelInfo,
'rm_status' => $roomStatus,
- 'datesMissing' => $this->l('Some dates are missing. Please select all the date ranges.'),
- 'datesOverlapping' => $this->l('Some dates are conflicting with each other. Please check and reselect the date ranges.'),
)
);
} else {
@@ -3118,7 +3115,7 @@ class AdminProductsControllerCore extends AdminController
}
}
- public function validateDisableDateRanges($disableDates, $index)
+ public function validateDisableDateRanges($disableDates, $index, $idRoom)
{
if (count($disableDates)) {
foreach ($disableDates as $disable_key => $disableDate) {
@@ -3135,6 +3132,7 @@ class AdminProductsControllerCore extends AdminController
$index
);
} else {
+ $objHotelBookingDetail = new HotelBookingDetail();
foreach ($disableDates as $key => $disDate) {
if ($key != $disable_key) {
if ((($disableDate['date_from'] < $disDate['date_from']) && ($disableDate['date_to'] <= $disDate['date_from'])) || (($disableDate['date_from'] > $disDate['date_from']) && ($disableDate['date_from'] >= $disDate['date_to']))) {
@@ -3146,6 +3144,13 @@ class AdminProductsControllerCore extends AdminController
);
}
}
+ // check if room has booking for current date range
+ if ($objHotelBookingDetail->chechRoomBooked($idRoom, $disDate['date_from'], $disDate['date_to'])) {
+ $this->errors[] = sprintf(
+ Tools::displayError('The %s room already has bookings for selected disable dates. Please reselect disable dates.'),
+ $index
+ );
+ }
}
}
}
@@ -3243,7 +3248,7 @@ class AdminProductsControllerCore extends AdminController
if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = json_decode($roomInfo['disable_dates_json'], true);
if ($roomInfo['disable_dates_json'] !== 0) {
- $this->validateDisableDateRanges($disableDates, $index);
+ $this->validateDisableDateRanges($disableDates, $index, $roomInfo['id']);
}
}
}
@@ -4632,6 +4637,79 @@ class AdminProductsControllerCore extends AdminController
die(json_encode($response));
}
+ public function ajaxProcessValidateDisableDates()
+ {
+ $response = array('status' => false);
+
+ $idRoom = (int) Tools::getValue('id_room');
+ $disableDates = Tools::getValue('disable_dates');
+
+ $rowsToHighlight = array();
+ $bookedRows = array();
+ if (is_array($disableDates) && count($disableDates)) {
+ foreach ($disableDates as $key => $dateRange) {
+ if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
+ $this->errors[] = $this->l('Some dates are missing. Please select all the date ranges.');
+ $rowsToHighlight[] = $key;
+ }
+ }
+
+ if (!count($this->errors)) {
+ foreach ($disableDates as $keyOuter => $dateRangeOuter) {
+ foreach ($disableDates as $keyInner => $dateRangeInner) {
+ if ($keyInner != $keyOuter) {
+ if ((($dateRangeOuter['date_from'] >= $dateRangeInner['date_from']) && ($dateRangeOuter['date_from'] < $dateRangeInner['date_to']))
+ || (($dateRangeInner['date_from'] >= $dateRangeOuter['date_from']) && ($dateRangeInner['date_from'] < $dateRangeOuter['date_to']))
+ ) {
+ $this->errors[] = $this->l('Some dates are conflicting with each other. Please check and reselect the date ranges.');
+ $rowsToHighlight[] = $keyOuter;
+ $rowsToHighlight[] = $keyInner;
+ }
+ }
+ }
+ }
+ }
+
+ if (!count($this->errors)) {
+ if ($idRoom) {
+ $objHotelBookingDetail = new HotelBookingDetail();
+ foreach ($disableDates as $key => $dateRange) {
+ if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) {
+ $bookedRows[] = new HotelBookingDetail($bookingRow['id']);
+ $rowsToHighlight[] = $key;
+ }
+ }
+ }
+ }
+ }
+
+ if (count($bookedRows)) {
+ $this->context->smarty->assign(array(
+ 'link' => $this->context->link,
+ 'booked_rows_list' => $bookedRows,
+ ));
+
+ $this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl');
+ }
+
+ $this->errors = array_unique($this->errors);
+ $rowsToHighlight = array_values(array_unique($rowsToHighlight));
+
+ if (!count($this->errors)) {
+ $response['status'] = true;
+ } else {
+ $this->context->smarty->assign(array(
+ 'errors' => $this->errors,
+ ));
+
+ $response['errors'] = $this->context->smarty->fetch('alerts.tpl');
+ $response['rows_to_highlight'] = $rowsToHighlight;
+ $response['status'] = false;
+ }
+
+ $this->ajaxDie(json_encode($response));
+ }
+
public function processImageLegends()
{
if (Tools::getValue('key_tab') == 'Images' && Tools::getValue('submitAddproductAndStay') == 'update_legends' && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) {
@@ -4663,4 +4741,4 @@ class AdminProductsControllerCore extends AdminController
return $tpl->fetch();
}
-}
\ No newline at end of file
+}
diff --git a/controllers/admin/AdminSearchController.php b/controllers/admin/AdminSearchController.php
index b8dc233dc..2b9e2b5eb 100644
--- a/controllers/admin/AdminSearchController.php
+++ b/controllers/admin/AdminSearchController.php
@@ -82,12 +82,16 @@ class AdminSearchControllerCore extends AdminController
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)$order->id.'&vieworder'.'&token='.Tools::getAdminTokenLite('AdminOrders'));
} else {
$row = get_object_vars($order);
- $row['id_order'] = $row['id'];
- $customer = $order->getCustomer();
- $row['customer'] = $customer->firstname.' '.$customer->lastname;
- $order_state = $order->getCurrentOrderState();
- $row['osname'] = $order_state->name[$this->context->language->id];
- $this->_list['orders'] = array($row);
+ $idHotel = HotelBookingDetail::getIdHotelByIdOrder($row['id']);
+ if (in_array($idHotel, HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1))) {
+ $row['id_order'] = $row['id'];
+ $customer = $order->getCustomer();
+ $row['customer'] = $customer->firstname.' '.$customer->lastname;
+ $order_state = $order->getCurrentOrderState();
+ $row['osname'] = $order_state->name[$this->context->language->id];
+ $this->_list['orders'] = array($row);
+ }
+
}
} else {
$orders = Order::getByReference($this->query);
@@ -99,12 +103,15 @@ class AdminSearchControllerCore extends AdminController
foreach ($orders as $order) {
/** @var Order $order */
$row = get_object_vars($order);
- $row['id_order'] = $row['id'];
- $customer = $order->getCustomer();
- $row['customer'] = $customer->firstname.' '.$customer->lastname;
- $order_state = $order->getCurrentOrderState();
- $row['osname'] = $order_state->name[$this->context->language->id];
- $this->_list['orders'][] = $row;
+ $idHotel = HotelBookingDetail::getIdHotelByIdOrder($row['id']);
+ if (in_array($idHotel, HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1))) {
+ $row['id_order'] = $row['id'];
+ $customer = $order->getCustomer();
+ $row['customer'] = $customer->firstname.' '.$customer->lastname;
+ $order_state = $order->getCurrentOrderState();
+ $row['osname'] = $order_state->name[$this->context->language->id];
+ $this->_list['orders'][] = $row;
+ }
}
} elseif ($searchType == 3) {
$this->errors[] = Tools::displayError('No order was found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
@@ -162,7 +169,15 @@ class AdminSearchControllerCore extends AdminController
public function searchCatalog()
{
$this->context = Context::getContext();
- $this->_list['products'] = Product::searchByName($this->context->language->id, $this->query);
+ if ($this->_list['products'] = Product::searchByName($this->context->language->id, $this->query)) {
+ $objRoomType = new HotelRoomType();
+ foreach ($this->_list['products'] as $key => $product) {
+ $roomInfo = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
+ if (!in_array($roomInfo['id_hotel'], HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1))) {
+ unset($this->_list['products'][$key]);
+ }
+ }
+ }
$this->_list['categories'] = Category::searchByName($this->context->language->id, $this->query);
}
@@ -299,9 +314,8 @@ class AdminSearchControllerCore extends AdminController
$this->show_toolbar = false;
$this->fields_list['products'] = array(
'id_product' => array('title' => $this->l('ID'), 'width' => 25),
- 'manufacturer_name' => array('title' => $this->l('Manufacturer'), 'align' => 'center', 'width' => 200),
- 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 150),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
+ 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 150),
'price_tax_excl' => array('title' => $this->l('Price (tax excl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60),
'price_tax_incl' => array('title' => $this->l('Price (tax incl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60),
'active' => array('title' => $this->l('Active'), 'width' => 70, 'active' => 'status', 'align' => 'center', 'type' => 'bool')
@@ -350,7 +364,7 @@ class AdminSearchControllerCore extends AdminController
}
$this->tpl_view_vars['categories'] = $categories;
}
- if (isset($this->_list['products']) && count($this->_list['products'])) {
+ if (isset($this->_list['products']) && $this->_list['products']&& count($this->_list['products'])) {
$view = '';
$this->initProductList();
@@ -376,6 +390,7 @@ class AdminSearchControllerCore extends AdminController
$view = $helper->generateList($this->_list['products'], $this->fields_list['products']);
}
+ $this->tpl_view_vars['num_products'] = count($this->_list['products']);
$this->tpl_view_vars['products'] = $view;
}
if (isset($this->_list['customers']) && count($this->_list['customers'])) {
@@ -398,6 +413,7 @@ class AdminSearchControllerCore extends AdminController
}
$view = $helper->generateList($this->_list['customers'], $this->fields_list['customers']);
}
+ $this->tpl_view_vars['num_customers'] = count($this->_list['customers']);
$this->tpl_view_vars['customers'] = $view;
}
if (isset($this->_list['orders']) && count($this->_list['orders'])) {
@@ -417,6 +433,7 @@ class AdminSearchControllerCore extends AdminController
if ($this->_list['orders']) {
$view = $helper->generateList($this->_list['orders'], $this->fields_list['orders']);
}
+ $this->tpl_view_vars['num_orders'] = count($this->_list['orders']);
$this->tpl_view_vars['orders'] = $view;
}
diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php
index 080d96f83..e5dd8801c 100644
--- a/controllers/front/AddressController.php
+++ b/controllers/front/AddressController.php
@@ -50,6 +50,19 @@ class AddressControllerCore extends FrontController
));
}
+ /**
+ * Initialize address controller
+ * @see FrontController::init()
+ */
+ public function init()
+ {
+ parent::init();
+
+ if ($this->context->customer->id) {
+ $this->_address = new Address(Customer::getCustomerIdAddress($this->context->customer->id));
+ }
+ }
+
/**
* Start forms process
* @see FrontController::postProcess()
diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php
index a2444c921..e3a37df06 100644
--- a/controllers/front/CartController.php
+++ b/controllers/front/CartController.php
@@ -285,11 +285,11 @@ class CartControllerCore extends FrontController
if ($product->booking_product) {
$occupancyRequiredForBooking = false;
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
- if ($occupancyRequiredForBooking) {
+ if ($occupancyRequiredForBooking && $operator == 'up') {
if ($occupancy = json_decode(Tools::getValue('occupancy'), true)) {
$this->qty = count($occupancy);
} else {
@@ -395,16 +395,26 @@ class CartControllerCore extends FrontController
if (Tools::getValue('op', 'up') == 'up') {
if ($total_available_rooms < $req_rm) {
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
- } else {
- // validate normal products if available
- if ($serviceProducts) {
- $objRoomTypeServiceProduct = new RoomTypeServiceProduct();
- foreach ($serviceProducts as $key => $standartProduct) {
- if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($this->id_product, $standartProduct['id_product'])) {
- unset($serviceProducts[$key]);
+ } else {
+ // validate service products if available
+ if ($serviceProducts) {
+ $objRoomTypeServiceProduct = new RoomTypeServiceProduct();
+ foreach ($serviceProducts as $key => $serviceProduct) {
+ if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($this->id_product, $serviceProduct['id_product'])) {
+ unset($serviceProducts[$key]);
+ } else {
+ if (Validate::isLoadedObject($objServiceProduct = new Product($serviceProduct['id_product']))) {
+ if (!$objServiceProduct->allow_multiple_quantity && $serviceProduct['quantity'] > 1) {
+ $serviceProducts[$key]['quantity'] = 1;
+ } else if ($objServiceProduct->max_quantity && $objServiceProduct->max_quantity < $serviceProduct['quantity'] ) {
+ $serviceProducts[$key]['quantity'] = $objServiceProduct->max_quantity;
+ }
+ } else {
+ $response['error'] = Tools::displayError('Service not Found');
}
}
}
+ }
}
}
} else {
@@ -621,6 +631,8 @@ class CartControllerCore extends FrontController
if ($objProduct->allow_multiple_quantity) {
if (!Validate::isUnsignedInt($qty)) {
$this->errors[] = Tools::displayError('The quantity 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;
diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php
index e227fe592..0ce9722ea 100644
--- a/controllers/front/GuestTrackingController.php
+++ b/controllers/front/GuestTrackingController.php
@@ -49,16 +49,16 @@ class GuestTrackingControllerCore extends FrontController
{
if (Tools::isSubmit('submitGuestTracking') || Tools::isSubmit('submitTransformGuestToCustomer')) {
// These lines are here for retrocompatibility with old theme
- $id_order = Tools::getValue('id_order');
+ $idOrder = Tools::getValue('id_order');
$order_collection = array();
- if ($id_order) {
- if (is_numeric($id_order)) {
- $order = new Order((int)$id_order);
+ if ($idOrder) {
+ if (is_numeric($idOrder)) {
+ $order = new Order((int)$idOrder);
if (Validate::isLoadedObject($order)) {
$order_collection = Order::getByReference($order->reference);
}
} else {
- $order_collection = Order::getByReference($id_order);
+ $order_collection = Order::getByReference($idOrder);
}
}
@@ -71,7 +71,7 @@ class GuestTrackingControllerCore extends FrontController
$email = Tools::getValue('email');
- if (empty($order_reference) && empty($id_order)) {
+ if (empty($order_reference) && empty($idOrder)) {
$this->errors[] = Tools::displayError('Please provide your order\'s reference number.');
} elseif (empty($email)) {
$this->errors[] = Tools::displayError('Please provide a valid email address.');
@@ -185,6 +185,7 @@ class GuestTrackingControllerCore extends FrontController
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$objHtlBranchInfo = new HotelBranchInformation();
$objBookingDetail = new HotelBookingDetail();
+ $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objRoomType = new HotelRoomType();
$nonRequestedRooms = 0;
@@ -225,130 +226,253 @@ class GuestTrackingControllerCore extends FrontController
if ($orderProducts = $order->getProducts()) {
$total_demands_price_te = 0;
$total_demands_price_ti = 0;
+ $total_convenience_fee_te = 0;
+ $total_convenience_fee_ti = 0;
+ // ddd($orderProducts);
foreach ($orderProducts as $type_key => $type_value) {
if (in_array($type_value['product_id'], $processedProducts)) {
continue;
}
- $processedProducts[] = $type_value['product_id'];
+ if ($type_value['is_booking_product']) {
+ $processedProducts[] = $type_value['product_id'];
- $product = new Product($type_value['product_id'], false, $this->context->language->id);
- $cover_image_arr = $product->getCover($type_value['product_id']);
+ $product = new Product($type_value['product_id'], false, $this->context->language->id);
+ $cover_image_arr = $product->getCover($type_value['product_id']);
- if (!empty($cover_image_arr)) {
- $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
- } else {
- $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
- }
-
- if (isset($customer->id)) {
- $obj_cart = new Cart($order->id_cart);
- $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id);
- } else {
- $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']);
- }
- $rm_dtl = $objRoomType->getRoomTypeInfoByIdProduct($type_value['product_id']);
-
- $cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
- $cartHotelData[$type_key]['cover_img'] = $cover_img;
- $cartHotelData[$type_key]['adults'] = $rm_dtl['adults'];
- $cartHotelData[$type_key]['children'] = $rm_dtl['children'];
-
- $objBookingDemand = new HotelBookingDemands();
- foreach ($order_bk_data as $data_k => $data_v) {
- $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
-
- /*Product price when order was created*/
- $order_details_obj = new OrderDetail($data_v['id_order_detail']);
- $prod_ord_dtl_name = $order_details_obj->product_name;
- $cartHotelData[$type_key]['name'] = $prod_ord_dtl_name;
-
- $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity;
- $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity;
-
- if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) {
- $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
-
- $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'];
- $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'];
-
- $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
- $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
- $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']*$var_quant;
- $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']*$var_quant;
- $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
- if ($data_v['is_back_order']) {
- $anyBackOrder = 1;
- }
+ if (!empty($cover_image_arr)) {
+ $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
} else {
- $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
+ $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
+ }
- $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
- $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
- $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
- $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
+ if (isset($customer->id)) {
+ $obj_cart = new Cart($order->id_cart);
+ $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id);
+ } else {
+ $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']);
+ }
+ $cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
+ $cartHotelData[$type_key]['cover_img'] = $cover_img;
- $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
- $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
- $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
- $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl'];
- $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
- if ($data_v['is_back_order']) {
- $anyBackOrder = 1;
+
+ $objBookingDemand = new HotelBookingDemands();
+ foreach ($order_bk_data as $data_k => $data_v) {
+ $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
+
+ $cartHotelData[$type_key]['adults'] = $data_v['adults'];
+ $cartHotelData[$type_key]['children'] = $data_v['children'];
+ /*Product price when order was created*/
+ $order_details_obj = new OrderDetail($data_v['id_order_detail']);
+ $cartHotelData[$type_key]['name'] = $order_details_obj->product_name;
+ $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity;
+ $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity;
+
+ if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
+
+ $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'];
+ $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'];
+
+ $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
+
+ $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
+ if ($data_v['is_back_order']) {
+ $anyBackOrder = 1;
+ }
+ } else {
+ $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
+ $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
+
+ $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl'];
+ $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order'];
+ if ($data_v['is_back_order']) {
+ $anyBackOrder = 1;
+ }
}
+
+ $cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id'];
+
+ $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
+ $idOrder,
+ $type_value['product_id'],
+ 0,
+ $data_v['date_from'],
+ $data_v['date_to']
+ );
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
+ }
+ $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
+ $idOrder,
+ $type_value['product_id'],
+ $data_v['id_room'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ 0,
+ 1,
+ 1
+ );
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
+ }
+ $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
+ $idOrder,
+ $type_value['product_id'],
+ $data_v['id_room'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ 0,
+ 1,
+ 0
+ );
+ $total_demands_price_ti += $extraDemandPriceTI;
+ $total_demands_price_te += $extraDemandPriceTE;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
+ $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl;
+
+ $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']);
+ $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
+
+ $cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name'];
+ // add additional services products in hotel detail.
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $idOrder,
+ 0,
+ 0,
+ $type_value['product_id'],
+ $data_v['date_from'],
+ $data_v['date_to']
+ );
+
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0;
+ }
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $idOrder,
+ 0,
+ 0,
+ $type_value['product_id'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ $data_v['id_room'],
+ 1,
+ 1
+ );
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0;
+ }
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $idOrder,
+ 0,
+ 0,
+ $type_value['product_id'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ $data_v['id_room'],
+ 1,
+ 0
+ );
}
- $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
- $idOrder,
- $type_value['product_id'],
- 0,
- $data_v['date_from'],
- $data_v['date_to']
- );
- if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
- $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
+ // get auto added price to be displayed with room price
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0;
}
- $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$idOrder,
- $type_value['product_id'],
0,
+ 0,
+ $type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
- 0,
+ $data_v['id_room'],
1,
- 1
+ 1,
+ 1,
+ Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
- $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI;
- if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
- $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0;
}
- $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
$idOrder,
- $type_value['product_id'],
0,
+ 0,
+ $type_value['product_id'],
$data_v['date_from'],
$data_v['date_to'],
+ $data_v['id_room'],
+ 1,
0,
1,
- 0
+ Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
- $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE;
- $total_demands_price_ti += $extraDemandPriceTI;
- $total_demands_price_te += $extraDemandPriceTE;
- $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
- $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
- $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
- $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl;
+ // calculate averages now
+ foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) {
+ $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6);
+ $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6);
- $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']);
- $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
+ $value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6));
+ $value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6));
+ }
+ } else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) {
+ if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
+ $total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $idOrder,
+ $type_value['product_id'],
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 1,
+ 1
+ );
+ $total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $idOrder,
+ $type_value['product_id'],
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 1
+ );
+ }
+ } else {
+ // get all products that are independent.
+ if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) {
+ $product = new Product($type_value['product_id'], false, $this->context->language->id);
+ $cover_image_arr = $product->getCover($type_value['product_id']);
- //enter hotel name
- $hotelInfo = $objHtlBranchInfo->hotelBranchesInfo(
- Configuration::get('PS_LANG_DEFAULT'),
- 2,
- 0,
- $data_v['id_hotel']
- );
- $cartHotelData[$type_key]['hotel_name'] = $hotelInfo['hotel_name'];
+ if (!empty($cover_image_arr)) {
+ $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default');
+ } else {
+ $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
+ }
+ $cartServiceProducts[] = $type_value;
+ }
}
}
}
@@ -359,8 +483,15 @@ class GuestTrackingControllerCore extends FrontController
null, $this->context->language->id
);
+ $customerGuestDetail = false;
+ if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
+ $customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail);
+ }
+
$this->context->smarty->assign(
array(
+ 'total_convenience_fee_ti' => $total_convenience_fee_ti,
+ 'total_convenience_fee_te' => $total_convenience_fee_te,
'total_demands_price_ti' => $total_demands_price_ti,
'total_demands_price_te' => $total_demands_price_te,
'any_back_order' => $anyBackOrder,
@@ -369,6 +500,7 @@ class GuestTrackingControllerCore extends FrontController
'order_has_invoice' => $order->hasInvoice(),
'cart_htl_data' => $cartHotelData,
'non_requested_rooms' => $nonRequestedRooms,
+ 'customerGuestDetail' => $customerGuestDetail,
)
);
//end
diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php
index ad57e8ae5..286061863 100644
--- a/controllers/front/OrderDetailController.php
+++ b/controllers/front/OrderDetailController.php
@@ -231,7 +231,7 @@ class OrderDetailControllerCore extends FrontController
} else {
foreach ($bookingRefunds as $idHtlBooking) {
$objHotelBookingDetail = new HotelBookingDetail($idHtlBooking);
- if ($objHotelBookingDetail->id_customer == $order->id_customer
+ if ($objHotelBookingDetail->id_customer != $order->id_customer
|| OrderReturn::getOrdersReturnDetail($order->id, 0, $idHtlBooking)
) {
$hasError = 1;
@@ -486,40 +486,40 @@ class OrderDetailControllerCore extends FrontController
1,
0
);
+ // get auto added price to be displayed with room price
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0;
+ }
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $id_order,
+ 0,
+ 0,
+ $type_value['product_id'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ $data_v['id_room'],
+ 1,
+ 1,
+ 1,
+ Product::PRICE_ADDITION_TYPE_WITH_ROOM
+ );
+ if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) {
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0;
+ }
+ $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $id_order,
+ 0,
+ 0,
+ $type_value['product_id'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ $data_v['id_room'],
+ 1,
+ 0,
+ 1,
+ Product::PRICE_ADDITION_TYPE_WITH_ROOM
+ );
}
- // get auto added price to be displayed with room price
- if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) {
- $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0;
- }
- $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
- $id_order,
- 0,
- 0,
- $type_value['product_id'],
- $data_v['date_from'],
- $data_v['date_to'],
- $data_v['id_room'],
- 1,
- 1,
- 1,
- Product::PRICE_ADDITION_TYPE_WITH_ROOM
- );
- if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) {
- $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0;
- }
- $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
- $id_order,
- 0,
- 0,
- $type_value['product_id'],
- $data_v['date_from'],
- $data_v['date_to'],
- $data_v['id_room'],
- 1,
- 0,
- 1,
- Product::PRICE_ADDITION_TYPE_WITH_ROOM
- );
// calculate averages now
foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) {
$value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6);
diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php
index f5a5bec2b..cc11fa369 100644
--- a/controllers/front/OrderOpcController.php
+++ b/controllers/front/OrderOpcController.php
@@ -389,6 +389,9 @@ class OrderOpcControllerCore extends ParentOrderController
*/
public function initContent()
{
+ // check all service products are available
+ RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
+
parent::initContent();
// check ORDER RESTRICT condition before payment by the customer
@@ -452,7 +455,6 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->smarty->assign('checkout_process_steps', $this->checkoutProcess->getSteps());
- // @todo shreesh get this checked with sumit sir
// set room type demands
// $objGlobalDemand = new HotelRoomTypeGlobalDemand();
// $allDemands = $objGlobalDemand->getAllDemands();
diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php
index 03b88c709..4271557da 100644
--- a/controllers/front/ProductController.php
+++ b/controllers/front/ProductController.php
@@ -305,10 +305,6 @@ class ProductControllerCore extends FrontController
$htl_features = array();
$obj_hotel_room_type = new HotelRoomType();
$room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id);
- $productCapacity = array();
- $productCapacity['adults'] = $room_info_by_product_id['adults'];
- $productCapacity['children'] = $room_info_by_product_id['children'];
- $this->product->capacity = $productCapacity;
if ($hotel_id = $room_info_by_product_id['id_hotel']) {
$obj_hotel_branch = new HotelBranchInformation();
$hotel_info_by_id = $obj_hotel_branch->hotelBranchesInfo(false, 2, 1, $hotel_id);
@@ -590,7 +586,7 @@ class ProductControllerCore extends FrontController
'id_cart' => $idCart,
'id_guest' => $idGuest,
);
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$bookingParams['occupancy'] = $occupancy;
$quantity = count($occupancy);
} else {
@@ -689,10 +685,22 @@ class ProductControllerCore extends FrontController
$serviceProductsPrice = 0;
if ($roomServiceProducts = json_decode($roomServiceProducts, true)) {
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
+ $objRoomTypeServiceProduct = new RoomTypeServiceProduct();
foreach ($roomServiceProducts as &$product) {
- $objProduct = new ProductCore($product['id_product'], false, $this->context->language->id);
- $product['name'] = $objProduct->name;
- $product['allow_multiple_quantity'] = $objProduct->allow_multiple_quantity;
+ if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $product['id_product'])) {
+ unset($product);
+ continue;
+ } else {
+ $objServiceProduct = new ProductCore($product['id_product'], false, $this->context->language->id);
+ if (!$objServiceProduct->allow_multiple_quantity && $product['quantity'] > 1) {
+ $product['quantity'] = 1;
+ } else if ($objServiceProduct->max_quantity && $objServiceProduct->max_quantity < $product['quantity'] ) {
+ $product['quantity'] = $objServiceProduct->max_quantity;
+ }
+
+ }
+ $product['name'] = $objServiceProduct->name;
+ $product['allow_multiple_quantity'] = $objServiceProduct->allow_multiple_quantity;
$productPrice = $objRoomTypeServiceProductPrice->getProductPrice($product['id_product'], $idProduct, $product['quantity'], $useTax);
$product['price'] = $productPrice;
$serviceProductsPrice += $productPrice;
@@ -1319,12 +1327,14 @@ class ProductControllerCore extends FrontController
public function displayAjaxCheckServiceProductWithRoomType()
{
$response = array(
- 'status' => false
+ 'success' => false
);
if ($this->isTokenValid()) {
$idProduct = Tools::getValue('id_product');
$idServiceProduct = Tools::getValue('service_product');
+ $addedServiceProduct = Tools::getValue('added_service_product');
+ $qty = Tools::getValue('qty');
if (Validate::isLoadedObject($objProduct = new Product($idProduct))) {
if (!Product::isBookingProduct($idProduct)) {
$response['error'] = Tools::displayError('Room Type info not Found');
@@ -1335,7 +1345,37 @@ class ProductControllerCore extends FrontController
if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $idServiceProduct)) {
$response['error'] = Tools::displayError('Selected product is not available with current room type');
} else {
- $response['status'] = true;
+ if (Validate::isLoadedObject($objServiceProduct = new Product($idServiceProduct))) {
+ $response['success'] = true;
+ if (!$objServiceProduct->allow_multiple_quantity) {
+ if (!empty($addedServiceProduct)) {
+ if (!in_array($idServiceProduct, array_column($addedServiceProduct, 'id_product'))) {
+ $response['add'] = true;
+ $response['msg'] = 'Service is added to cart.';
+ } else {
+ $response['msg'] = 'Service already added.';
+ }
+ } else {
+ $response['add'] = true;
+ $response['msg'] = 'Service is added to cart.';
+ }
+ } else {
+ $totalQty = $qty;
+ if (!empty($addedServiceProduct)) {
+ if (($key = array_search($idServiceProduct, array_column($addedServiceProduct, 'id_product')))!== false) {
+ $totalQty += $addedServiceProduct[$key]['quantity'];
+ }
+ }
+ if ($objServiceProduct->max_quantity && $objServiceProduct->max_quantity < $totalQty ) {
+ $response['msg'] = Tools::displayError(sprintf('Cannot add more than %d quantity.', $objServiceProduct->max_quantity));
+ } else {
+ $response['add'] = true;
+ $response['msg'] = Tools::displayError('Service is added to cart.');
+ }
+ }
+ } else {
+ $response['error'] = Tools::displayError('Service not Found');
+ }
}
} else {
$response['error'] = Tools::displayError('Room Type not Found');
diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql
index 5bc961640..69c631d36 100644
--- a/install/data/db_structure.sql
+++ b/install/data/db_structure.sql
@@ -1519,6 +1519,7 @@ CREATE TABLE `PREFIX_product` (
`quantity` int(10) NOT NULL DEFAULT '0',
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
`allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1',
+ `max_quantity` int(10) unsigned NOT NULL DEFAULT '1',
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`unity` varchar(255) DEFAULT NULL,
@@ -1554,7 +1555,6 @@ CREATE TABLE `PREFIX_product` (
`cache_has_attachments` tinyint(1) NOT NULL DEFAULT '0',
`is_virtual` tinyint(1) NOT NULL DEFAULT '0',
`booking_product` tinyint(1) NOT NULL DEFAULT '1',
- `is_invisible` tinyint(1) NOT NULL DEFAULT '0',
`cache_default_attribute` int(10) unsigned DEFAULT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
@@ -1578,6 +1578,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_shop` (
`ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
`allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1',
+ `max_quantity` int(10) unsigned NOT NULL DEFAULT '1',
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
`unity` varchar(255) DEFAULT NULL,
diff --git a/js/admin.js b/js/admin.js
index 91075c0f9..2ba357032 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -1616,7 +1616,7 @@ function loadRecommendation()
token: token
},
success: function(res) {
- if (res.success && res.content.trim()) {
+ if (res.success && res.content && res.content.trim()) {
$('#recommendation-wrapper-skeleton').fadeIn('slow');
$('#recommendation-wrapper').html(res.content);
let images = $('#recommendation-wrapper img');
diff --git a/js/admin/normal_products.js b/js/admin/normal_products.js
index abe3db07a..e15945f8b 100644
--- a/js/admin/normal_products.js
+++ b/js/admin/normal_products.js
@@ -449,6 +449,14 @@ product_tabs['Informations'] = new function(){
}
});
+ $('input[name=allow_multiple_quantity]').on('change', function(e) {
+ if ($(this).val() == 1) {
+ $('#max_quantity_container').show('fast');
+ } else {
+ $('#max_quantity_container').hide('fast');
+ }
+ });
+
$('#related_product_autocomplete_input')
.autocomplete('ajax_products_list.php?exclude_packs=0&excludeVirtuals=0&excludeIds='+id_product, {
minChars: 1,
diff --git a/js/daterangepicker/jquery.daterangepicker.js b/js/daterangepicker/jquery.daterangepicker.js
index c104e536b..e9338be38 100755
--- a/js/daterangepicker/jquery.daterangepicker.js
+++ b/js/daterangepicker/jquery.daterangepicker.js
@@ -2579,11 +2579,9 @@
*/
function translate(translationKey) {
var translationKeyLowerCase = translationKey.toLowerCase();
- console.log(languages);
var result = (translationKey in languages) ? languages[translationKey] : (translationKeyLowerCase in languages) ? languages[translationKeyLowerCase] : null;
var defaultLanguage = $.dateRangePickerLanguages['default'];
if (result == null) result = (translationKey in defaultLanguage) ? defaultLanguage[translationKey] : (translationKeyLowerCase in defaultLanguage) ? defaultLanguage[translationKeyLowerCase] : '';
- console.log(result);
return result;
}
diff --git a/modules/bankwire/controllers/front/payment.php b/modules/bankwire/controllers/front/payment.php
index cee1fe886..59dc5ab17 100644
--- a/modules/bankwire/controllers/front/payment.php
+++ b/modules/bankwire/controllers/front/payment.php
@@ -50,6 +50,9 @@ class BankwirePaymentModuleFrontController extends ModuleFrontController
$total = $cart->getOrderTotal(true, Cart::BOTH);
}
+ // check all service products are available
+ RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
+
$restrict_order = false;
/*Check Order restrict condition before Payment by the customer*/
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
diff --git a/modules/bankwire/controllers/front/validation.php b/modules/bankwire/controllers/front/validation.php
index c96ff78ec..5df9b7411 100644
--- a/modules/bankwire/controllers/front/validation.php
+++ b/modules/bankwire/controllers/front/validation.php
@@ -49,6 +49,9 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
if (!$authorized)
die($this->module->l('This payment method is not available.', 'validation'));
+ // check all service products are available
+ RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
+
// Check Order restrict condition before Payment by the customer
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
diff --git a/modules/blocknavigationmenu/views/js/htlnevigationmenu.js b/modules/blocknavigationmenu/views/js/htlnevigationmenu.js
index 2c59f8b85..8348de716 100644
--- a/modules/blocknavigationmenu/views/js/htlnevigationmenu.js
+++ b/modules/blocknavigationmenu/views/js/htlnevigationmenu.js
@@ -47,4 +47,17 @@ $(document).ready(function()
if (menu_cont.hasClass("menu_cont_left"))
menu_cont.removeClass("menu_cont_left").addClass("menu_cont_right");
});
-});
\ No newline at end of file
+
+ $(document).on('click', function(e) {
+ const navigationMenu = $('#menu_cont');
+ if (navigationMenu.length) {
+ if (!($(e.target).closest('#menu_cont').length
+ || $(e.target).closest('.header-top .header-top-menu .nav_toggle').length
+ )) {
+ if (navigationMenu.hasClass('menu_cont_left')) {
+ navigationMenu.removeClass('menu_cont_left').addClass('menu_cont_right');
+ }
+ }
+ }
+ });
+});
diff --git a/modules/cheque/controllers/front/payment.php b/modules/cheque/controllers/front/payment.php
index e1415337d..1d5e0f76b 100644
--- a/modules/cheque/controllers/front/payment.php
+++ b/modules/cheque/controllers/front/payment.php
@@ -50,6 +50,9 @@ class ChequePaymentModuleFrontController extends ModuleFrontController
$total = $cart->getOrderTotal(true, Cart::BOTH);
}
+ // check all service products are available
+ RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
+
$restrict_order = false;
/*Check Order restrict condition before Payment by the customer*/
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
diff --git a/modules/cheque/controllers/front/validation.php b/modules/cheque/controllers/front/validation.php
index 6f75120a9..f280abd3f 100644
--- a/modules/cheque/controllers/front/validation.php
+++ b/modules/cheque/controllers/front/validation.php
@@ -48,6 +48,9 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
if (!$authorized)
die($this->module->l('This payment method is not available.', 'validation'));
+ // check all service products are available
+ RoomTypeServiceProductCartDetail::validateServiceProductsInCart();
+
/*Check Order restrict condition before Payment by the customer*/
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
index 1a459053b..164d695d9 100644
--- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php
+++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
@@ -82,8 +82,8 @@ class HotelBookingDetail extends ObjectModel
const SEARCH_TYPE_NORMAL = 2;
//
- const PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY = 1;
- const PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY = 2;
+ const PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY = 1;
+ const PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY = 2;
public static $definition = array(
'table' => 'htl_booking_detail',
@@ -1254,7 +1254,7 @@ class HotelBookingDetail extends ObjectModel
// This function algo is same as available rooms algo and it not similar to booked rooms algo.
public function chechRoomBooked($id_room, $date_from, $date_to)
{
- $sql = 'SELECT `id_product`, `id_order`, `id_cart`, `id_room`, `id_hotel`, `id_customer`
+ $sql = 'SELECT `id`, `id_product`, `id_order`, `id_cart`, `id_room`, `id_hotel`, `id_customer`
FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `id_room` = '.(int)$id_room.
' AND `is_back_order` = 0 AND `is_refunded` = 0 AND ((date_from <= \''.pSQL($date_from).'\' AND date_to > \''.
pSQL($date_from).'\' AND date_to <= \''.pSQL($date_to).'\') OR (date_from > \''.pSQL($date_from).
diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
index 3afd75fac..a391ae2dc 100644
--- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php
+++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
@@ -450,7 +450,12 @@ class HotelCartBookingData extends ObjectModel
$chkQty = 0;
$num_days = HotelHelper::getNumberOfDays($date_from, $date_to);
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (defined('_PS_ADMIN_DIR_')) {
+ $PS_ROOM_UNIT_SELECTION_TYPE = Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE');
+ } else {
+ $PS_ROOM_UNIT_SELECTION_TYPE = Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE');
+ }
+ if ($PS_ROOM_UNIT_SELECTION_TYPE == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$roomsRequired = count($occupancy);
} else {
$objRoomType = new HotelRoomType();
@@ -475,7 +480,7 @@ class HotelCartBookingData extends ObjectModel
$obj_htl_cart_booking_data->extra_demands = $roomDemand;
$obj_htl_cart_booking_data->date_from = $date_from;
$obj_htl_cart_booking_data->date_to = $date_to;
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if ($PS_ROOM_UNIT_SELECTION_TYPE == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$room_occupancy = array_shift($occupancy);
$obj_htl_cart_booking_data->adults = $room_occupancy['adults'];
$obj_htl_cart_booking_data->children = $room_occupancy['children'];
@@ -573,8 +578,12 @@ class HotelCartBookingData extends ObjectModel
'id_cart' => $id_cart,
'id_guest' => $id_guest,
);
-
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (defined('_PS_ADMIN_DIR_')) {
+ $PS_ROOM_UNIT_SELECTION_TYPE = Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE');
+ } else {
+ $PS_ROOM_UNIT_SELECTION_TYPE = Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE');
+ }
+ if ($PS_ROOM_UNIT_SELECTION_TYPE == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$roomsRequired = count($occupancy);
} else {
$roomsRequired = $occupancy;
diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php
index 7234b8370..114f67b3a 100644
--- a/modules/hotelreservationsystem/classes/HotelHelper.php
+++ b/modules/hotelreservationsystem/classes/HotelHelper.php
@@ -256,10 +256,10 @@ class HotelHelper
// Search Fields
Configuration::updateValue('PS_FRONT_SEARCH_TYPE', HotelBookingDetail::SEARCH_TYPE_OWS);
Configuration::updateValue('PS_FRONT_OWS_SEARCH_ALGO_TYPE', HotelBookingDetail::SEARCH_EXACT_ROOM_TYPE_ALGO);
- Configuration::updateValue('PS_FRONT_ROOM_UNIT_SELECTION_TYPE', HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY);
+ Configuration::updateValue('PS_FRONT_ROOM_UNIT_SELECTION_TYPE', HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY);
Configuration::updateValue('PS_BACKOFFICE_SEARCH_TYPE', HotelBookingDetail::SEARCH_TYPE_OWS);
Configuration::updateValue('PS_BACKOFFICE_OWS_SEARCH_ALGO_TYPE', HotelBookingDetail::SEARCH_ALL_ROOM_TYPE_ALGO);
- Configuration::updateValue('PS_BACKOFFICE_ROOM_BOOKING_TYPE', HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY);
+ Configuration::updateValue('PS_BACKOFFICE_ROOM_BOOKING_TYPE', HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY);
return true;
}
diff --git a/modules/hotelreservationsystem/classes/HotelImage.php b/modules/hotelreservationsystem/classes/HotelImage.php
index 3c9efcb4b..e3e538706 100644
--- a/modules/hotelreservationsystem/classes/HotelImage.php
+++ b/modules/hotelreservationsystem/classes/HotelImage.php
@@ -44,7 +44,7 @@ class HotelImage extends ObjectModel
$this->source_index = _PS_HOTEL_IMG_DIR_.'index.php';
- $this->image_dir = _PS_HOTEL_IMG_.$this->getImgFolder();
+ $this->image_dir = _PS_HOTEL_IMG_DIR_.$this->getImgFolder();
}
/**
@@ -61,6 +61,33 @@ class HotelImage extends ObjectModel
return true;
}
+ /**
+ * Delete the hotel image from disk and remove the containing folder if empty
+ * Handles both legacy and new image filesystems
+ */
+ public function deleteImage($force_delete = false)
+ {
+ parent::deleteImage();
+ // Can we delete the image folder?
+ if (is_dir($this->image_dir)) {
+ $delete_folder = true;
+ foreach (scandir($this->image_dir) as $file) {
+ if (($file != '.' && $file != '..' && $file != 'index.php')) {
+ $delete_folder = false;
+ break;
+ }
+ }
+ }
+
+ if (isset($delete_folder) && $delete_folder) {
+ // delete index image before deleting folder
+ unlink($this->image_dir.'index.php');
+ @rmdir($this->image_dir);
+ }
+
+ return true;
+ }
+
/**
* [getImagesByHotelId :: To get paginated hotel images data]
* @param [int] $id_hotel [id_hotel to get images of]
@@ -232,9 +259,9 @@ class HotelImage extends ObjectModel
}
}
$addedImage = array(
- 'id_image' => $objHtlImage->id,
+ 'id' => $objHtlImage->id,
'cover' => $objHtlImage->cover,
- 'image_url' => Context::getContext()->link->getMediaLink($objHtlImage->getImageLink($objHtlImage->id)),
+ 'image_link' => Context::getContext()->link->getMediaLink($objHtlImage->getImageLink($objHtlImage->id)),
);
return $addedImage;
}
diff --git a/modules/hotelreservationsystem/classes/HotelOrderRefundRules.php b/modules/hotelreservationsystem/classes/HotelOrderRefundRules.php
index d49354299..491c82c29 100644
--- a/modules/hotelreservationsystem/classes/HotelOrderRefundRules.php
+++ b/modules/hotelreservationsystem/classes/HotelOrderRefundRules.php
@@ -132,6 +132,7 @@ class HotelOrderRefundRules extends ObjectModel
$objHtlRefundRules = new HotelBranchRefundRules();
$objHotelBookingDemands = new HotelBookingDemands();
+ $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
if ($bookingsToRefund = OrderReturn::getOrdersReturnDetail($idOrder, $idOrderReturn, $idHtlBooking)) {
foreach ($bookingsToRefund as $booking) {
@@ -152,6 +153,19 @@ class HotelOrderRefundRules extends ObjectModel
1
);
+ $totalServicesPrice = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
+ $objHtlBooking->id_order,
+ 0,
+ 0,
+ $objHtlBooking->id_product,
+ $objHtlBooking->date_from,
+ $objHtlBooking->date_to,
+ $objHtlBooking->id_room,
+ 1,
+ 1,
+ null
+ );
+
if ($refundRules = $objHtlRefundRules->getHotelRefundRules($objHtlBooking->id_hotel, 0, 1)) {
$orderCurrency = $objOrder->id_currency;
$defaultCurrency = Configuration::get('PS_CURRENCY_DEFAULT');
@@ -169,7 +183,7 @@ class HotelOrderRefundRules extends ObjectModel
$ruleApplied = false;
foreach ($refundRules as $refRule) {
if ($daysBeforeCancel >= $refRule['days']) {
- $paidAmount = $objHtlBooking->total_paid_amount + $totalDemandsPrice;
+ $paidAmount = $objHtlBooking->total_paid_amount + $totalDemandsPrice + $totalServicesPrice;
if ($objOrder->is_advance_payment) {
$refundValue = $refRule['deduction_value_adv_pay'];
} else {
@@ -222,4 +236,44 @@ class HotelOrderRefundRules extends ObjectModel
return $totalCancelationCharges;
}
+
+ public static function getApplicableRefundRules($idOrder)
+ {
+ $idLang = Context::getContext()->language->id;
+
+ $maxDate = Db::getInstance()->getValue(
+ 'SELECT MAX(DATE(hbd.`date_from`))
+ FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
+ WHERE hbd.`id_order` = '.(int) $idOrder
+ );
+
+ if ($maxDate) {
+ $dateToday = date('Y-m-d');
+
+ if (strtotime($maxDate) >= strtotime($dateToday)) {
+ $days = HotelBookingDetail::getDays($dateToday, $maxDate); // always returns positive
+
+ $sql = 'SELECT hbrr.`id_hotel_refund_rule`, hbrr.`id_refund_rule`, hbrr.`id_hotel`, hbrr.`position`,
+ horrl.`name`, horrl.`description`, horr.`payment_type`, horr.`deduction_value_full_pay`,
+ horr.`deduction_value_adv_pay`, horr.`days`
+ FROM `'._DB_PREFIX_.'htl_branch_refund_rules` hbrr
+ LEFT JOIN `'._DB_PREFIX_.'htl_order_refund_rules` horr
+ ON (horr.`id_refund_rule` = hbrr.`id_refund_rule`)
+ LEFT JOIN `'._DB_PREFIX_.'htl_order_refund_rules_lang` horrl
+ ON (horrl.`id_refund_rule` = horr.`id_refund_rule` AND horrl.`id_lang` = '.(int) $idLang.')
+ LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
+ ON (hbd.`id_hotel` = hbrr.`id_hotel` AND hbd.`id_order` = '.(int) $idOrder.')
+ WHERE horr.`days` <= '.(int) $days.'
+ GROUP BY hbrr.`id_refund_rule`
+ ORDER BY hbrr.`position`';
+
+ if ($result = Db::getInstance()->executeS($sql)) {
+ return $result;
+ }
+ }
+ }
+
+ return array();
+
+ }
}
diff --git a/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php b/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php
index e46d9ae5f..785bc515f 100644
--- a/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php
+++ b/modules/hotelreservationsystem/classes/HotelOrderRestrictDate.php
@@ -103,41 +103,6 @@ class HotelOrderRestrictDate extends ObjectModel
)) {
$cart_data = array();
foreach ($cart_bk_data as $data) {
- $objCartBookingData = new HotelCartBookingData($data['id']);
- if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($objCartBookingData->id_hotel)) {
- if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($objCartBookingData->date_from)
- || strtotime($maxOrderDate) < strtotime($objCartBookingData->date_to)
- ) {
- $objBranchInfo = new HotelBranchInformation(
- $objCartBookingData->id_hotel,
- $context->language->id
- );
- $controller->errors[] = sprintf(
- 'You can not book rooms for hotel \'%s\' after date %s. Please remove these rooms to proceed.',
- $objBranchInfo->hotel_name,
- Tools::displayDate($maxOrderDate)
- );
- $error = true;
- }
- }
- $preparationTime = HotelOrderRestrictDate::getPreparationTime($objCartBookingData->id_hotel);
- if ($preparationTime !== false) {
- $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
- if (strtotime($minOrderDate) > strtotime($objCartBookingData->date_from)
- || strtotime($minOrderDate . ' +1 day')> strtotime($objCartBookingData->date_to)
- ) {
- $objBranchInfo = new HotelBranchInformation(
- $objCartBookingData->id_hotel,
- $context->language->id
- );
- $controller->errors[] = sprintf(
- 'You can not book rooms for hotel \'%s\' before date %s. Please remove these rooms to proceed.',
- $objBranchInfo->hotel_name,
- Tools::displayDate($minOrderDate)
- );
- $error = true;
- }
- }
$date_join = strtotime($data['date_from']).strtotime($data['date_to']);
$cart_data[$date_join]['date_from'] = $data['date_from'];
$cart_data[$date_join]['date_to'] = $data['date_to'];
@@ -145,6 +110,45 @@ class HotelOrderRestrictDate extends ObjectModel
$cart_data[$date_join]['id_rms'][] = $data['id_room'];
}
foreach ($cart_data as $cl_key => $cl_val) {
+ if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($cl_val['id_hotel'])) {
+ if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($cl_val['date_from'])
+ || strtotime($maxOrderDate) < strtotime($cl_val['date_to'])
+ ) {
+ $objBranchInfo = new HotelBranchInformation(
+ $cl_val['id_hotel'],
+ $context->language->id
+ );
+ $controller->errors[] = sprintf(
+ 'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
+ $objBranchInfo->hotel_name,
+ Tools::displayDate($maxOrderDate),
+ Tools::displayDate($cl_val['date_from']),
+ Tools::displayDate($cl_val['date_to'])
+ );
+ $error = true;
+ }
+ }
+ $preparationTime = HotelOrderRestrictDate::getPreparationTime($cl_val['id_hotel']);
+ if ($preparationTime !== false) {
+ $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
+ if (strtotime($minOrderDate) > strtotime($cl_val['date_from'])
+ || strtotime($minOrderDate . ' +1 day')> strtotime($cl_val['date_to'])
+ ) {
+ $objBranchInfo = new HotelBranchInformation(
+ $cl_val['id_hotel'],
+ $context->language->id
+ );
+ $controller->errors[] = sprintf(
+ 'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
+ $objBranchInfo->hotel_name,
+ Tools::displayDate($minOrderDate),
+ Tools::displayDate($cl_val['date_from']),
+ Tools::displayDate($cl_val['date_to'])
+ );
+ $error = true;
+ }
+ }
+
$bookingParams = array(
'date_from' => $cl_val['date_from'],
'date_to' => $cl_val['date_to'],
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php
index 199d3a178..f9ad63bc8 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php
@@ -120,7 +120,7 @@ class RoomTypeServiceProduct extends ObjectModel
if (Product::isBookingProduct($idProduct)) {
$sql = 'SELECT p.`id_product` FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
INNER JOIN `'._DB_PREFIX_.'product` p ON (rsp.`id_product` = p.`id_product` AND p.`auto_add_to_cart` = 1)
- WHERE `id_element` = '.(int)$idProduct.' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE;
+ WHERE p.`active` = 1 AND `id_element` = '.(int)$idProduct.' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE;
if (!is_null($priceAdditionType)) {
$sql .= ' AND p.`price_addition_type` = '.$priceAdditionType;
}
@@ -183,6 +183,7 @@ class RoomTypeServiceProduct extends ObjectModel
$useTax
);
}
+ $serviceProduct['images'] = Image::getImages((int)Context::getContext()->language->id, $serviceProduct['id_product']);
}
return $serviceProducts;
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
index eafa043bb..8516832e5 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
@@ -107,16 +107,24 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
if ($useTax === null)
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
+ $idLang = Context::getContext()->language->id;
+
$sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_cart`, cbd.`id` as `htl_cart_booking_id` ,
cbd.`id_product` as `room_type_id_product`, cbd.`adults`, cbd.`children`';
if (!$getTotalPrice) {
- $sql .= ', cbd.`id_guest`, cbd.`id_customer`, p.`auto_add_to_cart`, p.`price_addition_type`,
+ $sql .= ', pl.`name`, cbd.`id_guest`, cbd.`id_customer`, p.`auto_add_to_cart`, p.`price_addition_type`,
cbd.`id_hotel`, cbd.`id_room`, cbd.`date_from`, cbd.`date_to`, cbd.`is_refunded`';
}
$sql .= ' FROM `'._DB_PREFIX_.'htl_cart_booking_data` cbd
- LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd ON(rscd.`htl_cart_booking_id` = cbd.`id`)
- LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rscd.`id_product`)
- WHERE 1';
+ LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd
+ ON(rscd.`htl_cart_booking_id` = cbd.`id`)
+ LEFT JOIN `'._DB_PREFIX_.'product` p
+ ON (p.`id_product` = rscd.`id_product`)';
+ if (!$getTotalPrice) {
+ $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
+ ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$idLang.')';
+ }
+ $sql .= ' WHERE 1';
if (!is_null($autoAddToCart)) {
$sql .= ' AND p.`auto_add_to_cart` = '. (int)$autoAddToCart;
@@ -165,7 +173,6 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
);
} else {
- $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product['room_type_id_product']);
$qty = $product['quantity'] ? (int)$product['quantity'] : 1;
if (isset($selectedServiceProducts[$product['htl_cart_booking_id']])) {
if ($product['id_product']) {
@@ -175,6 +182,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
} else {
$selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array(
'id_product' => $product['id_product'],
+ 'name' => $product['name'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'price_addition_type' => $product['price_addition_type'],
'quantity' => $product['quantity'],
@@ -220,6 +228,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$selectedServiceProducts[$product['htl_cart_booking_id']]['children'] = $product['children'];
if ($idProduct) {
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_product'] = $product['id_product'];
+ $selectedServiceProducts[$product['htl_cart_booking_id']]['name'] = $product['name'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['quantity'] = $product['quantity'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['auto_add_to_cart'] = $product['auto_add_to_cart'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['price_addition_type'] = $product['price_addition_type'];
@@ -243,6 +252,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'] = ($product['id_product']) ? array(
$product['id_product'] => array(
'id_product' => $product['id_product'],
+ 'name' => $product['name'],
'quantity' => $product['quantity'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'price_addition_type' => $product['price_addition_type'],
@@ -341,4 +351,20 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
}
return false;
}
+
+ public static function validateServiceProductsInCart()
+ {
+ $context = Context::getContext();
+ if ($cartProducts = $context->cart->getProducts()) {
+ $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
+ foreach ($cartProducts as $product) {
+ if (!$product['active'] && !$product['booking_product']) {
+ $serviceProducts = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($context->cart->id, $product['id_product']);
+ foreach ($serviceProducts as $serviceProduct) {
+ $objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($serviceProduct['htl_cart_booking_id']);
+ }
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
index 57e616fce..8dafbd11f 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
@@ -576,6 +576,7 @@ class AdminAddHotelController extends ModuleAdminController
public function ajaxProcessUploadHotelImages()
{
+ $response = array('success' => false);
$idHotel = Tools::getValue('id_hotel');
if ($idHotel) {
$invalidImg = ImageManager::validateUpload(
@@ -584,27 +585,32 @@ class AdminAddHotelController extends ModuleAdminController
);
if (!$invalidImg) {
// Add Hotel images
- $kwargs = [
- 'id_hotel' => $idHotel,
- 'hotel_image' => $_FILES['hotel_image'],
- ];
$objHotelImage = new HotelImage();
$imageDetail = $objHotelImage->uploadHotelImages($_FILES['hotel_image'], $idHotel);
if ($imageDetail) {
- die(json_encode($imageDetail));
+ $response['success'] = true;
+ $imageDetail['image_link'] = $this->context->link->getMediaLink($objHotelImage->getImageLink($imageDetail['id'],ImageType::getFormatedName('large')));
+ $imageDetail['image_link_small'] = $this->context->link->getMediaLink($objHotelImage->getImageLink($imageDetail['id'], ImageType::getFormatedName('small')));
+ $response['data']['image_info'] = $imageDetail;
+ // get image row
+ $this->context->smarty->assign(array(
+ 'image' => $imageDetail,
+ 'hotel_info' => array('id' => $idHotel)
+ ));
+ $response['data']['image_row'] = $this->context->smarty->fetch(
+ _PS_MODULE_DIR_.$this->module->name.
+ '/views/templates/admin/add_hotel/_partials/htl-images-list-row.tpl'
+ );
} else {
- die(json_encode(array('hasError' => true)));
+ $response['errors'][] = $this->l('Unable to uploade image. Please try again');
}
} else {
- die(
- json_encode(
- array('hasError' => true, 'message' => $_FILES['hotel_image']['name'].': '.$invalidImg)
- )
- );
+ $response['errors'][] = $_FILES['hotel_image']['name'].': '.$invalidImg;
}
} else {
- die(json_encode(array('hasError' => true)));
+ $response['errors'][] = $this->l('Hotel info not found. Please try reloading the page');
}
+ $this->ajaxDie(json_encode($response));
}
public function ajaxProcessChangeCoverImage()
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAssignHotelFeatures.php b/modules/hotelreservationsystem/controllers/admin/AdminAssignHotelFeatures.php
index 11a6e5c01..171dd1a08 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminAssignHotelFeatures.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminAssignHotelFeatures.php
@@ -226,4 +226,4 @@ class AdminAssignHotelFeaturesController extends ModuleAdminController
$this->addJs(_MODULE_DIR_.'hotelreservationsystem/views/js/HotelReservationAdmin.js');
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css');
}
-}
+}
\ No newline at end of file
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
index 340c92cca..62f0baaea 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
@@ -40,27 +40,15 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
}
if (!isset($this->context->cookie->id_cart)) {
- // create a new cart
- $objCart = new Cart();
- $objCart->recyclable = 0;
- $objCart->gift = 0;
- $objCart->id_shop = (int) $this->context->shop->id;
- $objCart->id_lang = (($id_lang = (int) Tools::getValue('id_lang')) ? $id_lang : (int) Configuration::get('PS_LANG_DEFAULT'));
- $objCart->id_currency = (($id_currency = (int) Tools::getValue('id_currency')) ? $id_currency : (int) Configuration::get('PS_CURRENCY_DEFAULT'));
- $objCart->id_address_delivery = 0;
- $objCart->id_address_invoice = 0;
- $objCart->id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
- $objCart->id_guest = (int) $this->context->cookie->id_guest;
- $objCart->setNoMultishipping();
-
- $this->context->cart = $objCart;
- $this->context->cart->save();
-
+ $objCart = $this->createNewCart();
$this->context->cookie->id_cart = (int) $objCart->id;
} else {
// use previous cart
- $this->context->cart = new Cart($this->context->cookie->id_cart);
+ if (!validate::isLoadedObject($objCart = new Cart($this->context->cookie->id_cart))) {
+ $objCart = $this->createNewCart();
+ }
}
+ $this->context->cart = $objCart;
$objCustomer = new Customer();
$objCustomer->id_gender = 0;
@@ -77,6 +65,26 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$this->context->customer = $objCustomer;
}
+ protected function createNewCart()
+ {
+ // create a new cart
+ $objCart = new Cart();
+ $objCart->recyclable = 0;
+ $objCart->gift = 0;
+ $objCart->id_shop = (int) $this->context->shop->id;
+ $objCart->id_lang = (($id_lang = (int) Tools::getValue('id_lang')) ? $id_lang : (int) Configuration::get('PS_LANG_DEFAULT'));
+ $objCart->id_currency = (($id_currency = (int) Tools::getValue('id_currency')) ? $id_currency : (int) Configuration::get('PS_CURRENCY_DEFAULT'));
+ $objCart->id_address_delivery = 0;
+ $objCart->id_address_invoice = 0;
+ $objCart->id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
+ $objCart->id_guest = (int) $this->context->cookie->id_guest;
+ $objCart->setNoMultishipping();
+
+ $objCart->save();
+ return $objCart;
+ }
+
+
public function postProcess()
{
if (Tools::getValue('date_from')) {
@@ -260,6 +268,10 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
'booking_product' => $this->booking_product,
'is_occupancy_wise_search' => $isOccupancyWiseSearch,
));
+ MediaCore::addJsDef(array(
+ 'initialDate' => $this->date_from
+ ));
+
}
public function renderView()
@@ -300,7 +312,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$allotmentTypes = HotelBookingDetail::getAllAllotmentTypes();
$occupancyRequiredForBooking = false;
- if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
@@ -778,7 +790,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
parent::setMedia();
$currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$occupancyRequiredForBooking = false;
- if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
$occupancyRequiredForBooking = true;
}
$jsVars = array(
diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js
index 5650f469d..6778d94ad 100644
--- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js
+++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js
@@ -23,6 +23,7 @@ $(document).ready(function() {
if ($('#fullcalendar').length) {
var calendar = new FullCalendar.Calendar($('#fullcalendar').get(0), {
initialView: 'dayGridMonth',
+ initialDate: initialDate,
events: {
url: rooms_booking_url,
method: 'POST',
@@ -312,7 +313,7 @@ $(document).ready(function() {
occupancy = false;
}
} else {
- return true;
+ return 1;
}
return occupancy;
diff --git a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js
index 8652f0ea5..ca4100256 100644
--- a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js
+++ b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js
@@ -49,4 +49,34 @@ $(document).ready(function() {
}
$('#generateCreditSlip').change();
});
+
+ $(document).on('keyup', '#order_return_form .table input[name^="refund_amounts"]', function() {
+ let refundAmountInputs = $('#order_return_form .table input[name^="refund_amounts"]');
+
+ let disableRefundOptions = false;
+ $(refundAmountInputs).each(function(index, element) {
+ let val = parseFloat($(element).val().trim());
+ if (isNaN(val)) { // if at least one amount input is empty
+ disableRefundOptions = true;
+ return;
+ }
+ });
+
+ if (!disableRefundOptions) {
+ let hasAllZero = true;
+ $(refundAmountInputs).each(function(index, element) {
+ let val = parseFloat($(element).val().trim());
+ if (val != 0) {
+ hasAllZero = false;
+ return;
+ }
+ });
+
+ if (hasAllZero) { // if all amount inputs are 0
+ disableRefundOptions = true;
+ }
+ }
+
+ $('#generateCreditSlip, #refundTransactionAmount, #generateDiscount').attr('disabled', disableRefundOptions);
+ });
});
\ No newline at end of file
diff --git a/modules/hotelreservationsystem/views/js/hotelImage.js b/modules/hotelreservationsystem/views/js/hotelImage.js
index 81e2ba5f7..f893b9748 100644
--- a/modules/hotelreservationsystem/views/js/hotelImage.js
+++ b/modules/hotelreservationsystem/views/js/hotelImage.js
@@ -27,104 +27,75 @@ $(document).ready(function () {
});
$("#hotel_images").on("change", function(event) {
- files = event.target.files;
- for (var i = 0; i < files.length; i++) {
- var formData = new FormData();
- var file = files[i];
-
- if (typeof file != 'undefined') {
- if (file.size > maxSizeAllowed) {
- showErrorMessage(filesizeError + '[' + file.name + ']');
- } else {
- formData.append('hotel_image', file);
- uploadHotelImages(formData);
- }
- }
- }
- $('#hotel_images').val(null);
+ const files = Array.from(event.target.files);
+ uploadSelectedImages(files);
});
- function uploadHotelImages(formData) {
- var idHotel = $("#id-hotel").val();
- formData.append('id_hotel', idHotel);
- formData.append('ajax', true);
- formData.append('action', 'uploadHotelImages');
+ function uploadSelectedImages(files)
+ {
+ if (files.length == 0) return; // all done
+ let file = files[0];
+ files.splice(0, 1);
+ createImageUploadRequest(file).then((formData) => {
+ uploadHotelImages(formData).then(() => {
+ uploadSelectedImages(files)
+ });
+ })
+ }
- $.ajax({
- type:'POST',
- url: adminHotelCtrlUrl,
- data: formData,
- cache:false,
- contentType: false,
- processData: false,
- success:function(image){
- image = JSON.parse(image);
- if (!image.hasError) {
- $('.list-empty-tr').remove();
- var html = '';
- html += '
';
- html += ''+image.id_image+' ';
- html += '';
- html += '';
- html += ' ';
- html += ' ';
- html += ' ';
- html += '';
- html += '';
- if(image.cover) {
- html += ' ';
- } else {
- html += ' ';
- }
- html += ' ';
- html += ' ';
- html += '';
- html += ' ';
- html += ' ';
- html += ' ';
- $("#hotel-image-table tbody").append(html);
-
- showSuccessMessage(imgUploadSuccessMsg);
+ function createImageUploadRequest(file)
+ {
+ return new Promise((resolve, reject) => {
+ if (typeof file != 'undefined') {
+ if (file.size > maxSizeAllowed) {
+ reject(filesizeError + '[' + file.name + ']');
} else {
- if (typeof image.message != 'undefined') {
- showErrorMessage(image.message);
- } else {
- showErrorMessage(imgUploadErrorMsg);
- }
+ var formData = new FormData();
+ var idHotel = $("#id-hotel").val();
+ formData.append('hotel_image', file);
+ formData.append('id_hotel', idHotel);
+ formData.append('ajax', true);
+ formData.append('action', 'uploadHotelImages');
+ resolve(formData);
}
- },
- error: function(data) {
- showErrorMessage(imgUploadErrorMsg);
}
});
}
+ function uploadHotelImages(formData) {
+ return new Promise((resolve, reject) => {
+ $.ajax({
+ type:'POST',
+ dataType:'JSON',
+ url: adminHotelCtrlUrl,
+ data: formData,
+ cache:false,
+ contentType: false,
+ processData: false,
+ success:function(response){
+ if (response.success) {
+ $('.list-empty-tr').remove();
+ $("#hotel-image-table tbody").append(response.data.image_row);
+ showSuccessMessage(imgUploadSuccessMsg);
+ resolve(imgUploadSuccessMsg);
+ } else {
+ if (typeof response.errors != 'undefined') {
+ showErrorMessage(response.errors);
+ reject(response.errors);
+ } else {
+ showErrorMessage(imgUploadErrorMsg);
+ reject(imgUploadErrorMsg);
+ }
+ }
+ },
+ error: function(data) {
+ showErrorMessage(imgUploadErrorMsg);
+ reject(imgUploadErrorMsg);
+ }
+ });
+ });
+ }
+
$('body').on('click', '.changer-cover-image', function(e){
e.preventDefault();
var idHotel = $(this).attr('data-id-hotel');
diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/_partials/htl-images-list-row.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/_partials/htl-images-list-row.tpl
new file mode 100644
index 000000000..b8b238731
--- /dev/null
+++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/_partials/htl-images-list-row.tpl
@@ -0,0 +1,39 @@
+{**
+* 2010-2022 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through LICENSE.txt file inside our module
+*
+* 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 CustomizationPolicy.txt file inside our module for more information.
+*
+* @author Webkul IN
+* @copyright 2010-2022 Webkul IN
+* @license LICENSE.txt
+*}
+
+
+ {$image.id|escape:'html':'UTF-8'}
+
+
+
+
+
+
+
+ {if $image.cover == 1}
+
+ {else}
+
+ {/if}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/_partials/htl-images-list.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/_partials/htl-images-list.tpl
new file mode 100644
index 000000000..2f132ba9f
--- /dev/null
+++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/_partials/htl-images-list.tpl
@@ -0,0 +1,47 @@
+{**
+* 2010-2022 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through LICENSE.txt file inside our module
+*
+* 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 CustomizationPolicy.txt file inside our module for more information.
+*
+* @author Webkul IN
+* @copyright 2010-2022 Webkul IN
+* @license LICENSE.txt
+*}
+
+
+
+
+
+ {l s='Image Id' mod='hotelreservationsystem'}
+ {l s='Image' mod='hotelreservationsystem'}
+ {l s='Cover' mod='hotelreservationsystem'}
+ {l s='Action' mod='hotelreservationsystem'}
+
+
+
+ {if isset($hotelImages) && $hotelImages}
+ {foreach from=$hotelImages item=image name=hotelImage}
+ {include file="./htl-images-list-row.tpl"}
+ {/foreach}
+ {else}
+
+
+
+
+ {l s='No Image Found' mod='hotelreservationsystem'}
+
+
+
+ {/if}
+
+
+
\ No newline at end of file
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 37e41b5f2..57e6d3c6e 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
@@ -304,53 +304,7 @@
{l s='Hotel Images' mod='hotelreservationsystem'}
-
-
-
-
- {l s='Image Id' mod='hotelreservationsystem'}
- {l s='Image' mod='hotelreservationsystem'}
- {l s='Cover' mod='hotelreservationsystem'}
- {l s='Action' mod='hotelreservationsystem'}
-
-
-
- {if isset($hotelImages) && $hotelImages}
- {foreach from=$hotelImages item=image name=hotelImage}
-
- {$image.id|escape:'html':'UTF-8'}
-
-
-
-
-
-
-
- {if $image.cover == 1}
-
- {else}
-
- {/if}
-
-
-
-
-
-
- {/foreach}
- {else}
-
-
-
-
- {l s='No Image Found' mod='hotelreservationsystem'}
-
-
-
- {/if}
-
-
-
+ {include file="../../_partials/htl-images-list.tpl"}
{else}
diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl
index e89b31f63..b099aa1ba 100644
--- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl
+++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl
@@ -119,7 +119,7 @@
{l s='Hotel' mod='hotelreservationsystem'}
{l s='Duration' mod='hotelreservationsystem'}
{l s='Total rooms paid (tax incl.)'}
-
{l s='Additional facilities price (tax incl.)'}
+
{l s='Additional services price (tax incl.)'}
{if !$isRefundCompleted}
{l s='Rooms cancelation charges' mod='hotelreservationsystem'}
{/if}
@@ -137,7 +137,7 @@
{$booking['hotel_name']|escape:'htmlall':'UTF-8'}
{$booking['date_from']|date_format:"%d-%m-%Y"} {l s='To' mod='hotelreservationsystem'} {$booking['date_to']|date_format:"%d-%m-%Y"}
{displayPrice price=$booking['total_paid_amount'] currency=$orderCurrency['id']}
-
{displayPrice price=$booking['extra_demands_price_tax_incl'] currency=$orderCurrency['id']}
+
{displayPrice price=($booking['extra_demands_price_tax_incl'] + $booking['additional_services_tax_incl']) currency=$orderCurrency['id']}
{if !$isRefundCompleted}
{displayPrice price=$booking['cancelation_charge'] currency=$orderCurrency['id']}
{/if}
@@ -148,7 +148,7 @@
{displayPrice price=$booking['refunded_amount'] currency=$orderCurrency['id']}
{else}
{$orderCurrency['sign']|escape:'html':'UTF-8'}
-
+
{l s='tax incl.' mod='hotelreservationsystem'}
{/if}
diff --git a/modules/qlohotelreview/views/templates/admin/hotel_review_hotel_review/helpers/view/_partials/review.tpl b/modules/qlohotelreview/views/templates/admin/hotel_review_hotel_review/helpers/view/_partials/review.tpl
index 114f895d3..3376e6a22 100644
--- a/modules/qlohotelreview/views/templates/admin/hotel_review_hotel_review/helpers/view/_partials/review.tpl
+++ b/modules/qlohotelreview/views/templates/admin/hotel_review_hotel_review/helpers/view/_partials/review.tpl
@@ -21,9 +21,13 @@
{l s='Customer' mod='qlohotelreview'}
diff --git a/modules/statsdata/statsdata.php b/modules/statsdata/statsdata.php
index 3e36b4216..f0be053a8 100644
--- a/modules/statsdata/statsdata.php
+++ b/modules/statsdata/statsdata.php
@@ -126,7 +126,7 @@ class StatsData extends Module
FROM `'._DB_PREFIX_.'guest`
WHERE `id_customer` = '.(int)$params['cookie']->id_customer);
- if ((int)$result['id_guest']) {
+ if (isset($result['id_guest']) && ( int)$result['id_guest']) {
// The new guest is merged with the old one when it's connecting to an account
$guest->mergeWithCustomer($result['id_guest'], $params['cookie']->id_customer);
$params['cookie']->id_guest = $guest->id;
diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
index 67820f156..e0543f189 100644
--- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
+++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
@@ -218,56 +218,48 @@ class WkRoomSearchHelper
'location' => 4,
'hotel' => 5,
'date' => 5,
- 'occupancy' => 5,
- 'search' => 3
+ 'occupancy' => 4,
+ 'search' => 4
);
if (!$locationEnabled) {
unset($search_column_widths['location']);
- $search_column_widths['date'] += 1;
+ $search_column_widths['date'] += 2;
$search_column_widths['search'] += 1;
if ($occupancyEnabled) {
- $search_column_widths['search'] += 1;
$search_column_widths['occupancy'] += 1;
} elseif ($smartyVars['show_hotel_name'] || count($hotelsInfo) > 1) {
$search_column_widths['hotel'] += 1;
} else {
- $search_column_widths['search'] += 1;
$search_column_widths['date'] += 1;
}
}
if (!$smartyVars['show_hotel_name'] && count($hotelsInfo) <= 1) {
unset($search_column_widths['hotel']);
- $search_column_widths['date'] += 1;
+ $search_column_widths['date'] += 2;
$search_column_widths['search'] += 1;
if ($occupancyEnabled) {
- $search_column_widths['date'] += 1;
$search_column_widths['occupancy'] += 2;
} else {
- $search_column_widths['date'] += 1;
$search_column_widths['date'] += 2;
}
}
if (!$occupancyEnabled) {
unset($search_column_widths['occupancy']);
+ $search_column_widths['date'] += 1;
if ($smartyVars['show_hotel_name'] || count($hotelsInfo) > 1) {
+ $search_column_widths['hotel'] += 1;
+ $search_column_widths['date'] += 1;
if ($locationEnabled) {
- $search_column_widths['hotel'] += 1;
$search_column_widths['location'] += 1;
- $search_column_widths['search'] += 2;
- $search_column_widths['date'] += 1;
} else {
- $search_column_widths['hotel'] += 2;
- $search_column_widths['search'] += 2;
- $search_column_widths['date'] += 2;
-
+ $search_column_widths['date'] += 1;
}
} else {
- $search_column_widths['date'] += 1;
- $search_column_widths['date'] += 4;
+ $search_column_widths['date'] += 3;
}
}
$smartyVars['column_widths'] = $search_column_widths;
diff --git a/modules/wkroomsearchblock/views/css/wk-category-search.css b/modules/wkroomsearchblock/views/css/wk-category-search.css
index 4e619cde8..fd3ce4f30 100644
--- a/modules/wkroomsearchblock/views/css/wk-category-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-category-search.css
@@ -44,6 +44,10 @@
height: unset;
min-height: 45px;
}
+ #search_hotel_block_form #search_room_submit {
+ height: unset;
+ min-height: 45px;
+ }
/* #search_hotel_block_form #search_room_submit {
height: 45px;
} */
diff --git a/modules/wkroomsearchblock/views/css/wk-landing-page-search.css b/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
index f1f5fcd26..1eb3038d2 100644
--- a/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
@@ -24,6 +24,7 @@
left: 0;
right: 0;
z-index: 10;}
+
.header-rmsearch-hide-xs {
background-image: url("../img/black-opacity-5.png");}
.header-rmsearch-show-xs {
@@ -50,7 +51,16 @@
#make_booking_btn_div {
margin-top: 20px;
text-align: center;}
-
+@media (max-width: 767px) {
+ .header-rmsearch-wrapper #search_hotel_block_form.grid {
+ grid-template-columns: 1fr;
+ column-gap: 0px;
+ }
+ .header-rmsearch-wrapper {
+ height: calc(100vw - 60px);
+ width: calc(100vw - 60px);
+ }
+}
.fancy_search_header_xs {
margin-top: 25px;
padding-left: 15px;
@@ -62,6 +72,10 @@
float: left;
margin-top: 5px;
width: 125px;}
+ #search_hotel_block_form #search_room_submit {
+ height: unset;
+ min-height: 45px;
+ }
/* .fancybox-inner #search_hotel_block_form {
grid-template-columns: 1fr;
} */
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-roomtype-search.css b/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
index d2976d0f0..414039e20 100644
--- a/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
@@ -64,6 +64,19 @@
background-color: #FAFAFA;}
.faded-txt {
color: #777777;}
+ #search_hotel_block_form #search_room_submit {
+ height: unset;
+ min-height: 45px;
+ }
+@media (max-width: 767px) {
+ .header-rmsearch-wrapper #search_hotel_block_form.grid {
+ grid-template-columns: 1fr;
+ column-gap: 0px;
+ }
+ .header-rmsearch-details-wrapper .modify_roomtype_search_btn {
+ padding: 6px 12px;
+ }
+}
@media (max-width: 991px) {
.header-rmsearch-wrapper .close_room_serach_wrapper {
top: -8px;
diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js
index b60e3a77b..6434ac658 100644
--- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js
+++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js
@@ -42,7 +42,9 @@ $(document).ready(function() {
padding: 0,
autoScale: false,
maxWidth: '100%',
- 'hideOnContentClick': false,
+ helpers: {
+ overlay: { closeClick: false } //Disable click outside event
+ },
'afterClose': function() {
$('.header-rmsearch-container').show();
$('#xs_room_search_form').show();
diff --git a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
index 95f9783e0..1c3d29e56 100644
--- a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
@@ -26,7 +26,9 @@
-
diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
index 6f5dae6c9..b2ee7a61f 100644
--- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
@@ -195,7 +195,7 @@
{/if}
-
+
{l s='Search Rooms' mod='wkroomsearchblock'}
diff --git a/modules/wkroomsearchblock/wkroomsearchblock.php b/modules/wkroomsearchblock/wkroomsearchblock.php
index 3934b099b..16da3cb60 100644
--- a/modules/wkroomsearchblock/wkroomsearchblock.php
+++ b/modules/wkroomsearchblock/wkroomsearchblock.php
@@ -168,7 +168,7 @@ class WkRoomSearchBlock extends Module
$maxOrderDate = Tools::getValue('max_order_date');
$maxOrderDate = date('Y-m-d', strtotime($maxOrderDate));
- if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
+ if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
if ($occupancy = Tools::getValue('occupancy')) {
$urlData['occupancy'] = $occupancy;
}
diff --git a/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl b/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl
index 788ef2cb0..077c3f9fb 100644
--- a/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl
+++ b/themes/hotel-reservation-theme/_partials/cart_booking_demands.tpl
@@ -118,7 +118,7 @@
{$product['name']|escape:'html':'UTF-8'}
{if $product.allow_multiple_quantity}
-
+
diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl
index 22d408949..47d6fe9df 100644
--- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl
+++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl
@@ -49,7 +49,7 @@
{/if}
-
{l s='Max Capacity:'} {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {l s='child'}
+
{$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}
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
@@ -69,8 +69,10 @@
{/if}
-
-
{l s='Max Capacity:'} {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {l s='child'}
+
+
+
+
{$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}
diff --git a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl
index f700c7720..1f2484ae1 100644
--- a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl
+++ b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl
@@ -20,9 +20,15 @@
{if isset($product) && $product}
-
+
+ {foreach $product.images as $image}
+ {if $image['cover'] == 0}
+
+
+ {/if}
+ {/foreach}
@@ -50,7 +56,7 @@
{/if}
{if $product.allow_multiple_quantity && $product.available_for_order}
-
+
{if isset($product.quantity_added) && $product.quantity_added}{$product.quantity_added|escape:'html':'UTF-8'}{else}1{/if}
diff --git a/themes/hotel-reservation-theme/css/category.css b/themes/hotel-reservation-theme/css/category.css
index 370a352e6..d9a7fba5e 100644
--- a/themes/hotel-reservation-theme/css/category.css
+++ b/themes/hotel-reservation-theme/css/category.css
@@ -108,11 +108,8 @@
p.capa_txt {
margin-bottom: 15px;
}
-
-.capa_data
-{
- color: #555555;
- font-weight: 600;
+.visible-md .capa_txt {
+ padding-left: 15px;
}
.rm_review_cont
@@ -254,11 +251,15 @@ p.capa_txt {
.booking_guest_occupancy_conatiner {
display: flex;
}
+.booking_guest_occupancy_conatiner .booking_occupancy_wrapper {
+ left: unset;
+}
@media (min-width: 992px) {
.room_features_cont > div {
display: flex;
flex-wrap: wrap;
- align-items: flex-end;
+ align-items: center;
+ justify-content: space-between;
gap: 10px 0;
}
.booking_room_fields {
diff --git a/themes/hotel-reservation-theme/css/daterangepicker.css b/themes/hotel-reservation-theme/css/daterangepicker.css
index 10de7405f..5d07270cd 100644
--- a/themes/hotel-reservation-theme/css/daterangepicker.css
+++ b/themes/hotel-reservation-theme/css/daterangepicker.css
@@ -75,10 +75,10 @@
background: #dadada;
}
.date-picker-wrapper .month-wrapper table .day.checked {
- background-color: #f2f2f2;
+ background-color: #E6E6E6;
}
.date-picker-wrapper .month-wrapper table .day.toMonth.hovering {
- background-color: #f2f2f2;
+ background-color: #E6E6E6;
}
.date-picker-wrapper .first-date-selected, .date-picker-wrapper .last-date-selected {
background-color: #1292ff !important;
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 ef9b485eb..75676a4d5 100644
--- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js
+++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js
@@ -1303,7 +1303,6 @@ function getBookingOccupancyDetails(bookingform)
if (child_ages.length != $(element).find('.num_children').val()) {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
- return false;
}
}
occupancy.push({
@@ -1311,10 +1310,12 @@ function getBookingOccupancyDetails(bookingform)
'children': $(element).find('.num_children').val(),
'child_ages': child_ages
});
+ if ($(bookingform).find('.booking_occupancy_wrapper').parent().hasClass('open')) {
+ $('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
+ }
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
- return false;
}
});
} else {
diff --git a/themes/hotel-reservation-theme/js/occupancy.js b/themes/hotel-reservation-theme/js/occupancy.js
index f3679b234..af1b3fca6 100644
--- a/themes/hotel-reservation-theme/js/occupancy.js
+++ b/themes/hotel-reservation-theme/js/occupancy.js
@@ -123,8 +123,12 @@ $(document).ready(function(){
});
$(document).on('click', '.booking_guest_occupancy', function(e) {
- $('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
- $(this).parent().toggleClass('open');
+ if ($(this).parent().hasClass('open')) {
+ $('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
+ } else {
+ $('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
+ $(this).parent().toggleClass('open');
+ }
});
$(document).on('click', function(e) {
@@ -132,7 +136,10 @@ $(document).ready(function(){
var occupancy_wrapper = $('.booking_occupancy_wrapper:visible');
$(occupancy_wrapper).find(".occupancy_info_block").addClass('selected');
setRoomTypeGuestOccupancy(occupancy_wrapper);
- if (!($(e.target).closest(".booking_occupancy_wrapper").length || $(e.target).closest(".booking_guest_occupancy").length || $(e.target).closest(".ajax_add_to_cart_button").length || $(e.target).closest(".exclusive.book_now_submit").length || $(e.target).closest(".remove-room-link").length)) {
+ if (!($(e.target).closest(".booking_occupancy_wrapper").length
+ || $(e.target).closest(".booking_guest_occupancy").length
+ || $(e.target).closest(".remove-room-link").length
+ )) {
let hasErrors = 0;
let adults = $(occupancy_wrapper).find(".num_adults").map(function(){return $(this).val();}).get();
@@ -169,9 +176,12 @@ $(document).ready(function(){
});
}
if (hasErrors == 0) {
- $(occupancy_wrapper).parent().removeClass('open');
- $(occupancy_wrapper).siblings(".booking_guest_occupancy").removeClass('error_border');
-
+ if (!($(e.target).closest(".ajax_add_to_cart_button").length
+ || $(e.target).closest(".exclusive.book_now_submit").length
+ )) {
+ $(occupancy_wrapper).parent().removeClass('open');
+ $(occupancy_wrapper).siblings(".booking_guest_occupancy").removeClass('error_border');
+ }
$(document).trigger( "QloApps:updateRoomOccupancy", [occupancy_wrapper]);
} else {
$(occupancy_wrapper).siblings(".booking_guest_occupancy").addClass('error_border');
diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js
index 7456edabe..23d5f7e26 100644
--- a/themes/hotel-reservation-theme/js/order-opc.js
+++ b/themes/hotel-reservation-theme/js/order-opc.js
@@ -468,8 +468,11 @@ $(document).ready(function()
$(document).on('click', '#rooms_extra_services .qty_up', function(e) {
e.preventDefault();
qtyfield = $(this).closest('.qty_container').find('input.qty');
- var currentVal = parseInt(qtyfield.val());
- qtyfield.val(currentVal + 1).trigger('focusout');
+ var newQuantity = parseInt(qtyfield.val()) + 1;
+ if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) {
+ newQuantity = qtyfield.data('max_quantity');
+ }
+ qtyfield.val(newQuantity).trigger('focusout');
});
$(document).on('click', '#rooms_extra_services .qty_down', function(e) {
@@ -487,6 +490,9 @@ $(document).ready(function()
var qty_wntd = $(this).val();
if (qty_wntd == '' || !$.isNumeric(qty_wntd)) {
$(this).val(1);
+ }
+ if ($(this).data('max_quantity') && $(this).data('max_quantity') < qty_wntd) {
+ $(this).val(qtyfield.data('max_quantity'));
}
if ($(this).closest('.room_demand_block').find('.change_room_type_service_product').is(':checked')) {
updateServiceProducts($(this).closest('.room_demand_block').find('.change_room_type_service_product'));
diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js
index 3359014cf..d2b8bb6fc 100644
--- a/themes/hotel-reservation-theme/js/product.js
+++ b/themes/hotel-reservation-theme/js/product.js
@@ -1108,9 +1108,12 @@ $(document).ready(function() {
$(document).on('click', '.service_product_qty_up', function(e) {
e.preventDefault();
qtyfield = $(this).closest('.qty_container').find('input.service_product_qty');
- var currentVal = parseInt(qtyfield.val());
- $(this).closest('.qty_container').find('.qty_count span').text(currentVal + 1);
- qtyfield.val(currentVal + 1);
+ var newQuantity = parseInt(qtyfield.val()) + 1;
+ if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) {
+ newQuantity = qtyfield.data('max_quantity');
+ }
+ $(this).closest('.qty_container').find('.qty_count span').text(newQuantity);
+ qtyfield.val(newQuantity);
});
// The button to decrement the product value
@@ -1203,6 +1206,13 @@ $(document).ready(function() {
if (typeof(qty) == 'undefined') {
qty = 1;
}
+ var added_service_product = [];
+ $('#additional_products input.service_product').each(function () {
+ added_service_product.push({
+ 'id_product': $(this).data('id_product'),
+ 'quantity':$(this).val(),
+ });
+ });
$.ajax({
type: 'POST',
headers: {
@@ -1217,31 +1227,36 @@ $(document).ready(function() {
qty: qty,
id_product: $('#product_page_product_id').val(),
service_product: id_product,
+ added_service_product: added_service_product,
action: 'checkServiceProductWithRoomType',
ajax: true,
token: static_token
},
success: function(result) {
- if (result.status) {
- if ($('input#service_product_'+ id_product).length) {
- var prevQty = $('input#service_product_'+ id_product).val();
- if (parseInt(prevQty) > 0) {
- qty = parseInt(qty) + parseInt(prevQty);
+ if (result.success) {
+ if (result.add) {
+ if ($('input#service_product_'+ id_product).length) {
+ var prevQty = $('input#service_product_'+ id_product).val();
+ if (parseInt(prevQty) > 0) {
+ qty = parseInt(qty) + parseInt(prevQty);
+ }
+ $('input#service_product_'+ id_product).val(qty);
+ } else {
+ $('
').attr({
+ id: 'service_product_'+ id_product,
+ name: 'service_product['+ id_product +'][]',
+ class: 'service_product',
+ 'data-id_product': id_product,
+ value: qty
+ }).appendTo('#additional_products');
}
- $('input#service_product_'+ id_product).val(qty);
- } else {
- $('
').attr({
- id: 'service_product_'+ id_product,
- name: 'service_product['+ id_product +'][]',
- class: 'service_product',
- 'data-id_product': id_product,
- value: qty
- }).appendTo('#additional_products');
}
// reset input
$(that).closest('.service_product_action_block').find('input.service_product_qty').val(1);
$(that).closest('.service_product_action_block').find('.qty_count span').text(1);
- showSuccessMessage(cart_extra_service_add);
+ if (result.msg) {
+ showSuccessMessage(result.msg);
+ }
BookingForm.refresh();
} else {
if (result.error) {
diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl
index 8808b58f0..5e932891b 100644
--- a/themes/hotel-reservation-theme/order-detail.tpl
+++ b/themes/hotel-reservation-theme/order-detail.tpl
@@ -399,7 +399,7 @@
{$data_v['hotel_name']|escape:'html':'UTF-8'}
- {if $rm_v['adults'] <= 9}0{$rm_v['adults']}{else}{$rm_v['adults']}{/if} {if $rm_v['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if $rm_v['children']}, {if $rm_v['children'] <= 9}0{$rm_v['children']}{else} {$rm_v['children']}{/if} {if $rm_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} {if $rm_v['num_rm'] <= 9}0{/if}{$rm_v['num_rm']} {if $rm_v['num_rm'] > 1}{l s='Rooms'}{else}{l s='Room'}{/if}
+ {if $data_v['adults'] <= 9}0{$data_v['adults']}{else}{$data_v['adults']}{/if} {if $data_v['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if $data_v['children']}, {if $data_v['children'] <= 9}0{$data_v['children']}{else} {$data_v['children']}{/if} {if $data_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} {if $rm_v['num_rm'] <= 9}0{/if}{$rm_v['num_rm']} {if $rm_v['num_rm'] > 1}{l s='Rooms'}{else}{l s='Room'}{/if}
{$rm_v['data_form']|date_format:"%d-%m-%Y"}
diff --git a/themes/hotel-reservation-theme/order-follow.tpl b/themes/hotel-reservation-theme/order-follow.tpl
index 0f0bed50d..9d8b2e0f8 100644
--- a/themes/hotel-reservation-theme/order-follow.tpl
+++ b/themes/hotel-reservation-theme/order-follow.tpl
@@ -44,21 +44,21 @@
- {l s='Refund Id'}
{l s='Order'}
+ {l s='Total rooms'}
{l s='Refund status'}
{l s='Date requested'}
-
+ {l s='Actions'}
{foreach from=$ordersReturns item=return}
- {l s='#'}{$return.id_order_return|escape:'html':'UTF-8'}
+ #{$return.reference|escape:'html':'UTF-8'}
- #{$return.reference|escape:'html':'UTF-8'}
+ {$return.total_rooms|escape:'html':'UTF-8'}
{$return.state_name|escape:'html':'UTF-8'}
diff --git a/themes/hotel-reservation-theme/order-opc.tpl b/themes/hotel-reservation-theme/order-opc.tpl
index 3ca3c0046..f63d65626 100644
--- a/themes/hotel-reservation-theme/order-opc.tpl
+++ b/themes/hotel-reservation-theme/order-opc.tpl
@@ -274,35 +274,33 @@
{displayPrice price=$total_discounts_negative}
- {if $use_taxes && $show_taxes && $total_tax != 0 }
- {* {if $priceDisplay != 0} *}
-
-
- {l s='Total'}
- {if $display_tax_label}
- {if $use_taxes && $priceDisplay == 0}
- {l s='(tax incl)'}
- {else}
- {l s='(tax excl)'}
- {/if}
- {/if}
-
-
- {if $use_taxes && $priceDisplay == 0}
- {displayPrice price=$total_price - $convenience_fee_wt}
+ {* {if $priceDisplay != 0} *}
+
+
+ {l s='Total'}
+ {if $display_tax_label}
+ {if $use_taxes && $priceDisplay == 0}
+ {l s='(tax incl)'}
{else}
- {displayPrice price=$total_price_without_tax - $convenience_fee}
+ {l s='(tax excl)'}
{/if}
-
-
- {* {/if} *}
- {* {if $total_rooms_wt != 0}
-
- {l s='Tax on rooms'}
- {displayPrice price=($total_rooms_wt - $total_rooms)}
-
- {/if} *}
- {/if}
+ {/if}
+
+
+ {if $use_taxes && $priceDisplay == 0}
+ {displayPrice price=$total_price - $convenience_fee_wt}
+ {else}
+ {displayPrice price=$total_price_without_tax - $convenience_fee}
+ {/if}
+
+
+ {* {/if} *}
+ {* {if $total_rooms_wt != 0}
+
+ {l s='Tax on rooms'}
+ {displayPrice price=($total_rooms_wt - $total_rooms)}
+
+ {/if} *}
{if $convenience_fee_wt}
{l s='Convenience Fees'}
diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl
index ac13fb574..9f3591739 100644
--- a/themes/hotel-reservation-theme/product.tpl
+++ b/themes/hotel-reservation-theme/product.tpl
@@ -199,13 +199,13 @@
{$product->description}
- {if isset($product->capacity['adults']) && isset($product->capacity['children']) }
+ {if isset($room_type_info['adults']) && isset($room_type_info['children']) }
{l s='Max Capacity'}
-
{$product->capacity['adults']} {l s='Adults'}, {$product->capacity['children']} {l s='child'}
+
{$room_type_info['adults']} {l s='Adults'}, {$room_type_info['children']} {if $room_type_info['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if} ({l s='Max guests'}: {$room_type_info['max_guests']|escape:'htmlall':'UTF-8'})
{/if}