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/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 1f3bd2ad1..ee9e51d0b 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1751,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 @@ -1758,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/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/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 173ceef08..fa9c3abfa 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1321,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'); 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/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 01ebd7049..2550608bc 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -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 028976d07..934edf868 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) @@ -2024,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); @@ -2849,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'); @@ -3266,7 +3297,7 @@ class AdminOrdersControllerCore extends AdminController 0, 0, null, - 0, + null, null, 0, $value['id'] @@ -6125,6 +6156,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(); } @@ -6221,7 +6255,7 @@ class AdminOrdersControllerCore extends AdminController 0, 1, 1, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -6237,7 +6271,7 @@ class AdminOrdersControllerCore extends AdminController 0, 1, 0, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -6253,7 +6287,7 @@ class AdminOrdersControllerCore extends AdminController 0, 0, null, - 0, + null, // to get the auto added services. null, 0, $idHotelBooking @@ -7662,7 +7696,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/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/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/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 0d6587674..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']) { 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/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/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 2a181cdf3..aef7e9e07 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -508,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/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/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/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 64db52cf3..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'}
diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index afce9c6a0..9402a240d 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -577,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}

-
@@ -1029,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='Room Bookings Detail' pdf='true'}{l s='Room Bookings Detail' pdf='true'}
{l s='Room Type / Reference' pdf='true'}
{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}