diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/view/message.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/view/message.tpl index 77b4f2d8e..d11710c85 100644 --- a/admin/themes/default/template/controllers/customer_threads/helpers/view/message.tpl +++ b/admin/themes/default/template/controllers/customer_threads/helpers/view/message.tpl @@ -55,7 +55,7 @@   - {dateFormat date=$message.date_add full=0} - {$message.date_add|substr:11:5} {if $message.private}{l s='Private'}{/if} {if isset($message.file_name)}   {l s="Attachment"}{/if} - {if isset($message.product_name)}   {l s="Room type:"} {$message.product_name|escape:'html':'UTF-8'} {/if} + {if isset($message.product_name)}   {if isset($message.booking_product) && $message.booking_product}{l s="Room type:"}{else}{l s="Product:"}{/if} {$message.product_name|escape:'html':'UTF-8'} {/if}

{$message.message|escape:'html':'UTF-8'|nl2br}

diff --git a/admin/themes/default/template/controllers/languages/helpers/form/form.tpl b/admin/themes/default/template/controllers/languages/helpers/form/form.tpl index c4598e6ce..8d1dc403e 100644 --- a/admin/themes/default/template/controllers/languages/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/languages/helpers/form/form.tpl @@ -37,7 +37,7 @@ {block name=script} var langPackOk = "\"\" {l s='A language pack is available for this ISO.'}"; - var langPackVersion = "{l s='The Prestashop version compatible with this language and your system is:'}"; + var langPackVersion = "{l s='The QloApps version compatible with this language and your system is:'}"; var langPackInfo = "{l s='After creating the language, you can import the content of the language pack, which you can download under "Localization -- Translations."'}"; var noLangPack = "\"\" {l s='No language pack is available on prestashop.com for this ISO code'}"; var download = "{l s='Download'}"; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl b/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl index 2c869bd3c..d87184159 100644 --- a/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl @@ -257,37 +257,6 @@ } return typeIsPack; } - $("#product_form").validate({ - ignore: '.updateCurrentText', - rules: { - inputPackItems: { - required: { - depends: checkIfProductTypeIsPack - }, - } - }, - messages: { - inputPackItems: { - required: "" - } - }, - // override jquery validate plugin defaults for bootstrap 3 - highlight: function(element) { - $(element).closest('.form-group').addClass('has-error'); - }, - unhighlight: function(element) { - $(element).closest('.form-group').removeClass('has-error'); - }, - errorElement: 'span', - errorClass: 'help-block', - errorPlacement: function(error, element) { - if(element.parent('.input-group').length) { - error.insertAfter(element.parent()); - } else { - error.insertAfter(element); - } - } - }); }); diff --git a/admin/themes/default/template/controllers/orders/_hotel_service_products_table.tpl b/admin/themes/default/template/controllers/orders/_hotel_service_products_table.tpl index baa2e33dd..2e5cba468 100644 --- a/admin/themes/default/template/controllers/orders/_hotel_service_products_table.tpl +++ b/admin/themes/default/template/controllers/orders/_hotel_service_products_table.tpl @@ -58,7 +58,7 @@ - {(int)$product['quantity']} + {if $product['allow_multiple_quantity']}{(int)$product['quantity']}{else}--{/if}

{displayPrice price=$product.total_price_tax_excl currency=$currency->id}

diff --git a/admin/themes/default/template/controllers/orders/_standalone_service_products_table.tpl b/admin/themes/default/template/controllers/orders/_standalone_service_products_table.tpl index 4dc181ef9..a5e60cf80 100644 --- a/admin/themes/default/template/controllers/orders/_standalone_service_products_table.tpl +++ b/admin/themes/default/template/controllers/orders/_standalone_service_products_table.tpl @@ -58,7 +58,7 @@ - {(int)$product['quantity']} + {if $product['allow_multiple_quantity']}{(int)$product['quantity']}{else}--{/if}

{displayPrice price=$product.total_price_tax_excl currency=$currency->id}

diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 67e7ed00b..ee9e51d0b 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -635,7 +635,10 @@ 'width': '90%', 'height': '90%', 'afterClose' : function () { - searchCustomers(); + let customer = $('#customer').val(); + if (customer != '' && customer.length > 3) { + searchCustomers(); + } } }); /*$("#new_address").fancybox({ @@ -885,9 +888,11 @@ }); } + let customerSearchAjax = ''; function searchCustomers() { - $.ajax({ + abortRunningAjax(customerSearchAjax); + customerSearchAjax = $.ajax({ type:"POST", url : "{$link->getAdminLink('AdminCustomers')}", async: true, @@ -927,6 +932,12 @@ }); } + function abortRunningAjax(ajaxVar) { + if (ajaxVar) { + ajaxVar.abort(); + } + } + function setupCustomer(idCustomer) { //$('#carts').show();// by webkul @@ -1740,6 +1751,7 @@ $('#room_type_services_desc').show(); $('#add_new_room_services_block').hide(); $('#back_to_service_btn').hide(); + $('#btn_new_room_service').show(); }); // Add new custom service: Show hide new custom service form @@ -1747,6 +1759,7 @@ $('#add_new_room_services_block').show(); $('#back_to_service_btn').show(); $('#room_type_services_desc').hide(); + $('#btn_new_room_service').hide(); }); // Add new custom service: change auto added option diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 816ffbc0d..6327e9f76 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -749,7 +749,12 @@ {l s='Request ID'} - {l s='Total Rooms'} + {if isset($refundReqBookings) && $refundReqBookings} + {l s='Total Rooms'} + {/if} + {if isset($refundReqProducts) && $refundReqProducts} + {l s='Total Products'} + {/if} {l s='Requested Date'} {l s='Status'} @@ -760,9 +765,12 @@ #{$return_info.id_order_return} - - {$return_info.total_rooms|escape:'html':'UTF-8'} - + {if isset($refundReqBookings) && $refundReqBookings} + {$return_info.total_rooms} + {/if} + {if isset($refundReqProducts) && $refundReqProducts} + {$return_info.total_products} + {/if} {$return_info.date_add} diff --git a/admin/themes/default/template/controllers/orders/modals/_cancel_room_bookings.tpl b/admin/themes/default/template/controllers/orders/modals/_cancel_room_bookings.tpl index 00413ed13..11ccf8188 100644 --- a/admin/themes/default/template/controllers/orders/modals/_cancel_room_bookings.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_cancel_room_bookings.tpl @@ -83,7 +83,7 @@ {$product.name|escape:'html':'UTF-8'}{if $product.option_name} : {$product.option_name|escape:'html':'UTF-8'}{/if} - {$product.quantity|escape:'html':'UTF-8'} + {if $product.allow_multiple_quantity}{$product.quantity|escape:'html':'UTF-8'}{else}--{/if} {convertPriceWithCurrency price=$product.total_price_tax_incl currency=$currency->id} {/foreach} diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index 7911fecbc..d241a40ad 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -78,13 +78,10 @@
{$currencySign} - {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $service.product_price_calculation_method} + {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $service.price_calculation_method} {l s='/ night'} {/if}
- {* {if $service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY} - {l s='/ night'} - {/if} *} {displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency} @@ -150,7 +147,7 @@
{$currencySign} - {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['product_price_calculation_method']} + {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} {l s='/ night'} {/if}
@@ -274,7 +271,7 @@ {displayPrice price=$service['unit_price_tax_excl'] currency=$orderCurrency} - {if $service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY} + {if $service['price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY} {l s='/ night'} {/if} diff --git a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl index 2645f8dd8..ef41311ec 100644 --- a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl +++ b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} -{l s='This room already has a booking for the selected date range.'} +{sprintf({l s='The room "%s" already has a booking for the selected date range.'}, $orderDetails->room_num)}
{l s='Order ID'}: #{$orderDetails->id_order|intval} diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 0419331c0..a5680a24f 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -1238,6 +1238,7 @@ }; $('#page-loader').show(); + $('[name="submitBulkCreateRooms"]').attr('disabled', 'disable'); $.ajax({ url: prod_link, type: 'POST', @@ -1253,6 +1254,7 @@ }, complete: function() { $('#page-loader').hide(); + $('[name="submitBulkCreateRooms"]').attr('disabled', false); } }); }, diff --git a/classes/Cart.php b/classes/Cart.php index dd7692a16..a1852f2e0 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1034,7 +1034,7 @@ class CartCore extends ObjectModel $shop = Context::getContext()->shop; } - if (Context::getContext()->customer->id) { + if (!empty(Context::getContext()->customer->id)) { if ($id_address_delivery == 0 && (int)$this->id_address_delivery) { // The $id_address_delivery is null, use the cart delivery address $id_address_delivery = $this->id_address_delivery; } elseif (!Customer::customerHasAddress(Context::getContext()->customer->id, $id_address_delivery)) { // The $id_address_delivery must be linked with customer @@ -2432,7 +2432,7 @@ class CartCore extends ObjectModel $array[$selectedProduct['id_room_type_hotel']]['total_price_tax_incl'] += $selectedProduct['total_price_tax_incl']; } else { $array[$selectedProduct['id_room_type_hotel']] = array( - 'quantity' => 0, + 'quantity' => $selectedProduct['quantity'], 'id_hotel' => $selectedProduct['id_room_type_hotel'], 'total_price_tax_excl' => $selectedProduct['total_price_tax_excl'], 'total_price_tax_incl' => $selectedProduct['total_price_tax_incl'], @@ -2452,35 +2452,37 @@ class CartCore extends ObjectModel } } - foreach($array as $selectedProduct) { - $product['cart_quantity'] = $selectedProduct['quantity']; - $product['total'] = $selectedProduct['total_price_tax_excl']; - $product['total_wt'] = $selectedProduct['total_price_tax_incl']; - $product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity']; - $product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity']; - $product['id_hotel'] = $selectedProduct['id_hotel']; - $product['id_room_type'] = $selectedProduct['id_room_type']; - $product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking']; - $productinfo = $product; - $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE; - $orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo; - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel']; - } - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; - } else { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']); - } - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; - } - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; - } - if (isset($package['id_carrier'])) { - if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) { - $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + if ($array) { + foreach($array as $selectedProduct) { + $product['cart_quantity'] = $selectedProduct['quantity']; + $product['total'] = $selectedProduct['total_price_tax_excl']; + $product['total_wt'] = $selectedProduct['total_price_tax_incl']; + $product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity']; + $product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity']; + $product['id_hotel'] = $selectedProduct['id_hotel']; + $product['id_room_type'] = $selectedProduct['id_room_type']; + $product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking']; + $productinfo = $product; + $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE; + $orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo; + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel']; + } + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; + } else { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']); + } + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; + } + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; + } + if (isset($package['id_carrier'])) { + if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) { + $orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + } } } } @@ -2528,38 +2530,41 @@ class CartCore extends ObjectModel ); } } - foreach($array as $hotelProduct) { - $serviceProduct = $product; - $serviceProduct['cart_quantity'] = $hotelProduct['quantity']; - $serviceProduct['id_hotel'] = $hotelProduct['id_hotel']; - $serviceProduct['total'] = $hotelProduct['total_price_tax_excl']; - $serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl']; - $serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity']; - $serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity']; - $serviceProduct['id_room_type'] = $hotelProduct['id_room_type']; - $serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking']; - // if (!empty($hotelProducts['products'])) { - // foreach($hotelProducts['products'] as $hotelProduct) { - $productinfo = $serviceProduct; - $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE; - $orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo; - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel']; - } - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; - } else { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']); - } - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; - } - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; - } - if (isset($package['id_carrier'])) { - if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) { - $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + + if ($array) { + foreach($array as $hotelProduct) { + $serviceProduct = $product; + $serviceProduct['cart_quantity'] = $hotelProduct['quantity']; + $serviceProduct['id_hotel'] = $hotelProduct['id_hotel']; + $serviceProduct['total'] = $hotelProduct['total_price_tax_excl']; + $serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl']; + $serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity']; + $serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity']; + $serviceProduct['id_room_type'] = $hotelProduct['id_room_type']; + $serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking']; + // if (!empty($hotelProducts['products'])) { + // foreach($hotelProducts['products'] as $hotelProduct) { + $productinfo = $serviceProduct; + $productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE; + $orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo; + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel']; + } + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list']; + } else { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']); + } + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list']; + } + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse']; + } + if (isset($package['id_carrier'])) { + if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) { + $orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier']; + } } } } diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php index b4903c747..7452b4924 100644 --- a/classes/Dispatcher.php +++ b/classes/Dispatcher.php @@ -652,7 +652,7 @@ class DispatcherCore if (!isset($this->routes[$id_shop][$id_lang][$route_id])) { $query = http_build_query($params, '', '&'); $index_link = $this->use_routes ? '' : 'index.php'; - return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor; + return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((!is_null($route_id) ? (trim($route_id) == '') : 1) ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor; } $route = $this->routes[$id_shop][$id_lang][$route_id]; // Check required fields diff --git a/classes/Image.php b/classes/Image.php index 19f2c9f98..b208e9e81 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -171,19 +171,22 @@ class ImageCore extends ObjectModel * @param int $id_product_attribute Product Attribute ID * @return array Images */ - public static function getImages($id_lang, $id_product, $id_product_attribute = null) + public static function getImages($id_lang, $id_product, $id_product_attribute = null, $bookingProduct = null) { $attribute_filter = ($id_product_attribute ? ' AND ai.`id_product_attribute` = '.(int)$id_product_attribute : ''); $sql = 'SELECT * FROM `'._DB_PREFIX_.'image` i - LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)'; + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = i.`id_product`)'; if ($id_product_attribute) { $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ai ON (i.`id_image` = ai.`id_image`)'; } $sql .= ' WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang.$attribute_filter.' + '.(!is_null($bookingProduct) ? ' AND p.`booking_product`='.(int) $bookingProduct : '').' ORDER BY i.`position` ASC'; + return Db::getInstance()->executeS($sql); } @@ -215,12 +218,14 @@ class ImageCore extends ObjectModel * * @return array Images */ - public static function getAllImages() + public static function getAllImages($bookingProduct = null) { return Db::getInstance()->executeS(' - SELECT `id_image`, `id_product` - FROM `'._DB_PREFIX_.'image` - ORDER BY `id_image` ASC'); + SELECT img.`id_image`, img.`id_product` FROM `'._DB_PREFIX_.'image` img + LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = img.`id_product` + WHERE 1 '.(!is_null($bookingProduct) ? ' AND p.`booking_product`='.(int) $bookingProduct : '').' + ORDER BY `id_image` ASC' + ); } /** diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 5e7031082..f1eba0008 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -621,7 +621,7 @@ abstract class PaymentModuleCore extends Module $product_list_txt = ''; $product_list_html = ''; if (count($product_var_tpl_list) > 0) { - $product_list_txt = $this->getEmailTemplateContent('order_conf_product_list.txt', Mail::TYPE_TEXT, $product_var_tpl_list); + $product_list_txt = $this->getEmailTemplateContent('order_conf_product_list_text.tpl', Mail::TYPE_TEXT, $product_var_tpl_list); $product_list_html = $this->getEmailTemplateContent('order_conf_product_list.tpl', Mail::TYPE_HTML, $product_var_tpl_list); } @@ -698,7 +698,7 @@ abstract class PaymentModuleCore extends Module $cart_rules_list_txt = ''; $cart_rules_list_html = ''; if (count($cart_rules_list) > 0) { - $cart_rules_list_txt = $this->getEmailTemplateContent('order_conf_cart_rules.txt', Mail::TYPE_TEXT, $cart_rules_list); + $cart_rules_list_txt = $this->getEmailTemplateContent('order_conf_cart_rules_text.tpl', Mail::TYPE_TEXT, $cart_rules_list); $cart_rules_list_html = $this->getEmailTemplateContent('order_conf_cart_rules.tpl', Mail::TYPE_HTML, $cart_rules_list); } @@ -1342,6 +1342,7 @@ abstract class PaymentModuleCore extends Module '{products_txt}' => $product_list_txt, '{discounts}' => $cart_rules_list_html, '{discounts_txt}' => $cart_rules_list_txt, + '{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false), '{total_products}' => Tools::displayPrice($total_products, $this->context->currency, false), '{total_discounts}' => Tools::displayPrice(-$order->total_discounts, $this->context->currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false), diff --git a/classes/order/OrderReturn.php b/classes/order/OrderReturn.php index 48f801300..f3f87e9a1 100644 --- a/classes/order/OrderReturn.php +++ b/classes/order/OrderReturn.php @@ -326,9 +326,10 @@ class OrderReturnCore extends ObjectModel */ public function getOrderRefundRequestedProducts($idOrder, $idOrderReturn = 0, $onlyIds = 0, $skipReqCompletedNonRefunded = 0) { - $sql = 'SELECT spod.*, ord.*, orr.`state` as id_return_state FROM `'._DB_PREFIX_.'order_return` orr'; + $sql = 'SELECT spod.*, ord.*, orr.`state` as id_return_state, p.`allow_multiple_quantity` FROM `'._DB_PREFIX_.'order_return` orr'; $sql .= ' INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (orr.`id_order_return` = ord.`id_order_return`)'; $sql .= ' INNER JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON (spod.`id_service_product_order_detail` = ord.`id_service_product_order_detail`)'; + $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = spod.`id_product`)'; $sql .= ' WHERE orr.`id_order` = '.(int)$idOrder; if ($idOrderReturn) { @@ -368,7 +369,7 @@ class OrderReturnCore extends ObjectModel } $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`, orr.`refunded_amount`, - hbd.`is_cancelled`, SUM(IF(ord.`id_htl_booking`, 1, 0)) AS total_rooms + hbd.`is_cancelled`, SUM(IF(ord.`id_htl_booking`, 1, 0)) AS total_rooms, SUM(IF(ord.`id_service_product_order_detail`, 1, 0)) AS total_products FROM `'._DB_PREFIX_.'order_return` orr LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = orr.`id_order_return`) diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 13f603a97..4c0d096d9 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -318,25 +318,31 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate if (Module::isInstalled('hotelreservationsystem')) { $obj_htl_bk_dtl = new HotelBookingDetail(); $objServiceProductOrderDetail = new ServiceProductOrderDetail(); - $objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $context->language->id); $invoiceAddressPatternRules['avoid'][] = 'lastname'; - if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) { - $objHotelAddress = new Address((int) $idHotelAddress); - $objHotelAddress->firstname = $objHotelBranchInfo->hotel_name; - $formattedHotelAddress = AddressFormat::generateAddress($objHotelAddress, $invoiceAddressPatternRules, '
', ' '); + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order_obj->id)) { + $objHotelBranchInfo = new HotelBranchInformation((int) $idHotel, $context->language->id); + $invoiceAddressPatternRules['avoid'][] = 'lastname'; + if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) { + $objHotelAddress = new Address((int) $idHotelAddress); + $objHotelAddress->firstname = $objHotelBranchInfo->hotel_name; + $formattedHotelAddress = AddressFormat::generateAddress($objHotelAddress, $invoiceAddressPatternRules, '
', ' '); + } } - $customer = new Customer($this->order->id_customer); + $idCustomer = 0; + if (ValidateCore::isLoadedObject($customer = new Customer($this->order->id_customer))) { + $idCustomer = $customer->id; + } if (!empty($order_details)) { $processed_product = array(); $totalDemandsPriceTE = 0; $totalDemandsPriceTI = 0; foreach ($order_details as $type_key => $type_value) { - $processProuctKey = $type_value['product_id'].'_'.$type_value['selling_preference_type'].'_'.$type_value['id_order_detail']; - if (isset($processed_product[$processProuctKey])) { + $processProductKey = $type_value['product_id'].'_'.$type_value['selling_preference_type'].'_'.$type_value['id_order_detail']; + if (isset($processed_product[$processProductKey])) { continue; } - $processed_product[$processProuctKey] = $type_value['product_id']; + $processed_product[$processProductKey] = $type_value['product_id']; if ($type_value['is_booking_product']) { if ($display_product_images) { @@ -352,14 +358,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $cart_htl_data[$type_key]['cover_img'] = $cover_img; } - if ($type_value) - if (isset($customer->id)) { - $cart_obj = new Cart($this->order->id_cart); - $order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $cart_obj->id_guest, $type_value['product_id'], $customer->id); - } else { - $order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id'], 0); - } - + $order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, 0, $type_value['product_id'], $idCustomer, $type_value['id_order_detail']); $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; $objBookingDemand = new HotelBookingDemands(); foreach ($order_bk_data as $data_k => $data_v) { @@ -580,10 +579,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate 0, $data_v['id'] )) { - $additionalServices['product_id'] = $type_value['product_id']; - $additionalServices['room_type_name'] = $type_value['product_name']; - $additionalServices['date_from'] = $data_v['date_from']; - $additionalServices['date_to'] = $data_v['date_to']; + $additionalServices[$data_v['id']]['product_id'] = $type_value['product_id']; $room_additinal_services[] = $additionalServices[$data_v['id']]; } diff --git a/classes/webservice/WebserviceSpecificManagementBookings.php b/classes/webservice/WebserviceSpecificManagementBookings.php index 2485adbeb..0f7e99a67 100644 --- a/classes/webservice/WebserviceSpecificManagementBookings.php +++ b/classes/webservice/WebserviceSpecificManagementBookings.php @@ -542,7 +542,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We return array( array( - 'adults' => isset($data['adult']) && $data['adult'] ? $data['adult'] : $roomTypeInfo['adults'], + 'adults' => isset($data['adults']) ? $data['adults'] : $roomTypeInfo['adults'], 'children' => isset($data['child']) ? $data['child'] : $roomTypeInfo['children'], 'child_ages' => $child_ages ) @@ -946,7 +946,9 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $extraVars, null, false, - $this->bookingCustomer->secure_key + $this->bookingCustomer->secure_key, + null, + false )) { $this->updateServicesAndDemandsInOrder($objPaymentModule->currentOrder); if (!empty($this->wsRequestedRooms)) { @@ -1081,7 +1083,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objTaxManager = TaxManagerFactory::getManager($objAddress, $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group']); $objTaxCalculator = $objTaxManager->getTaxCalculator(); $priceWithTax = $objTaxCalculator->addTaxes($objHotelBookingDetail->total_price_tax_excl); - } else if (isset($this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'])) { + } else if (!empty($this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'])) { $priceWithTax = $objHotelBookingDetail->total_price_tax_excl + $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax']; } @@ -1216,9 +1218,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objOrder->total_paid_tax_incl += $priceDiffTaxIncl; $objOrder->total_paid += $priceDiffTaxIncl; - } else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']) - && $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'] - ) { + } else if (!empty($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) { $oldPriceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl; $objServiceProductOrderDetail->total_price_tax_incl = $objServiceProductOrderDetail->total_price_tax_excl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']; @@ -1697,7 +1697,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room; if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) { $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group']; - } else if (isset($room['total_tax'])) { + } else if (!empty($room['total_tax'])) { $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'] = $room['total_tax']; } @@ -1946,13 +1946,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) { $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group']; - } else if (isset($room['total_tax'])) { + } else if (!empty($room['total_tax'])) { $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'] = $room['total_tax']; } $numDays = HotelHelper::getNumberOfDays($dateFrom, $dateTo); if (isset($room['unit_price_without_tax']) - && ((float) $room['unit_price_without_tax']) != ((float) $roomsByDate['order'][$roomsKey]['total_price_tax_incl']/$numDays) + && ((float) $room['unit_price_without_tax']) != ((float) $roomsByDate['order'][$roomsKey]['total_price_tax_excl']/$numDays) ) { $this->updateRoomPriceInOrder($room, $roomsByDate['order'][$roomsKey]); $this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room; @@ -2314,7 +2314,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $unitPriceTaxIncl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); $totalPriceTaxIncl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_); - } else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) { + } else if (!empty($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) { $totalPriceTaxIncl = $totalPriceTaxExcl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']; $totalPriceTaxIncl = Tools::ps_round(($totalPriceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); @@ -2876,7 +2876,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We if (isset($room['id_tax_rules_group']) && !Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) { $this->error_msg = Tools::displayError('Invalid id_tax_rules_group.'); return false; - } else if (isset($room['total_tax']) && !Validate::isPrice($room['total_tax'])) { + } else if (!empty($room['total_tax']) && !Validate::isPrice($room['total_tax'])) { $this->error_msg = Tools::displayError('Invalid total tax.'); return false; } @@ -3243,7 +3243,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $unitPriceTaxIncl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); $totalPriceTaxIncl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_); - } else if (isset($services[$product['id_product']]['total_tax'])) { + } else if (!empty($services[$product['id_product']]['total_tax'])) { $totalPriceTaxIncl = $totalPriceTaxExcl + $services[$product['id_product']]['total_tax']; $totalPriceTaxIncl = Tools::ps_round(($totalPriceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index 6f3139e3a..2a1cff79c 100644 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -51,7 +51,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage 'room_types' => array(), 'hotels' => array(), 'categories' => array(), - 'extra_service' => array(), + 'services' => array(), // 'manufacturers' => array(), // 'suppliers' => array(), // 'stores' => array(), @@ -288,7 +288,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage $this->imageType = $this->wsObject->urlSegment[1]; // if image type requested is room_types then process products images if ($this->imageType == 'room_types' - || $this->imageType == 'extra_services' + || $this->imageType == 'services' ) { $this->imageType = 'products'; } @@ -305,7 +305,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage case 'stores': case 'features': case 'hotels': - case 'extra_services': + case 'services': case 'room_types': switch ($this->wsObject->urlSegment[1]) { case 'categories': @@ -326,7 +326,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage case 'room_types': $directory = _PS_PROD_IMG_DIR_; break; - case 'extra_services': + case 'services': $directory = _PS_PROD_IMG_DIR_; break; case 'hotels': @@ -511,14 +511,20 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if ($this->imageType == 'products') { $ids = array(); - $images = Image::getAllImages(); + if ($this->wsObject->urlSegment[1] == 'services') { + $resourceType = 'services'; + $images = Image::getAllImages(0); + } else { + $resourceType = 'room_types'; + $images = Image::getAllImages(1); + } foreach ($images as $image) { $ids[] = $image['id_product']; } $ids = array_unique($ids, SORT_NUMERIC); asort($ids); foreach ($ids as $id) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.'room_types'.'/'.$id), false); + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.$resourceType.'/'.$id), false); } } else if ($this->imageType == 'hotels') { $ids = array(); @@ -567,10 +573,17 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if ($this->imageType == 'products') { // Get available image ids $available_image_ids = array(); + if ($this->wsObject->urlSegment[1] == 'services') { + $resourceType = 'services'; + $bookingProduct = 0; + } else { + $bookingProduct = 1; + $resourceType = 'room_types'; + } // New Behavior foreach (Language::getIDs() as $id_lang) { - foreach (Image::getImages($id_lang, $object_id) as $image) { + foreach (Image::getImages($id_lang, $object_id, null, $bookingProduct) as $image) { $available_image_ids[] = $image['id_image']; } } @@ -607,7 +620,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if ($available_image_ids) { $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id'=>$object_id)); foreach ($available_image_ids as $available_image_id) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id'=>$available_image_id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.'room_types'.'/'.$object_id.'/'.$available_image_id), false); + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id'=>$available_image_id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.$resourceType.'/'.$object_id.'/'.$available_image_id), false); } $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('image', array()); } else { diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 9847509b0..551e9c207 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -385,7 +385,7 @@ class AdminAddressesControllerCore extends AdminController { $this->fields_list = array_merge($this->fields_list, array( 'email' => array('title' => $this->l('Customer Email')), - 'phone' => array('title' => $this->l('Phone')), + 'phone' => array('title' => $this->l('Phone'), 'filter_key' => 'a!phone'), 'phone_mobile' => array('title' => $this->l('Mobile phone')), 'address1' => array('title' => $this->l('Address (2)')), 'dni' => array('title' => $this->l('Identification Number')), diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index d6a736572..fa9c3abfa 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -935,7 +935,8 @@ class AdminCartsControllerCore extends AdminController 'id_cart' => $id_cart, 'order_message' => $message_content, 'link_order' => $this->context->link->getPageLink( - 'order', false, + 'order', + null, (int)$this->context->cart->id_lang, 'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart) ), @@ -1320,7 +1321,7 @@ class AdminCartsControllerCore extends AdminController $idHotelCartBooking = Tools::getValue('id_hotel_cart_booking'); // valiadate services being added if (Validate::isLoadedObject($objHtlCartBooking = new HotelCartBookingData($idHotelCartBooking))) { - $name = Tools::getValue('new_service_name'); + $name = trim(Tools::getValue('new_service_name')); $price = Tools::getValue('new_service_price'); $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); $priceAdditionType = Tools::getValue('new_service_price_addition_type'); @@ -1541,6 +1542,10 @@ class AdminCartsControllerCore extends AdminController // Validate selected services foreach ($selectedServiceProducts as $idServiceProduct => $selected) { if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct, false, $objCart->id_lang))) { + if (!$objProduct->allow_multiple_quantity) { + $serviceQuantities[$idServiceProduct] = 1; + } + if ($objProduct->allow_multiple_quantity) { if (!isset($serviceQuantities[$idServiceProduct])) { $response['hasError'] = true; @@ -1554,10 +1559,6 @@ class AdminCartsControllerCore extends AdminController $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name; } - if (!$objProduct->allow_multiple_quantity) { - $serviceQuantities[$idServiceProduct] = 1; - } - if (!isset($serviceUnitPrices[$idServiceProduct]) || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) ) { diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index 63771fda5..ea35a45ff 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -860,7 +860,12 @@ class AdminCustomerThreadsControllerCore extends AdminController $product = new Product((int)$mess['id_product'], false, $this->context->language->id); if (Validate::isLoadedObject($product)) { $messages[$key]['product_name'] = $product->name; - $messages[$key]['product_link'] = $this->context->link->getAdminLink('AdminProducts').'&updateproduct&id_product='.(int)$product->id; + $messages[$key]['booking_product'] = $product->booking_product; + if ($product->booking_product) { + $messages[$key]['product_link'] = $this->context->link->getAdminLink('AdminProducts').'&updateproduct&id_product='.(int)$product->id; + } else { + $messages[$key]['product_link'] = $this->context->link->getAdminLink('AdminNormalProducts').'&updateproduct&id_product='.(int)$product->id; + } } } } @@ -981,8 +986,6 @@ class AdminCustomerThreadsControllerCore extends AdminController $timeline = array(); foreach ($messages as $message) { $product = new Product((int)$message['id_product'], false, $this->context->language->id); - $link_product = $this->context->link->getAdminLink('AdminOrders').'&vieworder&id_order='.(int)$product->id; - $content = ''; if (!$message['private']) { $customerName = false; @@ -1000,7 +1003,13 @@ class AdminCustomerThreadsControllerCore extends AdminController } if (Validate::isLoadedObject($product)) { - $content .= $this->l('Room type: ').''.$product->name.'

'; + if ($product->booking_product) { + $content .= $this->l('Room type:'); + } else { + $content .= $this->l('Product:'); + } + + $content .= ' '.$product->name.'

'; } $content .= Tools::safeOutput($message['message']); diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index b805356ad..11242fc56 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -145,6 +145,7 @@ class AdminImportControllerCore extends AdminController 'id_state' => array('label' => $this->l('State ID')), 'city' => array('label' => $this->l('City *')), 'postcode' => array('label' => $this->l('Zip Code *')), + 'fax' => array('label' => $this->l('Fax')), 'policies' => array('label' => $this->l('Hotel Policies')), 'active_refund' => array('label' => $this->l('Allow Refund (0 = No, 1 = Yes)')), 'refund_ids' => array('label' => $this->l('Refund IDs (x,y,z...)')), @@ -1200,6 +1201,11 @@ class AdminImportControllerCore extends AdminController $this->l('Zip code is invalid for (ID: %1$s)'), (isset($info['id']) && !empty($info['id']))? $info['id'] : 'null' ); + } else if (isset($info['fax']) && !Validate::isGenericName($info['fax'])) { + $this->errors[] = sprintf( + $this->l('Fax is invalid for (ID: %1$s)'), + (isset($info['id']) && !empty($info['id']))? $info['id'] : 'null' + ); } else if ($objCountry->active) { if ($objCountry->contains_states) { if (!isset($info['id_state']) @@ -1254,6 +1260,7 @@ class AdminImportControllerCore extends AdminController $objAddress->id_state = $info['id_state']; $objAddress->city = $info['city']; $objAddress->postcode = $info['postcode']; + $objHotelBranch->fax = $info['fax']; $hotelName = $objHotelBranch->hotel_name[$idLangDefault]; $objAddress->alias = $hotelName; $hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName)); @@ -1438,16 +1445,18 @@ class AdminImportControllerCore extends AdminController $objHotelOrderRestrictDate->use_global_min_booking_offset = true; if (isset($info['max_checkout_offset']) - && (Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset'] - || isset($info['min_booking_offset']) && $info['min_booking_offset'] < $info['max_checkout_offset']) + && ((Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset']) + || (isset($info['min_booking_offset']) && ($info['min_booking_offset'] < $info['max_checkout_offset'])) + ) ) { $objHotelOrderRestrictDate->use_global_max_checkout_offset = false; $objHotelOrderRestrictDate->max_checkout_offset = $info['max_checkout_offset']; } if (isset($info['min_booking_offset']) - && (Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset'] - || isset($info['max_checkout_offset']) && $info['max_checkout_offset'] > $info['min_booking_offset']) + && ((Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset']) + || (isset($info['max_checkout_offset']) && ($info['max_checkout_offset'] > $info['min_booking_offset'])) + ) ) { $objHotelOrderRestrictDate->use_global_min_booking_offset = false; $objHotelOrderRestrictDate->min_booking_offset = $info['min_booking_offset']; @@ -2449,39 +2458,41 @@ class AdminImportControllerCore extends AdminController $idHotel = 0; $objCustomer = new Customer($info['id_customer']); $objProduct = new Product($info['id_product']); - if (Validate::isLoadedObject($objCustomer) - && Validate::isLoadedObject($objProduct) - ) { - if (!isset($hotelRoomTypeInfo[$info['id_product']])) { - if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) { + if (Validate::isLoadedObject($objCustomer)) { + if (Validate::isLoadedObject($objProduct) || $objProduct->booking_product) { + if (!isset($hotelRoomTypeInfo[$info['id_product']])) { + if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) { + $singleRow->id_hotel = $roomInfo['id_hotel']; + $idHotel = $roomInfo['id_hotel']; + $singleRow->adults = $roomInfo['adults']; + $singleRow->children = $roomInfo['children']; + $hotelRoomTypeInfo[$info['id_product']] = $roomInfo; + } + } else { + $roomInfo = $hotelRoomTypeInfo[$info['id_product']]; $singleRow->id_hotel = $roomInfo['id_hotel']; $idHotel = $roomInfo['id_hotel']; $singleRow->adults = $roomInfo['adults']; $singleRow->children = $roomInfo['children']; - $hotelRoomTypeInfo[$info['id_product']] = $roomInfo; + } + + $ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow; + if (!isset($orderInfo[$info['id_order']])) { + $orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer; + if (isset($singleRow->id_order_status)) { + $orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status; + } else { + $orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT'); + } + + if (isset($singleRow->id_currency)) { + $orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ; + } else { + $orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT'); + } } } else { - $roomInfo = $hotelRoomTypeInfo[$info['id_product']]; - $singleRow->id_hotel = $roomInfo['id_hotel']; - $idHotel = $roomInfo['id_hotel']; - $singleRow->adults = $roomInfo['adults']; - $singleRow->children = $roomInfo['children']; - } - - $ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow; - if (!isset($orderInfo[$info['id_order']])) { - $orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer; - if (isset($singleRow->id_order_status)) { - $orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status; - } else { - $orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT'); - } - - if (isset($singleRow->id_currency)) { - $orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ; - } else { - $orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT'); - } + $this->warnings[] = $this->l('Invalid room type Id: ').$info['id_product']; } } } @@ -2667,7 +2678,7 @@ class AdminImportControllerCore extends AdminController null, false )) { - $this->errors[] = $this->l('Failed to create order for order reference '.$orderRefKey); + $this->errors[] = $this->l('Failed to create booking for reference').' '.$orderRefKey; } foreach ($featurePrices as $idPrice) { diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php index d73f93207..694b27ddd 100644 --- a/controllers/admin/AdminLocalizationController.php +++ b/controllers/admin/AdminLocalizationController.php @@ -401,8 +401,20 @@ class AdminLocalizationControllerCore extends AdminController public function beforeUpdateOptions() { - $lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT')); + if (!trim(Tools::getValue('PS_WEIGHT_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Weight unit')); + } + if (!trim(Tools::getValue('PS_DISTANCE_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Distance unit')); + } + if (!trim(Tools::getValue('PS_DIMENSION_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Dimension unit')); + } + if (!trim(Tools::getValue('PS_VOLUME_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Volume unit')); + } + $lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT')); if (!$lang->active) { $lang->active = 1; $lang->save(); diff --git a/controllers/admin/AdminLogsController.php b/controllers/admin/AdminLogsController.php index 029dc0fc6..10f683320 100644 --- a/controllers/admin/AdminLogsController.php +++ b/controllers/admin/AdminLogsController.php @@ -88,6 +88,7 @@ class AdminLogsControllerCore extends AdminController 'title' => $this->l('Minimum severity level'), 'hint' => $this->l('Enter "5" if you do not want to receive any emails.').'
'.$this->l('Emails will be sent to the website owner.'), 'cast' => 'intval', + 'validation' => 'isUnsignedInt', 'type' => 'text' ) ), diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index f27cab407..597c89dbf 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -3854,14 +3854,14 @@ class AdminNormalProductsControllerCore extends AdminController } $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - $selectetRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE); - $selectetHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL); + $selectedRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE); + $selectedHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL); $tree = new HelperTree('hotels-room-tree'); $tree->setData(HotelHelper::generateTreeData([ 'rootNode' => HotelHelper::NODE_HOTEL, 'leafNode' => HotelHelper::NODE_ROOM_TYPE, - 'selectedElements' => $selectetRoomTypes + 'selectedElements' => $selectedRoomTypes ])) ->setUseCheckBox(true) ->setAutoSelectChildren(true) @@ -3873,7 +3873,7 @@ class AdminNormalProductsControllerCore extends AdminController $tree->setData(HotelHelper::generateTreeData([ 'rootNode' => HotelHelper::NODE_HOTEL, 'leafNode' => HotelHelper::NODE_HOTEL, - 'selectedElements' => $selectetHotels + 'selectedElements' => $selectedHotels ])) ->setUseCheckBox(true) ->setAutoSelectChildren(true) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index ad47eedfe..2550608bc 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -189,7 +189,7 @@ class AdminOrderPreferencesControllerCore extends AdminController 'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => array( 'title' => $this->l('Show room price breakdown'), 'hint' => $this->l('Show price breakdown for rooms with auto added services on checkout page.'), - 'desc' => $this->l('This room price breakdown will be shown if cart rule for specific room type is applied on that room.'), + 'desc' => $this->l('Displays a price breakdown for rooms that have auto-added services during checkout.'), 'cast' => 'intval', 'type' => 'bool' ), @@ -362,23 +362,24 @@ class AdminOrderPreferencesControllerCore extends AdminController $countries = Country::getCountries($this->context->language->id); $this->context->smarty->assign('countries', $countries); $this->fields_options['standard_product'] = array( - 'title' => $this->l('Standard Product'), + 'title' => $this->l('Standard Product Address configuration'), 'icon' => 'icon-cogs', 'fields' => array( 'PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE' => array( - 'title' => $this->l('Standard product address type'), + 'title' => $this->l('Address for standard product tax calculation'), 'validation' => 'isInt', 'type' => 'select', 'cast' => 'intval', 'list' => $addressPrefrenceTypes, 'identifier' => 'value', 'js' => "changeStandardProductAddressType()", - 'hint' => $this->l('Select Standard product Address type, this will be used to calculate the tax for the standard product price.'), - 'desc' => $this->l('The selected address type will be used to calculate tax for the standard product.') + 'hint' => $this->l('Select address for standard product tax calculation, this will be used to calculate the tax for the standard product price.'), + 'desc' => $this->l('The selected address will be used to calculate tax for standard products. To change the hotel address, update the "Primary Hotel" in the'). + ' '.$this->l('Hotel General Configuration.').'' ), 'PS_STANDARD_PRODUCT_ORDER_ADDRESS' => array( - 'title' => $this->l('Standard product custom address'), - 'hint' => $this->l('Set the Address details'), + 'title' => $this->l('Custom address for tax calculation'), + 'hint' => $this->l('Set the custom address details for tax calculation'), 'type' => 'html', ), ), @@ -429,7 +430,7 @@ class AdminOrderPreferencesControllerCore extends AdminController $postcode = trim(Tools::getValue('service_postcode')); $serviceAddressPrefrenceType = Tools::getValue('PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE'); if ($serviceAddressPrefrenceType == Product::STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM) { - $addressValidation = Address::getValidationRules('Address'); + $addressValidation = Address::getValidationRules('Address')['size']; if (!$idCountry) { $this->errors[] = Tools::displayError('Field country is required'); } elseif (!Validate::isLoadedObject($objCountry = new Country($idCountry))) { diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 02e981a67..21af1d37c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -986,14 +986,12 @@ class AdminOrdersControllerCore extends AdminController } if ($serviceProducts) { - if ($additionalServices) { - foreach ($serviceProducts as $key => $servProduct) { - $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; - if (isset($additionalServices[$productLineData['id']]) - && in_array($servProduct['id_product'], array_column($additionalServices[$productLineData['id']]['additional_services'], 'id_product')) - ) { - unset($serviceProducts[$key]); - } + foreach ($serviceProducts as $key => $servProduct) { + $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; + if (isset($additionalServices[$productLineData['id']]) + && in_array($servProduct['id_product'], array_column($additionalServices[$productLineData['id']]['additional_services'], 'id_product')) + ) { + unset($serviceProducts[$key]); } } @@ -1017,6 +1015,7 @@ class AdminOrdersControllerCore extends AdminController $smartyVars['taxRulesGroups'] = $taxRulesGroups; $smartyVars['invoices_collection'] = $objOrder->getInvoicesCollection(); $smartyVars['customServiceAllowed'] = Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'); + $smartyVars['current_id_lang'] = $this->context->language->id; $this->context->smarty->assign($smartyVars); @@ -1124,6 +1123,7 @@ class AdminOrdersControllerCore extends AdminController $this->context->smarty->assign( array( 'order' => $objOrder, + 'currency' => new Currency($objOrder->id_currency), 'current_index' => self::$currentIndex, 'bookingOrderInfo' => $bookingOrderInfo, 'serviceProducts' => array_merge($hotelProducts, $standaloneProducts) @@ -1386,13 +1386,12 @@ class AdminOrdersControllerCore extends AdminController $id_lang_shop = false ){ if ($this->action == 'export' && empty($this->_listsql)) { - $this->_select .= ', c.`email`, cgd.`phone`, a.`total_paid_real`, + $this->_select .= ', c.`email`, c.`phone`, a.`total_paid_real`, orf.`cancellation_date`, orf.`cancellation_fee`, cy.`iso_code` AS country, st.`iso_code` as state, ad.`city`, CONCAT(ad.`address1`, \', \', ad.`postcode`) AS `cus_address`, hbdtl.*'; - $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd ON cgd.`email` = c.`email` AND cgd.`id_cart` = 0 - LEFT JOIN `'._DB_PREFIX_.'address` ad ON a.`id_customer`= ad.`id_customer` AND ad.`id_customer`!=0 + $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'address` ad ON a.`id_customer`= ad.`id_customer` AND ad.`id_customer`!=0 LEFT JOIN `'._DB_PREFIX_.'country` cy ON cy.`id_country`= ad.`id_country` LEFT JOIN `'._DB_PREFIX_.'state` st ON st.`id_state`= ad.`id_state` LEFT JOIN ( @@ -2025,6 +2024,11 @@ class AdminOrdersControllerCore extends AdminController $this->context->currency = new Currency((int)$objCart->id_currency); $this->errors = HotelCartBookingData::validateCartBookings(!Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')); + + // Remove cart rules and add if any changes + CartRule::autoRemoveFromCart($this->context); + CartRule::autoAddToCart($this->context); + $orderTotal = $objCart->getOrderTotal(true, Cart::BOTH); if ($objCart->is_advance_payment) { $advancePaymentAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); @@ -2850,10 +2854,36 @@ class AdminOrdersControllerCore extends AdminController $helper->color = 'color1'; $helper->title = $this->l('Total Rooms'); $helper->tooltip = $this->l('Total rooms is the number of rooms booked in this order.'); - $helper->href = '#start_products'; + $helper->href = '#start_rooms'; $helper->value = $numRooms; $this->kpis[] = $helper; + // if order has normal products the add kpi for total products + $objServiceProductOrderDetail = new ServiceProductOrderDetail(); + $hotelProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($objOrder->id, 0, 0, Product::SELLING_PREFERENCE_HOTEL_STANDALONE); + $standaloneProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($objOrder->id, 0, 0, Product::SELLING_PREFERENCE_STANDALONE); + + if ($hotelProducts || $standaloneProducts) { + $helper = new HelperKpi(); + $helper->id = 'box-total-products'; + $helper->icon = 'icon-home'; + $helper->color = 'color1'; + $helper->title = $this->l('Total Products'); + $helper->tooltip = $this->l('Total products is the number of product quantities booked in this order.'); + $helper->href = '#start_products'; + + $totalProductQuantity = 0; + if ($hotelProducts) { + $totalProductQuantity += array_sum(array_column($hotelProducts, 'quantity')); + } + if ($standaloneProducts) { + $totalProductQuantity += array_sum(array_column($standaloneProducts, 'quantity')); + } + + $helper->value = $totalProductQuantity; + $this->kpis[] = $helper; + } + $helper = new HelperKpi(); if (isset($orderHistory[0]['id_order_state']) && ($orderHistory[0]['id_order_state'] == Configuration::get('PS_OS_PAYMENT_ACCEPTED'))) { $initialPaymentStatus = $this->l('Full Payment'); @@ -3267,7 +3297,7 @@ class AdminOrdersControllerCore extends AdminController 0, 0, null, - 0, + null, null, 0, $value['id'] @@ -6138,6 +6168,9 @@ class AdminOrdersControllerCore extends AdminController // Save order invoice if (isset($objOrderInvoice)) { + $objOrderInvoice->total_products_wt -= $diffPriceTaxIncl; + $objOrderInvoice->total_paid_tax_excl += $diffPriceTaxExcl; + $objOrderInvoice->total_paid_tax_incl += $diffPriceTaxIncl; $result &= $objOrderInvoice->update(); } @@ -6234,7 +6267,7 @@ class AdminOrdersControllerCore extends AdminController 0, 1, 1, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -6250,7 +6283,7 @@ class AdminOrdersControllerCore extends AdminController 0, 1, 0, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -6266,7 +6299,7 @@ class AdminOrdersControllerCore extends AdminController 0, 0, null, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -7675,7 +7708,7 @@ class AdminOrdersControllerCore extends AdminController $objHotelBookingDetail->date_to, $objHotelBookingDetail->id_room )) { - $name = Tools::getValue('new_service_name'); + $name = trim(Tools::getValue('new_service_name')); $price = Tools::getValue('new_service_price'); $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); $priceAdditionType = Tools::getValue('new_service_price_addition_type'); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 154725542..7014b0968 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5312,6 +5312,7 @@ class AdminProductsControllerCore extends AdminController if ($idRooms = Tools::getValue('id_rooms')) { $rowsToHighlight = array(); $room = array(); + $bookedRows = array(); if (trim($floor = Tools::getValue('floor'))) { $room['floor'] = $floor; if (!Validate::isGenericName($floor)) { @@ -5379,7 +5380,8 @@ class AdminProductsControllerCore extends AdminController } } else if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE && $disableDates) { foreach ($disableDates as $key => $dateRange) { - if ($objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + $bookedRows[$bookingRow['id']] = new HotelBookingDetail($bookingRow['id']); $rowsToHighlight[] = $key; } } @@ -5390,6 +5392,18 @@ class AdminProductsControllerCore extends AdminController Hook::exec('actionValidateRoomInformation', array('room_information' => $room)); } + + if (count($bookedRows)) { + foreach ($bookedRows as $bookedRow) { + $this->context->smarty->assign(array( + 'link' => $this->context->link, + 'orderDetails' => $bookedRow, + )); + + $this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl'); + } + + } } if (empty($this->errors)) { @@ -5476,7 +5490,7 @@ class AdminProductsControllerCore extends AdminController if (!($roomQuantity = Tools::getValue('qty'))) { $this->errors[] = Tools::displayError('Number of rooms is required.'); - } else if ($roomQuantity < 1) { + } else if (!Validate::isUnsignedInt($roomQuantity) || $roomQuantity < 1) { $this->errors[] = Tools::displayError('Invalid value for number of rooms.'); } diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index aadb4ee44..fcf663091 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -285,7 +285,8 @@ class AdminStatusesControllerCore extends AdminController //init and render the second list $this->list_skip_actions = array(); $this->_filter = false; - $this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5)); + $unremovableOrs = Configuration::getMultiple(array('PS_ORS_PENDING', 'PS_ORS_DENIED', 'PS_ORS_REFUNDED')); + $this->addRowActionSkipList('delete', $unremovableOrs); $this->initOrdersReturnsList(); $this->checkFilterForOrdersReturnsList(); diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index e37bf0520..3b67fd8b6 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -420,11 +420,8 @@ class OrderDetailControllerCore extends FrontController } $roomTypes[$type_value['id_product']] = $type_value; } - $redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id); } - $objHotelBookingDetail = new HotelBookingDetail(); - $htlBookingDetail = $objHotelBookingDetail->getOrderCurrentDataByOrderId($order->id); $this->context->smarty->assign( array( diff --git a/controllers/front/OrderFollowController.php b/controllers/front/OrderFollowController.php index 7bb79d54d..62971f761 100644 --- a/controllers/front/OrderFollowController.php +++ b/controllers/front/OrderFollowController.php @@ -41,8 +41,28 @@ class OrderFollowControllerCore extends FrontController parent::initContent(); if (isset($this->context->customer->id) && $this->context->customer->id) { - $ordersReturns = OrderReturn::getOrdersReturn($this->context->customer->id, Tools::getValue('id_order')); - $this->context->smarty->assign('ordersReturns', $ordersReturns); + $hasProductRefunds = 0; + $hasRoomRefunds = 0; + if ($ordersReturns = OrderReturn::getOrdersReturn($this->context->customer->id, Tools::getValue('id_order'))) { + $objOrderReturn = new OrderReturn(); + foreach ($ordersReturns as $key => $orderReturn) { + $ordersReturns[$key]['total_rooms_refunds'] = 0; + $ordersReturns[$key]['total_products_refunds'] = 0; + if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($orderReturn['id_order'], $orderReturn['id_order_return'])) { + $hasRoomRefunds = 1; + } + + if ($refundReqProducts = $objOrderReturn->getOrderRefundRequestedProducts($orderReturn['id_order'], $orderReturn['id_order_return'])) { + $hasProductRefunds = 1; + } + } + } + + $this->context->smarty->assign(array( + 'ordersReturns' => $ordersReturns, + 'hasRoomRefunds' => $hasRoomRefunds, + 'hasProductRefunds' => $hasProductRefunds + )); $this->setTemplate(_PS_THEME_DIR_.'order-follow.tpl'); } else { diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 8663589a1..1851a2acc 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -1148,6 +1148,7 @@ class OrderOpcControllerCore extends ParentOrderController $this->_assignCheckoutValidationVars(); $this->_assignCheckoutVars(); $this->_assignShoppingCart(); + $this->_assignSummaryInformations(); $response['success'] = true; $response['shopping_cart'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'shopping-cart.tpl'); $response['cart_total_block'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'cart-total-block.tpl'); diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 808f86496..2ea5cb9c3 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -891,6 +891,14 @@ class ProductControllerCore extends FrontController $useTax, $quantity ); + $smartyVars['service_price_without_reduction'] = RoomTypeServiceProductPrice::getPrice( + $this->product->id, + $idHotel, + $idProductOption, + $useTax, + $quantity, + false + ); if ($quantity) { $smartyVars['quantity'] = $quantity; } diff --git a/docs/csv_import/hotels_import.csv b/docs/csv_import/hotels_import.csv index f3c5962fa..537e704cc 100644 --- a/docs/csv_import/hotels_import.csv +++ b/docs/csv_import/hotels_import.csv @@ -1,3 +1,3 @@ -Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Max booking offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes) -2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;2024-01-01;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0 -3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0 +Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Fax;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Maximum checkout offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes) +2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;4;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0 +3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0 diff --git a/install/models/install.php b/install/models/install.php index 3e95362ae..4f48210c1 100644 --- a/install/models/install.php +++ b/install/models/install.php @@ -211,6 +211,9 @@ class InstallModelInstall extends InstallAbstractModel Configuration::updateGlobalValue('PS_LANG_DEFAULT', $id_lang); Configuration::updateGlobalValue('PS_VERSION_DB', _PS_INSTALL_VERSION_); Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_VERSION_DB', _QLO_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_INSTALL_VERSION', _QLO_INSTALL_VERSION_); + return true; } @@ -475,6 +478,7 @@ class InstallModelInstall extends InstallAbstractModel Configuration::updateGlobalValue('PS_SHOP_DOMAIN', Tools::getHttpHost()); Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', Tools::getHttpHost()); Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_INSTALL_VERSION', _QLO_INSTALL_VERSION_); Configuration::updateGlobalValue('PS_LOCALE_LANGUAGE', $this->language->getLanguageIso()); Configuration::updateGlobalValue('PS_SHOP_NAME', $data['shop_name']); Configuration::updateGlobalValue('PS_SHOP_ACTIVITY', $data['shop_activity']); diff --git a/install/upgrade/upgrade.php b/install/upgrade/upgrade.php index 7cb6b8379..e30c7a9bd 100644 --- a/install/upgrade/upgrade.php +++ b/install/upgrade/upgrade.php @@ -434,6 +434,7 @@ if (empty($fail_result)) { Configuration::updateValue('PS_HIDE_OPTIMIZATION_TIPS', 0); Configuration::updateValue('PS_NEED_REBUILD_INDEX', 1); Configuration::updateValue('PS_VERSION_DB', _PS_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_VERSION_DB', _QLO_INSTALL_VERSION_); $result .= $warningExist ? ''."\n" : ''."\n"; $result .= $requests; $result .= ''."\n"; diff --git a/mails/en/hotel_booking_cart_data.tpl b/mails/en/hotel_booking_cart_data.tpl index af74884b8..224fc2778 100644 --- a/mails/en/hotel_booking_cart_data.tpl +++ b/mails/en/hotel_booking_cart_data.tpl @@ -38,6 +38,7 @@ {$rm_v['num_rm']} + {if !isset($show_full_date)}{assign var="show_full_date" value=0}{/if} {assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))} {$rm_v['data_form']|date_format:"%d-%b-%G"}{if $is_full_date} {$rm_v['data_form']|date_format:"%I:%M %p"}{/if} diff --git a/mails/en/order_conf_cart_rules.txt b/mails/en/order_conf_cart_rules.txt deleted file mode 100644 index 72a6970da..000000000 --- a/mails/en/order_conf_cart_rules.txt +++ /dev/null @@ -1,3 +0,0 @@ -{foreach $list as $cart_rule} - {$cart_rule['voucher_name']} {$cart_rule['voucher_reduction']} -{/foreach} \ No newline at end of file diff --git a/mails/en/order_conf_product_list.txt b/mails/en/order_conf_product_list.txt deleted file mode 100644 index 0ffd7db7a..000000000 --- a/mails/en/order_conf_product_list.txt +++ /dev/null @@ -1,21 +0,0 @@ -{foreach $list as $product} - {$product['reference']} - - {$product['name']} - - {$product['price']} - - {$product['quantity']} - - {$product['price']} - - {foreach $product['customization'] as $customization} - {$product['name']} {$customization['customization_text']} - - {$product['price']} - - {$product['customization_quantity']} - - {$product['quantity']} - {/foreach} -{/foreach} \ No newline at end of file diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index 20db0a57b..47836bee8 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -805,7 +805,6 @@ var ajaxCart = { } $('.vouchers').show(); } - }, // Update product quantity @@ -844,7 +843,7 @@ var ajaxCart = { if (parseInt(this.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE || parseInt(this.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE ) { - if (typeof value.hotel_wise_data != 'undefined' && value.hotel_wise_data.length) { + if (typeof value.hotel_wise_data != 'undefined') { $(value.hotel_wise_data).each(function(i, val) { ajaxCart.addProductRow(value, val); }); @@ -887,11 +886,12 @@ var ajaxCart = { content += '
'; content += 'Price:'; content += ' '; + if (product.booking_product) { content += formatCurrency(parseFloat(product.bookingData.total_room_type_amount), currency_format, currency_sign, currency_blank); }else if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE || parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE) - && (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.length) + && (typeof(hotel_wise_data) != 'undefined') ) { content += formatCurrency(parseFloat(hotel_wise_data.amount), currency_format, currency_sign, currency_blank); } else { @@ -901,15 +901,19 @@ var ajaxCart = { content += '
'; } content += '
'; - content += '' + total_qty_txt + ':'; + if (product.booking_product || product.allow_multiple_quantity) { + content += '' + total_qty_txt + ':'; + } content += ''; content += ''; if (product.booking_product) { content += product.bookingData.total_num_rooms; - } else if (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.total_qty) { - content += hotel_wise_data.total_qty; - } else { - content += product.cart_quantity; + } else if (product.allow_multiple_quantity) { + if (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.total_qty) { + content += hotel_wise_data.total_qty; + } else { + content += product.cart_quantity; + } } content += ''; content += ''; @@ -1186,6 +1190,7 @@ var ajaxCart = { product.date_from + ' - ' + product.date_to ); $('#layer_cart_product_hotel_name').parent().hide(); + $('#layer_cart_product_quantity').parent().show(); var product_quantity_text = ''; if(parseInt(product.booking_product)) { let rooms = 0; @@ -1202,7 +1207,11 @@ var ajaxCart = { product_quantity_text = product.occupancy; } } else { - product_quantity_text = product.qty; + if (product.allow_multiple_quantity) { + product_quantity_text = product.qty; + } else { + $('#layer_cart_product_quantity').parent().hide(); + } $('#layer_cart_product_unit_price').text(product.unit_price); if (product.hotel_name) { $('#layer_cart_product_hotel_name').text(product.hotel_name).parent().show(); @@ -1369,18 +1378,21 @@ function crossselling_serialScroll() { }); } -function resetRoomtypeServices() { +function resetRoomtypeServices(refresh = true) { $('.room_demands_container').find('input.id_room_type_demand:checked').prop('checked', false).uniform(); $('#additional_products').empty(); $('#additional_products div') $('.remove_roomtype_product').text(select_txt).removeClass('btn-danger remove_roomtype_product').addClass('btn-success add_roomtype_product'); - BookingForm.refresh(); + if (refresh) { + BookingForm.refresh(); + } } function disableRoomTypeDemands(show) { if (show) { $('.room_demands_container_overlay').show(); $('.room_demands_container').find('input:checkbox.id_room_type_demand').prop('checked', false); + $('.room_demand_block').find('.id_room_type_demand').prop('checked', false).parent().removeClass('checked'); $('.room_demands_container').find('input:checkbox.id_room_type_demand').attr('disabled', 'disabled'); } else { $('.room_demands_container_overlay').hide(); @@ -1391,6 +1403,7 @@ function disableRoomTypeDemands(show) { function disableRoomTypeServices(disable) { if (disable) { + resetRoomtypeServices(false); $('#service_products_cont').find('button.add_roomtype_product').attr('disabled', 'disabled'); $('#service_products_cont').find('.qty_container .qty_direction a').attr('disabled', 'disabled'); } else { @@ -1472,4 +1485,4 @@ function getBookingOccupancyDetails(bookingform, booking_product) } return occupancy; -} \ No newline at end of file +} diff --git a/modules/blockcart/cartrow.tpl b/modules/blockcart/cartrow.tpl index 2e0e5ac52..6a1e9ee54 100644 --- a/modules/blockcart/cartrow.tpl +++ b/modules/blockcart/cartrow.tpl @@ -48,11 +48,11 @@ {block name='blockcart_shopping_cart_product_quantity'}
- {l s='Total Qty.' mod='blockcart'}: + {if $product.allow_multiple_quantity || $product.booking_product}{l s='Total Qty.' mod='blockcart'}:{/if} {if $product.booking_product} {$product.bookingData['total_num_rooms']} - {else} + {elseif $product.allow_multiple_quantity} {if $product.selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE || $product.selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE} {$hotel_wise_data.total_qty} {elseif $product.selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE} @@ -65,7 +65,7 @@
{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)} -   +   {/if}
diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index e4c24eb82..e20ccf9e0 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -257,361 +257,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel return $specialDaysCount; } - /** - * [getHotelRoomTypesRatesByDate returns hotel room types rates accrding to feature price plans] - * @param [int] $id_hotel [id of th hotel] - * @param integer $id_product [id of the product if supplied only rates of this room type will be returned] - * @param [date] $date_from [start date of the date range] - * @param [date] $date_to [end date of the date range] - * @return [array|false] [returns array containing rates of room type of a hotel if found else returns false] - */ - public function getHotelRoomTypesRatesAndInventoryByDate($id_hotel, $id_product, $date_from, $date_to) - { - $hotelRoomType = new HotelRoomType(); - $context = Context::getContext(); - $roomTypeRatesAndInventory = array(); - $objBookingDetail = new HotelBookingDetail(); - $incr = 0; - $date_from = date('Y-m-d', strtotime($date_from)); - $date_to = date('Y-m-d', strtotime($date_to)); - for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - $currentDate = date('Y-m-d', strtotime($date)); - $nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); - if ($id_product) { - $bookingParams = array( - 'date_from' => $currentDate, - 'date_to' => $nextDayDate, - 'hotel_id' => $id_hotel, - 'id_room_type' => $id_product, - 'only_search_data' => 1, - ); - $roomTypeAvailabilityInfo = $objBookingDetail->dataForFrontSearch($bookingParams); - if (isset($roomTypeAvailabilityInfo['stats']['num_avail'])) { - $totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail']; - } else { - $totalAvailableRooms = 0; - } - - $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($id_product, $currentDate, $nextDayDate); - $roomTypeRatesAndInventory[$incr]['date'] = $currentDate; - $roomTypeRatesAndInventory[$incr]['room_types'][0]['id'] = $id_product; - $roomTypeRatesAndInventory[$incr]['room_types'][0]['rates'] = $roomTypePrice; - $roomTypeRatesAndInventory[$incr]['room_types'][0]['available_rooms'] = $totalAvailableRooms; - } else { - $hotelRoomTypes = $hotelRoomType->getRoomTypeByHotelId($id_hotel, $context->language->id); - if ($hotelRoomTypes) { - $roomTypeRatesAndInventory[$incr]['date'] = $currentDate; - foreach ($hotelRoomTypes as $key => $product) { - $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $product['id_product'], - $currentDate, - $nextDayDate - ); - $bookingParams = array( - 'date_from' => $currentDate, - 'date_to' => $nextDayDate, - 'hotel_id' => $id_hotel, - 'id_room_type' => $product['id_product'], - 'only_search_data' => 1, - ); - $roomTypeAvailabilityInfo = $objBookingDetail->dataForFrontSearch($bookingParams); - if (isset($roomTypeAvailabilityInfo['stats']['num_avail'])) { - $totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail']; - } else { - $totalAvailableRooms = 0; - } - $roomTypeRatesAndInventory[$incr]['room_types'][$key]['id'] = $product['id_product']; - $roomTypeRatesAndInventory[$incr]['room_types'][$key]['rates'] = $roomTypePrice; - $roomTypeRatesAndInventory[$incr]['room_types'][$key]['available_rooms'] = $totalAvailableRooms; - } - } else { - return false; - } - } - $incr++; - } - return $roomTypeRatesAndInventory; - } - - /** - * [updateRoomTypesFeaturePrices update and creates feature price plans by supplied information] - * @param [array] $featurePricePlans [feature price plans sent from channel manager] - * @return [array] [success if process is finished successfully else fasiled with errors] - * @information [if any feature price plan for the same date_from and date_to(supplied in the $featurePricePlans array) it will be updated otherwise it is added. While adding date range type rate plans if any plan already exist then feature price for all specific dates in the date range will be created (or updated if specific date feature price plan exists)] - */ - public function updateRoomTypesFeaturePricesAvailability($featurePricePlans) - { - $errors = []; - if ($featurePricePlans) { - if (isset($featurePricePlans['data']) && $featurePricePlans['data']) { - foreach ($featurePricePlans['data'] as $roomTypeRatesData) { - $dateFrom = date('Y-m-d', strtotime($roomTypeRatesData['dateFrom'])); - $dateTo = date('Y-m-d', strtotime('+1 day', strtotime($roomTypeRatesData['dateTo']))); - if ($roomTypeRatesData['roomType']) { - foreach ($roomTypeRatesData['roomType'] as $key => $roomTypeRates) { - $id_product = $key; - // feature price rates create and updates - if (isset($roomTypeRates['rate'])) { - $productPriceTE = Product::getPriceStatic((int) $id_product, false); - if ($productPriceTE != $roomTypeRates['rate']) { - if ($productPriceTE > $roomTypeRates['rate']) { - $priceImpactWay = 1; - $impactValue = $productPriceTE - $roomTypeRates['rate']; - } else { - $priceImpactWay = 2; - $impactValue = $roomTypeRates['rate'] - $productPriceTE; - } - $params = array(); - $params['roomTypeId'] = $id_product; - $params['featurePriceName'] = 'Webservice Feature Price'; - $params['dateFrom'] = $dateFrom; - $featurePriceDateTo = date('Y-m-d', (strtotime($dateTo) - _TIME_1_DAY_)); - $params['dateTo'] = $featurePriceDateTo; - $params['priceImpactWay'] = $priceImpactWay; - $params['isSpecialDaysExists'] = 0; - $params['jsonSpecialDays'] = null; - $params['priceImpactType'] = 2; - $params['impactValue'] = $impactValue; - $params['enableFeaturePrice'] = 1; - $nextDate = date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))); - if ($nextDate == $dateTo) { - $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC; - $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( - $id_product, - $dateFrom, - $featurePriceDateTo, - 'specific_date' - ); - if ($featurePriceExists) { - if (!$this->saveFeaturePricePlan(2, $params, $featurePriceExists['id'])) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } else { - if (!$this->saveFeaturePricePlan(2, $params, 0)) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } - } else { - $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_RANGE; - if ($featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( - $id_product, - $dateFrom, - $featurePriceDateTo, - 'date_range' - )) { - if ($featurePriceExists['date_from'] == $dateFrom - && $featurePriceExists['date_to'] == $featurePriceDateTo - ) { - if (!$this->saveFeaturePricePlan( - 1, - $params, - $featurePriceExists['id'] - )) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } else { - for($date = $dateFrom; $date < $dateTo; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - // Creating feature prices day wise, for single days. - $nextDayDate = $currentDate = date('Y-m-d', $date); - $params['dateFrom'] = $currentDate; - $params['dateTo'] = $nextDayDate; - $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC; - $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( - $id_product, - $currentDate, - $nextDayDate, - 'specific_date' - ); - if ($featurePriceExists) { - if (!$this->saveFeaturePricePlan( - 2, - $params, - $featurePriceExists['id'] - )) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } else { - if (!$this->saveFeaturePricePlan(2, $params, 0)) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } - } - } - } else { - if (!$this->saveFeaturePricePlan(1, $params, 0)) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } - } - } - } - - if (isset($roomTypeRates['inventory'])) { - $totalAvailableNotBooked = 0; - $totalAvailableRooms = 0; - $hotelRoomType = new HotelRoomType(); - $hotelBookingDetail = new HotelBookingDetail(); - $hotelRoomInformation = new HotelRoomInformation(); - $roomTypeInfo = $hotelRoomType->getRoomTypeInfoByIdProduct($id_product); - $id_hotel = $roomTypeInfo['id_hotel']; - if ($id_hotel) { - $bookingParams = array( - 'date_from' => $dateFrom, - 'date_to' => $dateTo, - 'hotel_id' => $id_hotel, - 'id_room_type' => $id_product, - 'only_search_data' => 1, - ); - $roomTypeAvailabilityInfo = $hotelBookingDetail->dataForFrontSearch($bookingParams); - $bookedRoomsInfo = $hotelRoomInformation->getRoomTypeBookedRoomsForDateRange( - $id_hotel, - $id_product, - $dateFrom, - $dateTo - ); - $countBookedRooms = count($bookedRoomsInfo); - if (isset($roomTypeAvailabilityInfo['stats']['total_rooms'])) { - $totalAvailableNotBooked = $roomTypeAvailabilityInfo['stats']['total_rooms'] - $countBookedRooms; - $totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail']; - } - - if ($roomTypeRates['inventory'] <= $totalAvailableNotBooked) { - if ($roomTypeRates['inventory'] < $totalAvailableRooms) { - $numDisabledRooms = $totalAvailableRooms - $roomTypeRates['inventory']; - $availableRooms = $hotelRoomInformation->getRoomTypeAvailableRoomsForDateRange( - $id_hotel, - $id_product, - $dateFrom, - $dateTo - ); - if ($availableRooms) { - foreach ($availableRooms as $room) { - $objRoomDisableDates = new HotelRoomDisableDates(); - $params['id_room'] = $room['id']; - $params['date_from'] = $dateFrom; - $params['date_to'] = $dateTo; - if (!($objRoomDisableDates->checkIfRoomAlreadyDisabled($params))) { - if ($numDisabledRooms > 0) { - $hotelRoomInformation = new HotelRoomInformation($room['id']); - if ($hotelRoomInformation->id_status == 3) { - $params['reason'] = $this->moduleInstance->l('Disabled from channel manager.', 'HotelRoomTypeFeaturePricing'); - if (!$objRoomDisableDates->updateDisableDateRanges( - $params - )) { - $errors[] = $this->moduleInstance->l('Some error occurred while saving disable dates for '.$dateFrom.' To '.$dateTo.' for room id-'.$room['id'], 'HotelRoomTypeFeaturePricing'); - } - } else { - $hotelRoomInformation->id_status = 3; - if ($hotelRoomInformation->save()) { - $objRoomDisableDates = new HotelRoomDisableDates(); - $objRoomDisableDates->id_room = $room['id']; - $objRoomDisableDates->date_from = $dateFrom; - $objRoomDisableDates->date_to = $dateTo; - $objRoomDisableDates->reason = $this->moduleInstance->l('Disabled from channel manager.', 'HotelRoomTypeFeaturePricing'); - $objRoomDisableDates->save(); - } - } - $numDisabledRooms--; - } - } - } - } - } elseif ($roomTypeRates['inventory'] > $totalAvailableRooms) { - $roomsToEnable = $roomTypeRates['inventory'] - $totalAvailableRooms; - $disabledRooms = $hotelRoomInformation->getRoomTypeDisabledRoomsForDateRange( - $id_hotel, - $id_product, - $dateFrom, - $dateTo - ); - if ($disabledRooms) { - foreach ($disabledRooms as $disableRoom) { - if ($roomsToEnable > 0) { - $hotelRoomInformation = new HotelRoomInformation($disableRoom['id']); - $objRoomDisableDates = new HotelRoomDisableDates(); - $params['id_room'] = $disableRoom['id']; - $params['date_from'] = $dateFrom; - $params['date_to'] = $dateTo; - if (!$objRoomDisableDates->deleteDisabledDatesForDateRange( - $params - )) { - $errors[] = $this->moduleInstance->l('Some error occurred while saving deleting dates for '.$dateFrom.' To '.$dateTo.' for room id-'.$disableRoom['id'], 'HotelRoomTypeFeaturePricing'); - } - $disabledDates = $objRoomDisableDates->getRoomDisableDates( - $disableRoom['id'] - ); - if (!count($disabledDates)) { - $hotelRoomInformation->id_status = 1; - $hotelRoomInformation->disabled_dates = null; - } - $hotelRoomInformation->save(); - } - $roomsToEnable--; - } - } - } - } - } - } else { - $errors[] = $this->moduleInstance->l('Requested rooms inventory is not available.', 'HotelRoomTypeFeaturePricing'); - } - } - } else { - $errors[] = $this->moduleInstance->l('Room Types for which Feature prices to be updated are not found.', 'HotelRoomTypeFeaturePricing'); - } - } - } else { - $errors[] = $this->moduleInstance->l('Update Information not found.', 'HotelRoomTypeFeaturePricing'); - } - } else { - $errors[] = $this->moduleInstance->l('Update Information not found.', 'HotelRoomTypeFeaturePricing'); - } - - $result = array(); - if (count($errors)) { - $result['status'] = 'failed'; - $result['errors'] = $errors; - } else { - $result['status'] = 'success'; - } - - return $result; - } - - /** - * [saveFeaturePricePlan add or update feature price plan] - * @param [int] $dateSelectionType [date selection type 1 or 2 (date range or specific date)] - * @param [array] $params [Room type rate plan info] - * @param integer $id [id of the feature price plan if 0 means to add else to update the feature price plan] - * @return [bool] [returns true is successfuly added or updated else returns false] - */ - public function saveFeaturePricePlan($dateSelectionType, $params, $id = 0) - { - if ($id) { - $roomTypeFeaturePricing = new HotelRoomTypeFeaturePricing($id); - } else { - $roomTypeFeaturePricing = new HotelRoomTypeFeaturePricing(); - } - $roomTypeFeaturePricing->id_product = $params['roomTypeId']; - // lang fields - $languages = Language::getLanguages(false); - foreach ($languages as $language) { - $roomTypeFeaturePricing->feature_price_name[$language['id_lang']] = $params['featurePriceName']; - } - - $roomTypeFeaturePricing->date_selection_type = $params['dateSelectionType']; - $roomTypeFeaturePricing->date_from = $params['dateFrom']; - $roomTypeFeaturePricing->date_to = $params['dateTo']; - $roomTypeFeaturePricing->impact_way = $params['priceImpactWay']; - $roomTypeFeaturePricing->is_special_days_exists = $params['isSpecialDaysExists']; - $roomTypeFeaturePricing->special_days = $params['jsonSpecialDays']; - $roomTypeFeaturePricing->impact_type = $params['priceImpactType']; - $roomTypeFeaturePricing->impact_value = $params['impactValue']; - $roomTypeFeaturePricing->active = $params['enableFeaturePrice']; - - return $roomTypeFeaturePricing->save(); - } - /** * [getRoomTypeTotalPrice Returns Total price of the room type according to supplied dates]. * diff --git a/modules/hotelreservationsystem/classes/QloRoomType.php b/modules/hotelreservationsystem/classes/QloRoomType.php deleted file mode 100644 index c5bc3ac02..000000000 --- a/modules/hotelreservationsystem/classes/QloRoomType.php +++ /dev/null @@ -1,304 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -class QloRoomType extends QloWebservice -{ - public function getRoomType($idHotel) - { - $objHotelRoomType = new HotelRoomType(); - $idLang = $this->context->language->id; - $roomTypes = $objHotelRoomType->getRoomTypeByHotelId((int)$idHotel, $idLang); - - $required = ['id', 'name', 'status']; - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array()); - foreach ($roomTypes as $roomType) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array()); - $roomType['name'] = $roomType['room_type']; - $roomType['id'] = $roomType['id_product']; - $roomType['status'] = $roomType['active']; - foreach ($roomType as $key => $value) { - if (in_array($key, $required)) { - $this->output .= $this->renderField($key, $value); - } - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array()); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array()); - return $this->output; - } - - public function getRoomRates(array $params) - { - $objRoomTypeFeaturePrice = new HotelRoomTypeFeaturePricing(); - - $idProd = 0; - if (isset($params['idRoomType'])) { - $idProd = $params['idRoomType']; - } - - $rates = $objRoomTypeFeaturePrice->getHotelRoomTypesRatesAndInventoryByDate($params['idHotel'], $idProd, $params['dateFrom'], $params['dateTo']); - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('getRoomRatesApi', array()); - foreach ($rates as $datewiseRate) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rate_list', array()); - foreach ($datewiseRate as $attr => $value) { - // how to put line written in else before if and no need to use else condition - if ($attr == 'room_types') { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array()); - foreach ($value as $roomType) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array()); - foreach ($roomType as $roomTypeAttr => $roomTypeData) { - if ($roomTypeAttr == 'rates') { - $roomTypeData['tax_inc'] = $roomTypeData['total_price_tax_incl']; - $roomTypeData['tax_exc'] = $roomTypeData['total_price_tax_excl']; - unset($roomTypeData['total_price_tax_incl']); - unset($roomTypeData['total_price_tax_excl']); - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rate', array()); - foreach ($roomTypeData as $rateAttr => $rate) { - $this->output .= $this->renderField($rateAttr, $rate); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rate', array()); - } else { - $this->output .= $this->renderField($roomTypeAttr, $roomTypeData); - } - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array()); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array()); - } else { - $this->output .= $this->renderField($attr, $value); - } - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rate_list', array()); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('getRoomRatesApi', array()); - return $this->output; - } - - public function updRoomRateAvail($availRateData) - { - $hotelId = $availRateData['Hotel']['id']; - $formatedData = [ - 'propertyId' => $hotelId, - 'data' => [], - ]; - - $rateData = $availRateData['Hotel']['rate_lists']['rate_list']; - - foreach ($rateData as $dateWise) { - $formateSubData = array(); - $formateSubData['dateFrom'] = $dateWise['date_range']['date_from']; - $formateSubData['dateTo'] = $dateWise['date_range']['date_to']; - - if (isset($dateWise['date_range']['RoomTypeLists']['RoomType']['id'])) { - $roomTypeDetail = $dateWise['date_range']['RoomTypeLists']['RoomType']; - - $formateSubData['roomType'][$roomTypeDetail['id']]['status'] = $roomTypeDetail['status']; - if (isset($roomTypeDetail['rate'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['rate'] = $roomTypeDetail['rate']; - } - if (isset($roomTypeDetail['Inventory'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['inventory'] = $roomTypeDetail['Inventory']; - } - } else { - foreach ($dateWise['date_range']['RoomTypeLists']['RoomType'] as $roomTypeDetail) { - $formateSubData['roomType'][$roomTypeDetail['id']]['status'] = $roomTypeDetail['status']; - - if (isset($roomTypeDetail['rate'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['rate'] = $roomTypeDetail['rate']; - } - if (isset($roomTypeDetail['Inventory'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['inventory'] = $roomTypeDetail['Inventory']; - } - } - } - - $formatedData['data'][] = $formateSubData; - } - $objRoomTypeFeaturePrice = new HotelRoomTypeFeaturePricing(); - $objRoomTypeFeaturePrice->updateRoomTypesFeaturePricesAvailability($formatedData); - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('success', array()); - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('success', array()); - - return $this->output; - } - // /** - // * Get address details by id_address - // * - // * @api /getaddress - // * @param int $idAddress - // * @return xml output - // */ - // public function getaddress($idAddress) - // { - // $address = new Address($idAddress); - // if (!Validate::isLoadedObject($address)) { - // return false; - // } - - // // convert object to array - // $address = json_decode(json_encode($address), true); - - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array()); - // $address['country'] = Country::getNameById($this->id_lang, $address['id_country']); - // $address['state'] = State::getNameById($address['id_state']); - // foreach ($address as $key => $addr) { - // $this->output .= $this->renderField($key, $addr); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('address', array()); - // return $this->output; - // } - - // /** - // * [getCustomerAddress description] - // * - // * @api /getcustomeraddress - // * @param int $idCustomer - // * @return xml output - // */ - // public function getCustomerAddress($idCustomer) - // { - // $customer = new Customer($idCustomer); - // if (!Validate::isLoadedObject($customer)) { - // return false; - // } - - // $required = ['id', 'country', 'state', 'alias', 'company', 'lastname', 'firstname', - // 'address1', 'address2', 'postcode', 'city', 'other', 'other', 'phone_mobile', 'phone', 'deleted']; - // $addresses = $customer->getAddresses($this->id_lang); - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('addresses', array()); - // foreach ($addresses as $address) { - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array()); - // $address['id'] = $address['id_address']; - // $address['country'] = Country::getNameById($this->id_lang, $address['id_country']); - // $address['state'] = State::getNameById($address['id_state']); - // foreach ($address as $key => $value) { - // if (in_array($key, $required)) { - // $this->output .= $this->renderField($key, $value); - // } - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('address', array()); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('addresses', array()); - // return $this->output; - // } - - // /** - // * Check is customer have his first address or not - // * - // * @api /checkfirstaddress - // * @param int $idCustomer - // * @return xml message - // */ - // public function checkFirstAddressProcess($idCustomer) - // { - // if (Address::getFirstCustomerAddressId($idCustomer)) { - // return $this->getResult($this->mkmodule->l('Address exist for this customer.', 'mkaddress'), '1'); - // } - - // return $this->getResult($this->mkmodule->l('No address added by this customer yet.', 'mkaddress'), '0'); - // } - - // /** - // * Get required field in address from configuration - // * - // * @return xml node - // */ - // public function addressConfiguration() - // { - // $requiredFields = AddressFormat::getFieldsRequired(); - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('required_fields', array()); - // $this->output .= $this->renderField('phone_config', Configuration::get('PS_ONE_PHONE_AT_LEAST')); - // foreach ($requiredFields as $field) { - // if ($field !== 'Country:name') { - // $this->output .= $this->renderField($field, 1); - // } - // } - - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('required_fields', array()); - // } - - // /** - // * Get country and state list - // * - // * @api /getcountrieswithstates - // * @return [type] [description] - // */ - // public function getCountriesWithStatesProcess() - // { - // $countries = Country::getCountries($this->id_lang, true); - // $this->output .= $this->addressConfiguration(); - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('countries', array()); - // if ($countries) { - // foreach ($countries as $country) { - // // set if default country - // if ($country['id_country'] == Configuration::get('PS_COUNTRY_DEFAULT')) { - // $country['is_default'] = 1; - // } else { - // $country['is_default'] = 0; - // } - // // check if company field exist - // if ($this->isCompanyFieldAvailable($country['id_country'])) { - // $country['is_company'] = 1; - // } else { - // $country['is_company'] = 0; - // } - - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('country', array()); - // $country['country_name'] = $country['country']; - // unset($country['country']); - // foreach ($country as $k => $c) { - // if ($k == 'states') { - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader($k, array()); - // foreach ($c as $s) { - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('state', array()); - // foreach ($s as $kkk => $ss) { - // $this->output .= $this->renderField($kkk, $ss); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('state', array()); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter($k, array()); - // } else { - // $this->output .= $this->renderField($k, $c); - // } - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('country', array()); - // } - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('countries', array()); - // return $this->output; - // } - - // /** - // * Is 'company' field available while adding address - // * - // * @param int $idCountry - // * @return boolean - // */ - // public function isCompanyFieldAvailable($idCountry) - // { - // if (in_array('company', AddressFormat::getOrderedAddressFields($idCountry, true, true))) { - // return true; - // } - // return false; - // } -} diff --git a/modules/hotelreservationsystem/classes/QloWebservice.php b/modules/hotelreservationsystem/classes/QloWebservice.php deleted file mode 100644 index 741b10186..000000000 --- a/modules/hotelreservationsystem/classes/QloWebservice.php +++ /dev/null @@ -1,145 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -class QloWebservice -{ - protected $objOutput; - protected $output; - protected $wsObject; - protected $mobikulGlobal; // Remove this - protected $mkGlobal; - protected $mkmodule; - protected $http; - protected $width; - - public function __construct($objOutput = null, $wsObject = null, $output = null) - { - $this->objOutput = $objOutput; - $this->wsObject = $wsObject; - $this->output = $output; - - // Need to remove these three settings, this should be handled by context - // $this->id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); - // $this->id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT'); - // $this->currency = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT')); - - $this->setContext(); - // $this->mkmodule = Module::getInstanceByName('mobikul'); - // $this->mobikulGlobal = new MobikulGlobal($this->id_lang, $objOutput, $wsObject, $output); // Remove this - // $this->mkGlobal = new MobikulGlobal($this->id_lang, $objOutput, $wsObject, $output); - } - - public function setContext() - { - $this->context = Context::getContext(); - - // // Set Customer - // if (isset($this->wsObject->urlFragments['id_customer'])) { - // $this->context->customer = new Customer($this->wsObject->urlFragments['id_customer']); - // } - - // // Set language - // if (isset($this->wsObject->urlFragments['id_lang'])) { - // $language = new Language($this->wsObject->urlFragments['id_lang']); - // if (!Validate::isLoadedObject($language)) { - // $language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - // } - // } else { - // $language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - // } - $language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - $this->context->language = $language; - - // // Set Currency - // if (isset($this->wsObject->urlFragments['id_currency'])) { - // $currency = new Currency($this->wsObject->urlFragments['id_currency']); - // if (!Validate::isLoadedObject($currency)) { - // $language = new Language((int)Configuration::get('PS_CURRENCY_DEFAULT')); - // } - // } else { - // $currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); - // } - $currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); - $this->context->currency = $currency; - } - - public function getResult($message, $status = null, $args = array(), $xml = false) - { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('response', array()); - if ($status !== null) { - $this->output .= $this->renderField('status', $status); - } - - $this->output .= $this->renderField('message', $message); - - if (is_array($args) && !empty($args)) { - foreach ($args as $key => $value) { - $this->output .= $this->renderField($key, $value); - } - } - - if ($xml) { - $this->output .= $xml; - } - - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('response', array()); - return $this->output; - } - - /** - * Create just like PS renderField function in WebServiceOutputXML class - * @todo :: to be mode functional with attributes and others - * @param [type] $nodeName - * @param [type] $value - * @return [type] xml node - */ - public function renderField($nodeName, $value = null) - { - $node_content = ''; - return '<'.$nodeName.'>'.$node_content.''."\n"; - } - - // public function displayPrice($price, $idCurrency = false) - // { - // if ($idCurrency) { - // $this->currency = Currency::getCurrencyInstance($idCurrency); - // } elseif (isset($this->wsObject->urlFragments['id_currency'])) { - // $this->currency = Currency::getCurrencyInstance($this->wsObject->urlFragments['id_currency']); - // } else { - // $this->currency = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT')); - // } - - // $defaultCurrencyInstance = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT')); - // if (Validate::isLoadedObject($this->currency)) { - // $price = Tools::ps_round((float) $price, (int) $this->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); - // $convertedPrice = Tools::convertPrice($price, $this->currency, $defaultCurrencyInstance); - - // return Tools::displayPrice($convertedPrice, $this->currency); - // } else { - // return $price; - // } - // } - - // public function getProductPrice($id_product, $tax = true, $id_product_attribute = null, $decimals = 6, - // $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null) - // { - // return Product::getPriceStatic((int)$id_product, $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity, $force_associated_tax, $id_customer); - // } -} \ No newline at end of file diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php index 3aea55b0c..aca9e3b8a 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php @@ -113,17 +113,18 @@ class RoomTypeServiceProductPrice extends ObjectModel $idHotel, $idProductOption = null, $useTax = null, - $quantity = 1 + $quantity = 1, + $useReduc = true ) { $idHotelAddress = Cart::getIdAddressForTaxCalculation($idProduct, $idHotel); - $price = ProductCore::getPriceStatic( + $price = Product::getPriceStatic( $idProduct, $useTax, $idProductOption, 6, null, false, - true, + $useReduc, $quantity, false, null, diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index f62b0d9ec..60fc62124 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -168,7 +168,7 @@ class ServiceProductCartDetail extends ObjectModel $sql = 'SELECT spc.*, p.`selling_preference_type`, hcbd.`date_from`, spc.`id_cart` as service_id_cart, hcbd.`date_to`, p.`price_calculation_method`, hcbd.`id_product` as `id_product_room_type`'; if (!$getTotalPrice) { - $sql .= ', hbil.`hotel_name` '; + $sql .= ', hbil.`hotel_name`, p.`auto_add_to_cart`, p.`price_addition_type` '; } $sql .= ' FROM `'._DB_PREFIX_.'service_product_cart_detail` spc'; $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = spc.`id_product`)'; @@ -310,6 +310,9 @@ class ServiceProductCartDetail extends ObjectModel 'total_price_tax_excl' => $priceTaxExcl * (int)$product['quantity'] * $numDays, 'cover_img' => $coverImg, 'price_calculation_method' => $product['price_calculation_method'], + 'auto_add_to_cart' => $product['auto_add_to_cart'], + 'price_addition_type' => $product['price_addition_type'], + 'total_price' => ($useTax ? $priceTaxIncl * (int)$product['quantity'] * $numDays : $priceTaxExcl * (int)$product['quantity'] * $numDays), ); if ($product['htl_cart_booking_id']) { @@ -426,7 +429,13 @@ class ServiceProductCartDetail extends ObjectModel $objServiceProductCartDetail->id_product_option = $idProductOption; } - $objServiceProductCartDetail->quantity += $quantity; + $objProduct = new Product((int) $idProduct); + if ($objProduct->allow_multiple_quantity) { + $objServiceProductCartDetail->quantity += $quantity; + } else { + $objServiceProductCartDetail->quantity = 1; + } + if ($objServiceProductCartDetail->save()) { $objCart = new Cart($idCart); return $objCart->updateQty($quantity, $idProduct); @@ -468,7 +477,7 @@ class ServiceProductCartDetail extends ObjectModel if ($quantity) { $removedQuantity = $quantity; $objServiceProductCartDetail->quantity -= $quantity; - if ($objServiceProductCartDetail->quantity) { + if ($objServiceProductCartDetail->quantity > 1) { $updateQunatity = $objServiceProductCartDetail->save(); } else { $updateQunatity = $objServiceProductCartDetail->delete(); diff --git a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php index 604890df7..646b53383 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductOrderDetail.php @@ -95,11 +95,26 @@ class ServiceProductOrderDetail extends ObjectModel $sql .= ' AND od.`selling_preference_type` = '.(int)$sellingPreferenceType; } - $products = Db::getInstance()->executeS($sql); - foreach ($products as $key => $product) { - // Check if this booking as any refund history then enter refund data - if ($refundInfo = OrderReturn::getOrdersReturnDetail($idOrder, 0, 0, $product['id_service_product_order_detail'])) { - $products[$key]['refund_info'] = reset($refundInfo); + if ($products = Db::getInstance()->executeS($sql)) { + $objContext = Context::getContext(); + $defaultImageLink = $objContext->link->getImageLink('', $objContext->language->iso_code.'-default', 'small_default'); + foreach ($products as $key => $product) { + // Check if this booking as any refund history then enter refund data + if ($refundInfo = OrderReturn::getOrdersReturnDetail($idOrder, 0, 0, $product['id_service_product_order_detail'])) { + $products[$key]['refund_info'] = reset($refundInfo); + } + + $products[$key]['cover_image'] = $defaultImageLink; + $products[$key]['allow_multiple_quantity'] = 0; + if (Validate::isLoadedObject($objProduct = new Product((int) $product['id_product'], Configuration::get('PS_LANG_DEFAULT')))) { + $products[$key]['allow_multiple_quantity'] = $objProduct->allow_multiple_quantity; + if ($productCoverImg = Product::getCover($product['id_product'])) { + $products[$key]['cover_image'] = $objContext->link->getImageLink( + $objProduct->link_rewrite[Configuration::get('PS_LANG_DEFAULT')], + $productCoverImg['id_image'], 'small_default' + ); + } + } } } @@ -127,13 +142,15 @@ class ServiceProductOrderDetail extends ObjectModel $sql = 'SELECT spod.*'; if (!$getTotalPrice) { - $sql .= ', hbd.`id_product` as `id_room_type`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`id_product`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`, spod.`id_product` as id_product'; + $sql .= ', hbd.`id_product` as `id_room_type`, od.`product_price_calculation_method`, + hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`, + spod.`id_product` as id_product, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, od.`product_auto_add`, od.`product_price_addition_type`'; } $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON(spod.`id_htl_booking_detail` = hbd.`id`)'; $sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = spod.`id_order_detail`)'; - $sql .= ' WHERE 1'; + $sql .= ' WHERE spod.`id_htl_booking_detail` IS NOT NULL'; if ($idOrder) { $sql .= ' AND spod.`id_order` = '.(int)$idOrder; @@ -210,6 +227,8 @@ class ServiceProductOrderDetail extends ObjectModel 'total_price_tax_incl' => $product['total_price_tax_incl'], 'unit_price_tax_excl' => $product['unit_price_tax_excl'], 'unit_price_tax_incl' => $product['unit_price_tax_incl'], + 'product_auto_add' => $product['product_auto_add'], + 'product_price_addition_type' => $product['product_price_addition_type'], ); } else { $selectedAdditionalServices[$product['id_htl_booking_detail']]['id_order'] = $product['id_order']; @@ -240,6 +259,8 @@ class ServiceProductOrderDetail extends ObjectModel 'total_price_tax_incl' => $product['total_price_tax_incl'], 'unit_price_tax_excl' => $product['unit_price_tax_excl'], 'unit_price_tax_incl' => $product['unit_price_tax_incl'], + 'product_auto_add' => $product['product_auto_add'], + 'product_price_addition_type' => $product['product_price_addition_type'], ), ); } @@ -319,7 +340,7 @@ class ServiceProductOrderDetail extends ObjectModel 'max_quantity' => $product['max_quantity'], 'product_auto_add' => $product['product_auto_add'], 'product_price_addition_type' => $product['product_price_addition_type'], - 'product_price_calculation_method' => $product['product_price_calculation_method'], + 'price_calculation_method' => $product['product_price_calculation_method'], 'unit_price_tax_excl' => $product['unit_price_tax_excl'], 'unit_price_tax_incl' => $product['unit_price_tax_incl'], 'total_price_tax_excl' => $product['total_price_tax_excl'], @@ -346,7 +367,7 @@ class ServiceProductOrderDetail extends ObjectModel 'max_quantity' => $product['max_quantity'], 'product_auto_add' => $product['product_auto_add'], 'product_price_addition_type' => $product['product_price_addition_type'], - 'product_price_calculation_method' => $product['product_price_calculation_method'], + 'price_calculation_method' => $product['product_price_calculation_method'], 'unit_price_tax_excl' => $product['unit_price_tax_excl'], 'unit_price_tax_incl' => $product['unit_price_tax_incl'], 'total_price_tax_excl' => $product['total_price_tax_excl'], diff --git a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php deleted file mode 100644 index 54fd46e89..000000000 --- a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php +++ /dev/null @@ -1,185 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInterface -{ - protected $objOutput; - protected $output; - protected $wsObject; - - public $id_lang; - public $id_customer; - public $id_currency; - public $mobikulGlobal; - - public function __construct() - { - ini_set('memory_limit', '256M'); - $psCurrencyDefault = (int) Configuration::get('PS_CURRENCY_DEFAULT'); - $this->context = Context::getContext(); - $this->id_lang = Configuration::get('PS_LANG_DEFAULT'); - $this->id_currency = $psCurrencyDefault; - $this->currency = Currency::getCurrencyInstance($psCurrencyDefault); - } - - public function setObjectOutput(WebserviceOutputBuilderCore $obj) - { - $this->objOutput = $obj; - return $this; - } - - public function getObjectOutput() - { - return $this->objOutput; - } - - public function setWsObject(WebserviceRequestCore $obj) - { - $this->wsObject = $obj; - return $this; - } - - public function getWsObject() - { - return $this->wsObject; - } - - // written in alphabatical order - public function manage() - { - $this->wsQloCRUD(); - return $this->wsObject->getOutputEnabled(); - } - - protected $allowedMethods = array( - 'getRoomTypes' => array(), - 'getRoomRates' => array(), - 'updRoomRateAvail' => array(), - ); - - public function getContent() - { - if ($this->output != '') { - $outputXML = $this->objOutput->getObjectRender()->overrideContent($this->output); - if (isset($this->wsObject->urlFragments['outputformat']) && $this->wsObject->urlFragments['outputformat'] == 'json') { - $outputXML = simplexml_load_string($outputXML, null, LIBXML_NOCDATA); - $json = json_encode($outputXML); - $content = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($matches) { - return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($matches[1]))); - }, $json); - header('Content-Type: application/json'); - die($content); - } else { - return $outputXML; - } - } - } - - protected function wsQloCRUD() - { - $objQloRoomType = new QloRoomType($this->objOutput, $this->wsObject, $this->output); - - switch ($this->wsObject->method) { - case 'GET': - switch ($this->wsObject->urlSegment[1]) { - case 'getRoomTypes': - if (!isset($this->wsObject->urlFragments['id_hotel'])) { - throw new WebserviceException('You have to set \'id_hotel\' parameter to get a result', array(100, 400)); - } - $this->output .= $objQloRoomType->getRoomType($this->wsObject->urlFragments['id_hotel']); - break; - case 'getRoomRates': - if (!isset($this->wsObject->urlFragments['id_hotel']) ) { - throw new WebserviceException('You have to set \'id_hotel\', \'date_from\' and \'date_to\'parameters to get a result', array(100, 400)); - } - $dateFrom = isset($this->wsObject->urlFragments['date_from']) ? $this->wsObject->urlFragments['date_from'] : date('Y-m-d'); - $dateTo = isset($this->wsObject->urlFragments['date_to']) ? $this->wsObject->urlFragments['date_to'] : date('Y-m-d', strtotime($dateFrom.' + 1 day')); - $kwargs = array( - 'idHotel' => $this->wsObject->urlFragments['id_hotel'], - 'dateFrom' => $dateFrom, - 'dateTo' => $dateTo, - 'idRoomType' => isset($this->wsObject->urlFragments['id_room_type']) ? $this->wsObject->urlFragments['id_room_type'] : 0, - ); - - $this->output .= $objQloRoomType->getRoomRates($kwargs); - break; - - default: - $exception = new WebserviceException(sprintf('Method with name "%s" does not exist in Qlo Library,', $this->wsObject->urlSegment[1]), array(48, 400)); - throw $exception->setDidYouMean($this->wsObject->urlSegment[1], array_keys($this->allowedMethods)); - } - break; - case 'POST': - switch ($this->wsObject->urlSegment[1]) { - case 'updRoomRateAvail': - $fields = $this->getXMLFields('updRoomRateAvail'); - - if (!isset($fields)) { - throw new WebserviceException('Send XML formated data', array(100, 400)); - } - $this->output .= $objQloRoomType->updRoomRateAvail($fields); - break; - } - break; - default : - throw new WebserviceException('This HTTP method is not allowed', array(67, 405)); - } - } - - public function getXMLFields($head = false) - { - $putresource = fopen('php://input', 'r'); - $inputXML = ''; - while ($putData = fread($putresource, 1024)) { - $inputXML .= $putData; - } - fclose($putresource); - - // If xml - if (simplexml_load_string($inputXML)) { - if (isset($inputXML) && strncmp($inputXML, 'xml=', 4) == 0) { - $inputXML = Tools::substr($inputXML, 4); - } - } else { - // If input type is json - $array = json_decode($inputXML, true); - if (isset($array['json']) && $array['json'] && isset($array[$head])) { - return ($head ? $array[$head] : $array); - } else { - WebserviceRequest::getInstance()->setError(500, 'Invalid json.', 127); - return; - } - } - - try { - $xml = new SimpleXMLElement($inputXML); - } catch (Exception $error) { - WebserviceRequest::getInstance()->setError(500, 'XML error : '.$error->getMessage()."\n".'XML length : '.Tools::strlen($inputXML)."\n".'Original XML : '.$inputXML, 127); - - return; - } - - $xmlEntities = $xml->children(); - // Convert multi-dimention xml into an array - $array = json_decode(json_encode($xmlEntities), true); - - return ($head ? $array[$head] : $array); - } -} diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php index adad61851..2088899a7 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php @@ -143,12 +143,25 @@ class AdminHotelBedTypesController extends ModuleAdminController return; } - if (!trim(Tools::getValue('width'))) { - $this->errors[] = $this->l('Field Width is required'); + $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); + $objDefaultLanguage = Language::getLanguage((int) $defaultLangId); + $languages = Language::getLanguages(false); + if (!trim(Tools::getValue('name_'.$defaultLangId))) { + $this->errors[] = $this->l('Bed type name is required at least in ').$objDefaultLanguage['name']; + } else { + foreach ($languages as $lang) { + if (trim(Tools::getValue('name_'.$lang['id_lang'])) && !Validate::isGenericName(Tools::getValue('name_'.$lang['id_lang']))) { + $this->errors[] = $this->l('Invalid bed type name in ').$lang['name']; + } + } } - if (!trim(Tools::getValue('length'))) { - $this->errors[] = $this->l('Field Length is required'); + if (!(float) Tools::getValue('width')) { + $this->errors[] = $this->l('The width field is required'); + } + + if (!(float) Tools::getValue('length')) { + $this->errors[] = $this->l('The length field is required'); } return parent::processSave(); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 73ca69f0a..3dbc04a8e 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -36,7 +36,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $this->allow_export = true; $this->_new_list_header_design = true; if ($idOrder = Tools::getValue('id_order')) { - $this->_select .= ', orsl.`name` as `status_name`, ors.`color`, COUNT(ordrd.`id_order_return_detail`) as num_rooms'; + $this->_select .= ', orsl.`name` as `status_name`, ors.`color`, SUM(IF((ordrd.id_htl_booking != 0) , 1, 0)) as num_rooms, SUM(IF((ordrd.id_service_product_order_detail != 0) , 1, 0)) as num_products'; $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state ors ON (ors.`id_order_return_state` = a.`state`)'; $this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')'; $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ordrd ON (a.`id_order_return` = ordrd.`id_order_return`)'; @@ -60,6 +60,11 @@ class AdminOrderRefundRequestsController extends ModuleAdminController if ($idOrder = Tools::getValue('id_order')) { $refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id); + // to set columns for products and rooms count in render list + $objOrderReturn = new OrderReturn(); + $refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($idOrder); + $refundReqProducts = $objOrderReturn->getOrderRefundRequestedProducts($idOrder); + $retStatuses = array(); foreach ($refundStatuses as $status) { $retStatuses[$status['id_order_return_state']] = $status['name']; @@ -82,11 +87,21 @@ class AdminOrderRefundRequestsController extends ModuleAdminController 'havingFilter' => true, 'callback' => 'setCustomerLink', ); - $this->fields_list['num_rooms'] = array( - 'title' => $this->l('Total Rooms'), - 'align' => 'center', - 'havingFilter' => true, - ); + + if ($refundReqBookings) { + $this->fields_list['num_rooms'] = array( + 'title' => $this->l('Total Rooms'), + 'align' => 'center', + 'havingFilter' => true, + ); + } + if ($refundReqProducts) { + $this->fields_list['num_products'] = array( + 'title' => $this->l('Total Products'), + 'align' => 'center', + 'havingFilter' => true, + ); + } $this->fields_list['refunded_amount'] = array( 'title' => $this->l('Refunded Amount'), 'align' => 'center', @@ -299,9 +314,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController } } - if ($refundReqProducts = $objOrderReturn->getOrderRefundRequestedProducts($objOrderReturn->id_order, $objOrderReturn->id)){ - } - + $refundReqProducts = $objOrderReturn->getOrderRefundRequestedProducts($objOrderReturn->id_order, $objOrderReturn->id); $paymentMethods = array(); foreach (PaymentModule::getInstalledPaymentModules() as $payment) { diff --git a/modules/hotelreservationsystem/define.php b/modules/hotelreservationsystem/define.php index f45b141d4..78316bc6d 100644 --- a/modules/hotelreservationsystem/define.php +++ b/modules/hotelreservationsystem/define.php @@ -41,8 +41,6 @@ require_once 'classes/HotelRoomTypeDemandPrice.php'; require_once 'classes/HotelRoomTypeDemand.php'; require_once 'classes/HotelRoomTypeRestrictionDateRange.php'; -require_once 'classes/QloWebservice.php'; -require_once 'classes/QloRoomType.php'; require_once 'classes/HotelRoomDisableDates.php'; require_once 'classes/HotelBranchRefundRules.php'; require_once 'classes/HotelBedType.php'; @@ -60,5 +58,4 @@ require_once 'classes/HotelSettingsLink.php'; require_once 'classes/HotelBookingDocument.php'; // Web services classes -require_once 'classes/WebserviceSpecificManagementQlo.php'; require_once 'classes/WebserviceSpecificManagementHotelAri.php'; diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index b5e1dca79..aef7e9e07 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -54,10 +54,8 @@ class HotelReservationSystem extends Module 'room_bookings' => array('description' => 'Room bookings', 'class' => 'HotelBookingDetail'), 'booking_extra_demands' => array('description' => 'Booking extra demands', 'class' => 'HotelBookingDemands'), 'extra_demands' => array('description' => 'Extra demands', 'class' => 'HotelRoomTypeGlobalDemand'), - 'extra_services' => array('description' => 'Extra services', 'class' => 'Product', 'parameters_attribute' => 'webserviceRoomTypeServicesParameters'), 'demand_advance_options' => array('description' => 'Extra demand advance options', 'class' => 'HotelRoomTypeGlobalDemandAdvanceOption'), 'hotel_ari' => array('description' => 'Search availability, rates and inventory', 'specific_management' => true), - 'qlo' => array('description' => 'qlo API', 'specific_management' => true), ); return $resources; @@ -510,6 +508,7 @@ class HotelReservationSystem extends Module 'htl_room_type_global_demand_advance_option', 'htl_order_refund_rules', 'htl_settings_link', + 'htl_bed_type' ); //If Admin update new language when we do entry in module all lang tables. HotelHelper::updateLangTables($newIdLang, $langTables); 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 934e9deae..d8cadf9e9 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 @@ -81,14 +81,26 @@ {displayPrice price=$orderTotalPaid currency=$orderInfo['id_currency']}
-
-
- {l s='Total rooms' mod='hotelreservationsystem'} : -
-
- {$refundReqBookings|count} -
-
+ {if isset($refundReqBookings) && $refundReqBookings} +
+
+ {l s='Total rooms' mod='hotelreservationsystem'} : +
+
+ {$refundReqBookings|count} +
+
+ {/if} + {if isset($refundReqProducts) && $refundReqProducts} +
+
+ {l s='Total products' mod='hotelreservationsystem'} : +
+
+ {$refundReqProducts|count} +
+
+ {/if}
{l s='Way of payment' mod='hotelreservationsystem'} : @@ -263,7 +275,7 @@ {/if} {$product['name']|escape:'htmlall':'UTF-8'}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']|escape:'htmlall':'UTF-8'}{/if} - {$product['quantity']|escape:'htmlall':'UTF-8'} + {if $product['allow_multiple_quantity']}{$product['quantity']|escape:'htmlall':'UTF-8'}{else}--{/if} {displayPrice price=$product['total_price_tax_incl'] currency=$orderCurrency['id']} {displayPrice price=$product['paid_amount'] currency=$orderCurrency['id']} {if $hasOrderDiscountOrPayment || $isRefundCompleted} diff --git a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js index 14aa1b5ec..c4a55a5be 100644 --- a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js +++ b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js @@ -41,8 +41,8 @@ $(document).ready(function() $("#filter_price_silder").slider("values", [min_price, max_price]); var slider_price_cont = filter_wrapper.find("div.price_filter_subcont"); - slider_price_cont.find("span#filter_price_from").html(min_price); - slider_price_cont.find("span#filter_price_to").html(max_price); + slider_price_cont.find("span#filter_price_from").html(formatCurrency(min_price, currencyFormat, currencySign, currencyBlank)); + slider_price_cont.find("span#filter_price_to").html(formatCurrency(max_price, currencyFormat, currencySign, currencyBlank)); /* -------NOTICE------- */ //triggerFilter(); diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php index 2c50393fc..05ebde0cb 100644 --- a/modules/wkhotelfilterblock/wkhotelfilterblock.php +++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php @@ -192,7 +192,7 @@ class wkhotelfilterblock extends Module if (!($date_to = Tools::getValue('date_to'))) { $date_to = date('Y-m-d H:i:s', strtotime($date_from) + 86400); } else { - $urlData['date_from'] = $date_to; + $urlData['date_to'] = $date_to; } if ($occupancy = Tools::getValue('occupancy')) { diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php index 16b514066..107053862 100644 --- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php +++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php @@ -192,8 +192,6 @@ class WkRoomSearchHelper $searchedData['order_date_restrict'] = true; } } - - $smartyVars['search_data'] = $searchedData; } if ($occupancyEnabled) { diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 0c12eb857..586de6f89 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -388,10 +388,11 @@ $(document).ready(function() { start_date.setHours(0, 0, 0, 0); } - let selectedDateFrom = new Date(Date.parse(dateFrom)); - let selectedDateTo = new Date(Date.parse(dateTo)); + // Using the Date object will also add extra hours according to the timezone. + let selectedDateFrom = $.datepicker.parseDate('yy-mm-dd', dateFrom); + let selectedDateTo = $.datepicker.parseDate('yy-mm-dd', dateTo); if (max_order_date) { - max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date ); + max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date); } else { max_order_date = false; } diff --git a/pdf/invoice.addresses-tab.tpl b/pdf/invoice.addresses-tab.tpl index fe6efc706..df5e70de0 100644 --- a/pdf/invoice.addresses-tab.tpl +++ b/pdf/invoice.addresses-tab.tpl @@ -32,8 +32,8 @@ {/if} --> - {l s='Hotel Detail' pdf='true'}

- {if $hotel_address} + {if !empty($hotel_address)} + {l s='Hotel Detail' pdf='true'}

{$hotel_address} {/if} diff --git a/pdf/invoice.product-tab.tpl b/pdf/invoice.product-tab.tpl index cc38c3c6e..d31799c1f 100644 --- a/pdf/invoice.product-tab.tpl +++ b/pdf/invoice.product-tab.tpl @@ -24,7 +24,7 @@ *} {if isset($cart_htl_data) && $cart_htl_data} - +
@@ -50,7 +50,7 @@ {foreach from=$cart_htl_data key=data_k item=data_v} {foreach from=$data_v['date_diff'] key=rm_k item=rm_v} {cycle values=["color_line_even", "color_line_odd"] assign=bgcolor_class} - + {if $display_product_images} {foreach $service_product_data as $product} {cycle values=["color_line_even", "color_line_odd"] assign=bgcolor_class} - + {if $display_product_images} - {/if} diff --git a/pdf/order-slip.product-tab.tpl b/pdf/order-slip.product-tab.tpl index c5bd214b9..6ba4979dc 100644 --- a/pdf/order-slip.product-tab.tpl +++ b/pdf/order-slip.product-tab.tpl @@ -27,7 +27,7 @@
{l s='Rooms Details' pdf='true'}
diff --git a/pdf/invoice.service-product-tab.tpl b/pdf/invoice.service-product-tab.tpl index 7ab0b1774..f9852c177 100644 --- a/pdf/invoice.service-product-tab.tpl +++ b/pdf/invoice.service-product-tab.tpl @@ -42,11 +42,11 @@
- {if isset($product.image) && $product.image->id} - {$product.image_tag} + + {if isset($product['cover_image']) && $product['cover_image']} + {/if}
- + diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index 89d45595d..1a592f740 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -280,12 +280,12 @@

+ {if $service_price && $service_price_without_reduction > $service_price} + + {convertPrice price=$service_price_without_reduction|floatval} + + {/if} {convertPrice price=$service_price} - {* {if !$priceDisplay || $priceDisplay == 2} - {convertPrice price=$product->getPrice(true, $smarty.const.NULL, 6)|floatval} - {elseif $priceDisplay == 1} - {convertPrice price=$product->getPrice(false, $smarty.const.NULL, 6)|floatval} - {/if} *}

{/block} diff --git a/themes/hotel-reservation-theme/_partials/order-hotel-service-detail.tpl b/themes/hotel-reservation-theme/_partials/order-hotel-service-detail.tpl index 105c32bad..52a693211 100644 --- a/themes/hotel-reservation-theme/_partials/order-hotel-service-detail.tpl +++ b/themes/hotel-reservation-theme/_partials/order-hotel-service-detail.tpl @@ -52,12 +52,14 @@
-
-
-
{l s='Quantity'}
-
{$product.quantity}
+ {if $product.allow_multiple_quantity} +
+
+
{l s='Quantity'}
+
{$product.quantity}
+
-
+ {/if}
{l s='Unit Price'}
@@ -72,8 +74,10 @@
-
-
+ {if $product.allow_multiple_quantity} +
+
+ {/if}
{l s='Total Pricing'}
diff --git a/themes/hotel-reservation-theme/_partials/order-message.tpl b/themes/hotel-reservation-theme/_partials/order-message.tpl index 70192c1fd..c0df989c2 100644 --- a/themes/hotel-reservation-theme/_partials/order-message.tpl +++ b/themes/hotel-reservation-theme/_partials/order-message.tpl @@ -23,7 +23,15 @@
{if $message.id_employee} - {$obj_hotel_branch_information->hotel_name|escape:'html':'UTF-8'} + {if isset($obj_hotel_branch_information->hotel_name) && $obj_hotel_branch_information->hotel_name} + {$obj_hotel_branch_information->hotel_name|escape:'html':'UTF-8'} + {elseif isset($message.elastname) && $message.elastname} + {$message.efirstname|escape:'html':'UTF-8'} {$message.elastname|escape:'html':'UTF-8'} + {elseif $message.clastname} + {$message.cfirstname|escape:'html':'UTF-8'} {$message.clastname|escape:'html':'UTF-8'} + {else} + {$shop_name|escape:'html':'UTF-8'} + {/if} {else} {$message.cfirstname|escape:'html':'UTF-8'} {$message.clastname|escape:'html':'UTF-8'} {/if} diff --git a/themes/hotel-reservation-theme/_partials/order-standalone-service-detail.tpl b/themes/hotel-reservation-theme/_partials/order-standalone-service-detail.tpl index 341d073c2..7c538ddc1 100644 --- a/themes/hotel-reservation-theme/_partials/order-standalone-service-detail.tpl +++ b/themes/hotel-reservation-theme/_partials/order-standalone-service-detail.tpl @@ -52,12 +52,14 @@
-
-
-
{l s='Quantity'}
-
{$product.quantity}
+ {if $product.allow_multiple_quantity} +
+
+
{l s='Quantity'}
+
{$product.quantity}
+
-
+ {/if}
{l s='Unit Price'}
@@ -72,8 +74,10 @@
-
-
+ {if $product.allow_multiple_quantity} +
+
+ {/if}
{l s='Total Pricing'}
diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 5613be05c..0eaf739ce 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -20,9 +20,9 @@ {block name='displayRoomTypeListBefore'} {hook h='displayRoomTypeListBefore'} {/block} -{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types && isset($booking_data['rm_data'])} +{if !empty($booking_data['rm_data']) && (isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || !empty($display_all_room_types))} {foreach from=$booking_data['rm_data'] key=room_k item=room_v} - {if $room_v['data']['available']|count || isset($display_all_room_types) && $display_all_room_types } + {if $room_v['data']['available']|count || !empty($display_all_room_types) }
{block name='room_type_list_room_image'} @@ -41,7 +41,7 @@

{$room_v['name']|escape:'htmlall':'UTF-8'}

{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict} -

$warning_num} style="display:none"{/if}> +

$warning_num} style="display:none"{/if}> {l s='Hurry!'} {$room_v['room_left']|escape:'htmlall':'UTF-8'} {l s='rooms left'}

{/if} 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 6b4507e92..47836bee8 100644 --- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js +++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js @@ -901,15 +901,19 @@ var ajaxCart = { content += '
'; } content += '
'; - content += '' + total_qty_txt + ':'; + if (product.booking_product || product.allow_multiple_quantity) { + content += '' + total_qty_txt + ':'; + } content += ''; content += ''; if (product.booking_product) { content += product.bookingData.total_num_rooms; - } else if (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.total_qty) { - content += hotel_wise_data.total_qty; - } else { - content += product.cart_quantity; + } else if (product.allow_multiple_quantity) { + if (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.total_qty) { + content += hotel_wise_data.total_qty; + } else { + content += product.cart_quantity; + } } content += ''; content += ''; @@ -1186,6 +1190,7 @@ var ajaxCart = { product.date_from + ' - ' + product.date_to ); $('#layer_cart_product_hotel_name').parent().hide(); + $('#layer_cart_product_quantity').parent().show(); var product_quantity_text = ''; if(parseInt(product.booking_product)) { let rooms = 0; @@ -1202,7 +1207,11 @@ var ajaxCart = { product_quantity_text = product.occupancy; } } else { - product_quantity_text = product.qty; + if (product.allow_multiple_quantity) { + product_quantity_text = product.qty; + } else { + $('#layer_cart_product_quantity').parent().hide(); + } $('#layer_cart_product_unit_price').text(product.unit_price); if (product.hotel_name) { $('#layer_cart_product_hotel_name').text(product.hotel_name).parent().show(); diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index 5855055de..854f90fbb 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -118,14 +118,12 @@ $(document).ready(function() validateCustomerGuestDetailForm(); } $(document).on('click', '.submit-guest-details', function(e) { - e.preventDefault(); if ($('#customer_guest_detail').prop('checked')) { validateCustomerGuestDetailForm(); + e.preventDefault(); if ($('#customer_guest_detail_form').find('.form-error').length == 0) { $('#customer_guest_detail_form').get(0).submit(); } - } else { - $('#customer_guest_detail_form').get(0).submit(); } }); diff --git a/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl b/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl index 2e0e5ac52..6a1e9ee54 100644 --- a/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl +++ b/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl @@ -48,11 +48,11 @@ {block name='blockcart_shopping_cart_product_quantity'}
- {l s='Total Qty.' mod='blockcart'}: + {if $product.allow_multiple_quantity || $product.booking_product}{l s='Total Qty.' mod='blockcart'}:{/if} {if $product.booking_product} {$product.bookingData['total_num_rooms']} - {else} + {elseif $product.allow_multiple_quantity} {if $product.selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE || $product.selling_preference_type == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE} {$hotel_wise_data.total_qty} {elseif $product.selling_preference_type == Product::SELLING_PREFERENCE_STANDALONE} @@ -65,7 +65,7 @@
{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)} -   +   {/if}
diff --git a/themes/hotel-reservation-theme/order-confirmation.tpl b/themes/hotel-reservation-theme/order-confirmation.tpl index d23fbf032..e8cc450cc 100644 --- a/themes/hotel-reservation-theme/order-confirmation.tpl +++ b/themes/hotel-reservation-theme/order-confirmation.tpl @@ -241,12 +241,14 @@
-
-
-
{l s='Quantity'}
-
{$product.product_quantity}
+ {if $product.allow_multiple_quantity} +
+
+
{l s='Quantity'}
+
{$product.product_quantity}
+
-
+ {/if}
{l s='Unit Price'}
@@ -261,8 +263,10 @@
-
-
+ {if $product.allow_multiple_quantity} +
+
+ {/if}
{l s='Total Pricing'}
@@ -311,12 +315,14 @@
-
-
-
{l s='Quantity'}
-
{$product.product_quantity}
+ {if $product.allow_multiple_quantity} +
+
+
{l s='Quantity'}
+
{$product.product_quantity}
+
-
+ {/if}
{l s='Unit Price'}
@@ -331,8 +337,10 @@
-
-
+ {if $product.allow_multiple_quantity} +
+
+ {/if}
{l s='Total Pricing'}
@@ -414,46 +422,32 @@
{l s='Room Bookings Detail' pdf='true'}{l s='Room Bookings Detail' pdf='true'}
{l s='Room Type / Reference' pdf='true'}
{if isset($cart_htl_data)} - {if $priceDisplay && $use_tax} - - - + + - - {else} - - - - - {/if} + {/if} + + {/if} {if (isset($cart_standalone_service_products) && $cart_standalone_service_products) || (isset($cart_hotel_service_products) && $cart_hotel_service_products)} - {if $priceDisplay && $use_tax} - - - + + - - {else} - - - - - {/if} + {/if} + + {/if} {if $order->total_wrapping > 0} @@ -465,22 +459,17 @@ {/if} - {if $priceDisplay && $use_tax && $orderTotalInfo['total_convenience_fee_te']} + {if $orderTotalInfo['total_convenience_fee_te'] || $orderTotalInfo['total_convenience_fee_ti']} - - {else if $orderTotalInfo['total_convenience_fee_ti']} - - - {/if} diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index ba6956f60..9402a240d 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -326,57 +326,39 @@ {assign var=total_standard_products_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE) + $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE))} {assign var=total_standard_products_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE) + $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE))} {if isset($cart_htl_data) && $cart_htl_data} - {if $priceDisplay && $use_tax && $room_price_tax_excl} - - - - - {else} - - - - - {/if} - {/if} - - {if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)} - {if $priceDisplay && $use_tax} - - - - - {else} - - - - - {/if} - {/if} - - {if $priceDisplay && $use_tax && $total_convenience_fee_te} - + - {else if $total_convenience_fee_ti} - - + {/if} + {if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)} + + + + {/if} + + {if $total_convenience_fee_te || $total_convenience_fee_te} + + + {/if} @@ -595,18 +577,28 @@ {block name='order_detail_add_order_messages_form'}
- +

- {l s='To add a comment about a room type, please select one first.'} + {if $service_products_formatted} + {l s='To add a comment about a room type/product, please select one first.'} + {else} + {l s='To add a comment about a room type, please select one first.'} + {/if}

-
@@ -743,57 +735,39 @@ {assign var=total_tax_without_discount value=(($room_price_tax_incl - $room_price_tax_excl) + ($room_services_price_tax_incl - $room_services_price_tax_excl) + ($total_standard_products_tax_incl - $total_standard_products_tax_excl))} {if isset($cart_htl_data) && $cart_htl_data} - {if $priceDisplay && $use_tax && $room_price_tax_excl} -
- - - - {else} - - - - - {/if} - {/if} - - {if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)} - {if $priceDisplay && $use_tax} - - - - - {else} - - - - - {/if} - {/if} - - {if $priceDisplay && $use_tax && $total_convenience_fee_te} - + - {else if $total_convenience_fee_ti} - - + {/if} + {if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)} + + + + {/if} + + {if $total_convenience_fee_te || $total_convenience_fee_te} + + + {/if} @@ -1065,9 +1039,11 @@ {if $product_option.is_cancelled}{l s='Cancelled'}{else if $product_option.is_refunded}{l s='Refunded'}{else if isset($product_option.refund_denied) && $product_option.refund_denied}{l s='Refund denied'} {/if} -
- {l s='Quantity'} : {$product_option.quantity} -
+ {if $product_option.allow_multiple_quantity} +
+ {l s='Quantity'} : {$product_option.quantity} +
+ {/if} {/foreach} diff --git a/themes/hotel-reservation-theme/order-follow.tpl b/themes/hotel-reservation-theme/order-follow.tpl index 85b8edf87..2fbe89e60 100644 --- a/themes/hotel-reservation-theme/order-follow.tpl +++ b/themes/hotel-reservation-theme/order-follow.tpl @@ -47,7 +47,12 @@
- + {if isset($hasRoomRefunds) && $hasRoomRefunds} + + {/if} + {if isset($hasProductRefunds) && $hasProductRefunds} + + {/if} @@ -59,9 +64,16 @@ - + {if isset($hasRoomRefunds) && $hasRoomRefunds} + + {/if} + {if isset($hasProductRefunds) && $hasProductRefunds} + + {/if} diff --git a/themes/hotel-reservation-theme/order-return.tpl b/themes/hotel-reservation-theme/order-return.tpl index 82dcd69b8..4ef1909b3 100644 --- a/themes/hotel-reservation-theme/order-return.tpl +++ b/themes/hotel-reservation-theme/order-return.tpl @@ -53,6 +53,9 @@ {/block} {block name='order_return_detail'} {if $refundReqBookings} + {if isset($refundReqProducts) && $refundReqProducts} +

{l s='Rooms refund requests'}

+ {/if}
- {l s='Total Rooms Cost (tax excl.)'} - +
+ {l s='Total Rooms Cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if} + + {if $priceDisplay && $use_tax} {displayWtPriceWithCurrency price=($orderTotalInfo['total_rooms_te'] + $orderTotalInfo['total_services_te'] + $orderTotalInfo['total_auto_add_services_te'] + $orderTotalInfo['total_demands_price_te']) currency=$objOrderCurrency} -
- {l s='Total Rooms Cost'} {if $use_tax}{l s='(tax incl.)'}{/if} - + {else} {displayWtPriceWithCurrency price=($orderTotalInfo['total_rooms_ti'] + $orderTotalInfo['total_services_ti'] + $orderTotalInfo['total_auto_add_services_ti'] + $orderTotalInfo['total_demands_price_ti']) currency=$objOrderCurrency} -
- {l s='Total products cost (tax excl.)'} - +
+ {l s='Total products cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if} + + {if $priceDisplay && $use_tax} {displayWtPriceWithCurrency price=$orderTotalInfo['total_standalone_products_te'] currency=$objOrderCurrency} -
- {l s='Total products cost'} {if $use_tax}{l s='(tax incl.)'}{/if} - + {else} {displayWtPriceWithCurrency price=$orderTotalInfo['total_standalone_products_ti'] currency=$objOrderCurrency} -
- {l s='Total Convenience Fees (tax excl.)'} + {l s='Total Convenience Fees'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if} - {displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_te']) currency=$objOrderCurrency} -
- {l s='Total Convenience Fees'} {if $use_tax}{l s='(tax incl.)'}{/if} - - {displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_ti']) currency=$objOrderCurrency} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_te']) currency=$objOrderCurrency} + {else} + {displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_ti']) currency=$objOrderCurrency} + {/if}
{l s='Total rooms cost (tax excl.)'} - {displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency} -
{l s='Total Rooms Cost'} {if $use_tax}{l s='(tax incl.)'}{/if} - {displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency} -
- {l s='Total products cost (tax excl.)'} - - {displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency} -
- {l s='Total products cost'} {if $use_tax}{l s='(tax incl.)'}{/if} - - {displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency} -
{l s='Total Convenience Fees (tax excl.)'}{l s='Total rooms cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if} - {displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency} + {else} + {displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency} + {/if}
{l s='Total Convenience Fees (tax incl.)'}
{l s='Total products cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if} - {displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency} + {else} + {displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency} + {/if} +
{l s='Total Convenience Fees'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency} + {else} + {displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency} + {/if}
{l s='Total rooms cost (tax excl.)'} - {displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency} -
{l s='Total Rooms Cost'} {if $use_tax}{l s='(tax incl.)'}{/if} - {displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency} -
- {l s='Total products cost (tax excl.)'} - - {displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency} -
- {l s='Total products cost'} {if $use_tax}{l s='(tax incl.)'}{/if} - - {displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency} -
{l s='Total Convenience Fees (tax excl.)'}{l s='Total rooms cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if} - {displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency} + {else} + {displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency} + {/if}
{l s='Total Convenience Fees (tax incl.)'}
{l s='Total products cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if} - {displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency} + {else} + {displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency} + {/if} +
{l s='Total Convenience Fees'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if} + {if $priceDisplay && $use_tax} + {displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency} + {else} + {displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency} + {/if}
{l s='Order'}{l s='Total rooms'}{l s='Total rooms'}{l s='Total products'}{l s='Refund status'} {l s='Date requested'} {l s='Actions'} #{$return.reference|escape:'html':'UTF-8'} - {$return.total_rooms|escape:'html':'UTF-8'} - + {$return.total_rooms|escape:'html':'UTF-8'} + + {$return.total_products|escape:'html':'UTF-8'} + {$return.state_name|escape:'html':'UTF-8'}
@@ -97,12 +100,13 @@ {/if} {if $refundReqProducts} +

{l s='Products refund requests'}

- + - + {if $isRefundCompleted} @@ -111,7 +115,7 @@ {foreach from=$refundReqProducts item=$product name=refundRequest} - + {if $isRefundCompleted}
{l s='Name'}{l s='Product name'} {l s='Quantity'}{l s='Total rooms price (tax incl.)'}{l s='Total price (tax incl.)'}{l s='Refund amount'} {l s='Refund Status'}
{$product['name']|escape:'htmlall':'UTF-8'}{if isset($product['option_name']) && $product['option_name']} : {$product['option_name']}{/if}{$product['quantity']|escape:'htmlall':'UTF-8'}{if $product['allow_multiple_quantity']}{$product['quantity']|escape:'htmlall':'UTF-8'}{else}--{/if} {displayPrice price=$product['total_price_tax_incl'] currency=$orderCurrency['id']} diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl index 06a16a8eb..351edf8f8 100644 --- a/themes/hotel-reservation-theme/product.tpl +++ b/themes/hotel-reservation-theme/product.tpl @@ -217,7 +217,7 @@ {if isset($id_hotel) && $id_hotel}
  • {l s='Refund Policies'}
  • {/if} - {if $display_google_maps && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)} + {if $display_google_maps && !empty($hotel_latitude) && !empty($hotel_longitude) && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)}
  • {l s='View on Map'}
  • {/if} {block name='displayProductTab'} @@ -399,7 +399,7 @@ {/if} {/block} {block name='product_map_tab_content'} - {if $display_google_maps && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)} + {if $display_google_maps && !empty($hotel_latitude) && !empty($hotel_longitude) && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)}
    -
    -
    +
    +

    {if $priceDisplay}{displayPrice price=($product['unit_price_tax_excl'])}{else}{displayPrice price=($product['unit_price_tax_incl'])}{/if} @@ -251,35 +251,26 @@ {l s='Unit price'} {if $display_tax_label}{if $priceDisplay} {l s='(Excl.'} {else}{l s='(Incl.)'}{/if} {l s='all taxes.)'}{/if}

    -
    -
    -
    - - -
    - - {if $product.minimal_quantity < ($product.quantity)} - - - - {else} - - - - {/if} - + {if $product.allow_multiple_quantity} +
    +
    + + +
    + + {if $product.minimal_quantity < ($product.quantity)} + + + + {else} + + + + {/if} +
    +
    -
    - {*
    -

    - - {if $product['quantity'] <= 9}0{$product['quantity']}{else}{$product['quantity']}{/if} - -

    -

    - {l s='Total Qty'} -

    -
    *} + {/if}
    @@ -370,17 +361,6 @@
    - - {*
    -

    - - {if $product['quantity'] <= 9}0{$product['quantity']}{else}{$product['quantity']}{/if} - -

    -

    - {l s='Total Qty'} -

    -
    *}
    {/if}