From e88faa7fd42975cb5e1ba1fbe1bcca2784cb1ca2 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Wed, 21 Jan 2026 19:19:11 +0530 Subject: [PATCH 01/66] Vulnerability issue while uploading code updated --- modules/qlohotelreview/classes/QhrHotelReview.php | 4 ++++ modules/qlohotelreview/controllers/front/default.php | 2 +- modules/qlohotelreview/views/js/hook/review.js | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/qlohotelreview/classes/QhrHotelReview.php b/modules/qlohotelreview/classes/QhrHotelReview.php index 8768061d2..70ef425ed 100644 --- a/modules/qlohotelreview/classes/QhrHotelReview.php +++ b/modules/qlohotelreview/classes/QhrHotelReview.php @@ -290,9 +290,13 @@ class QhrHotelReview extends ObjectModel public function saveReviewImages() { $files = QhrHotelReviewHelper::fileAttachmentMultiple('images'); + $allowedExtensions = array('jpg', 'png', 'jpeg',); if (is_array($files) && count($files)) { foreach ($files as $key => $file) { $ext = pathinfo($file['rename'], PATHINFO_EXTENSION); + if (!in_array($ext, $allowedExtensions, true)) { + continue; + } $dir = _PS_MODULE_DIR_.'qlohotelreview/views/img/review/'.Image::getImgFolderStatic($this->id); QhrHotelReviewHelper::createDirectory($dir); $useSameExt = false; diff --git a/modules/qlohotelreview/controllers/front/default.php b/modules/qlohotelreview/controllers/front/default.php index c380cd5f7..899428526 100644 --- a/modules/qlohotelreview/controllers/front/default.php +++ b/modules/qlohotelreview/controllers/front/default.php @@ -86,7 +86,7 @@ class QloHotelReviewDefaultModuleFrontController extends ModuleFrontController } if (is_array($_FILES) && array_key_exists('images', $_FILES) ) { - $allowedExtensions = array('jpg', 'png'); + $allowedExtensions = array('jpg', 'png', 'jpeg',); foreach ($_FILES['images']['name'] as $key => $imageName) { $extension = Tools::strtolower(pathinfo($imageName, PATHINFO_EXTENSION)); if (!in_array($extension, $allowedExtensions)) { diff --git a/modules/qlohotelreview/views/js/hook/review.js b/modules/qlohotelreview/views/js/hook/review.js index 2a30ce2ef..b34571456 100644 --- a/modules/qlohotelreview/views/js/hook/review.js +++ b/modules/qlohotelreview/views/js/hook/review.js @@ -147,7 +147,7 @@ var QhrReviewImages = { reader.readAsDataURL(file); }, removeFile: function(iInput, iFile) { - var input = $('.images-field input.input-images').eq(iInput); + var input = $('.images-field input.input-images').get(iInput); var files = $(input).get(0).files; var dataTransfer = new DataTransfer(); $(files).each(function(iiFile, file) { @@ -155,9 +155,9 @@ var QhrReviewImages = { dataTransfer.items.add(file); } }); - input.get(0).files = dataTransfer.files; - if (input.get(0).files.length === 0) { - input.remove(); + input.files = dataTransfer.files; + if (input.files.length === 0) { + $(input).remove(); } }, resetPreviews: function() { From 96df477887b1f9fd599a33a1a9a8218c83101bef Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Fri, 23 Jan 2026 12:26:00 +0530 Subject: [PATCH 02/66] Prevent invalid formats before upload --- .../controllers/front/default.php | 2 +- modules/qlohotelreview/qlohotelreview.php | 1 + .../qlohotelreview/views/css/front/review.css | 4 +++ .../qlohotelreview/views/js/hook/review.js | 26 ++++++++++++++++++- .../views/templates/hook/add-review-popup.tpl | 1 + 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/qlohotelreview/controllers/front/default.php b/modules/qlohotelreview/controllers/front/default.php index 899428526..66e1b0a4f 100644 --- a/modules/qlohotelreview/controllers/front/default.php +++ b/modules/qlohotelreview/controllers/front/default.php @@ -90,7 +90,7 @@ class QloHotelReviewDefaultModuleFrontController extends ModuleFrontController foreach ($_FILES['images']['name'] as $key => $imageName) { $extension = Tools::strtolower(pathinfo($imageName, PATHINFO_EXTENSION)); if (!in_array($extension, $allowedExtensions)) { - $errors['general'][] = $imageName . ' ' . $objModule->l('is not a supported image format.','default'); + $errors['general'][] = $objModule->l('Only images with the following extensions are allowed: jpg, jpeg, png','default'); } } } diff --git a/modules/qlohotelreview/qlohotelreview.php b/modules/qlohotelreview/qlohotelreview.php index 405f12ff4..086265f15 100644 --- a/modules/qlohotelreview/qlohotelreview.php +++ b/modules/qlohotelreview/qlohotelreview.php @@ -182,6 +182,7 @@ class QloHotelReview extends Module $this->l('You can upload a maximum of %d images.', false, true), (int) Configuration::get('QHR_MAX_IMAGES_PER_REVIEW') ), + 'allowed_extensions' => $this->l('Only images with the following extensions are allowed: jpg, jpeg, png', false, true), ), ))); diff --git a/modules/qlohotelreview/views/css/front/review.css b/modules/qlohotelreview/views/css/front/review.css index 0c7346dce..539d10199 100644 --- a/modules/qlohotelreview/views/css/front/review.css +++ b/modules/qlohotelreview/views/css/front/review.css @@ -52,6 +52,10 @@ margin-bottom: 14px; } +#add-review-popup .hint { + margin-top: 6px; +} + #add-review-popup .review-error { margin-top: 2px; color: #E85757; diff --git a/modules/qlohotelreview/views/js/hook/review.js b/modules/qlohotelreview/views/js/hook/review.js index b34571456..2db6b37b9 100644 --- a/modules/qlohotelreview/views/js/hook/review.js +++ b/modules/qlohotelreview/views/js/hook/review.js @@ -132,6 +132,29 @@ var QhrReviewImages = { init: function() { QhrReviewImages.inputHtml = ''; }, + validateFiles: function () { + $('#review-general-errors').hide(); + let isValid = true; + $('.images-field input.input-images').each(function (iInput, input) { + let files = input.files; + let dataTransfer = new DataTransfer(); + $.each(files, function (iFile, file) { + if (file.type.startsWith('image/')) { + dataTransfer.items.add(file); + } else { + isValid = false; + } + }); + input.files = dataTransfer.files; + if (!input.files.length) { + $(input).remove(); + } + }); + if (!isValid) { + QhrReviewForm.showGeneralErrors(qlo_hotel_review_js_vars.texts.allowed_extensions); + } + return isValid; + }, getFilesCount: function() { var count = 0; $('.images-field input.input-images').each(function(i, input) { @@ -244,8 +267,9 @@ $(document).on('change', 'input.input-images', function(e) { var filesCount = QhrReviewImages.getFilesCount(); if (filesCount > qlo_hotel_review_js_vars.num_images_max) { QhrReviewImages.removeLastInput(); - alert(qlo_hotel_review_js_vars.texts.num_files); + QhrReviewForm.showGeneralErrors(qlo_hotel_review_js_vars.texts.num_files); } else { + QhrReviewImages.validateFiles(); QhrReviewImages.updatePreviews(); if (filesCount == qlo_hotel_review_js_vars.num_images_max) { diff --git a/modules/qlohotelreview/views/templates/hook/add-review-popup.tpl b/modules/qlohotelreview/views/templates/hook/add-review-popup.tpl index a838127d8..1ba6f6936 100644 --- a/modules/qlohotelreview/views/templates/hook/add-review-popup.tpl +++ b/modules/qlohotelreview/views/templates/hook/add-review-popup.tpl @@ -40,6 +40,7 @@
+

{l s='Allowed formats are: .jpg, .jpeg, .png' mod='qlohotelreview'}

From 48e08bed870dc4e6ad1486fb26d0bcc06f285a29 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Tue, 17 Feb 2026 15:33:31 +0530 Subject: [PATCH 03/66] Improve room management: introduce connected rooms in Back Office --- .../orders/_current_cart_details_data.tpl | 6 +- .../controllers/orders/_product_line.tpl | 3 + .../controllers/products/configuration.tpl | 153 ++++++++++++++++++ .../controllers/products/connected-rooms.tpl | 87 ++++++++++ .../products/modal-connected-rooms.tpl | 148 +++++++++++++++++ controllers/admin/AdminOrdersController.php | 1 + .../classes/HotelCartBookingData.php | 1 + .../classes/HotelReservationSystemDb.php | 11 +- .../classes/HotelRoomConnected.php | 86 ++++++++++ .../AdminHotelRoomsBookingController.php | 1 + modules/hotelreservationsystem/define.php | 1 + .../helpers/view/_partials/booking-rooms.tpl | 6 +- 12 files changed, 501 insertions(+), 3 deletions(-) create mode 100644 admin/themes/default/template/controllers/products/connected-rooms.tpl create mode 100644 admin/themes/default/template/controllers/products/modal-connected-rooms.tpl create mode 100644 modules/hotelreservationsystem/classes/HotelRoomConnected.php diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl index e3405fa99..161c83965 100644 --- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -51,7 +51,11 @@ {assign var=curr_id value=$cart->id_currency|intval} {foreach from=$cart_detail_data item=data} - {$data.room_num|escape:'html':'UTF-8'} {hook h='displayRoomNumAfter' data=$data type='adminOrder'} + {$data.room_num|escape:'html':'UTF-8'} + {if isset($data['connected_rooms'][$data['id_room']]) && $data['connected_rooms'][$data['id_room']]|@count > 0} + {include file="controllers/products/connected-rooms.tpl" htl_connected_rooms= $data['connected_rooms'][$data['id_room']]} + {/if} + {hook h='displayRoomNumAfter' data=$data type='adminOrder'}

{$data.room_type|escape:'html':'UTF-8'}

diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index 1e44a648f..299c0fa22 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -29,6 +29,9 @@ {if $data.is_back_order} {l s='overbooked'} {/if} + {if isset($data['connected_rooms'][$data['id_room']]) && $data['connected_rooms'][$data['id_room']]|@count > 0} + {include file="controllers/products/connected-rooms.tpl" htl_connected_rooms=$data['connected_rooms'][$data['id_room']]} + {/if} diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 7f0bc0f60..c960e3f53 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -67,6 +67,14 @@ + + + {hook h='displayHotelRoomListTableHeaderColumn'} {l s='--'} @@ -108,6 +116,16 @@ {* Since the data can also be used from post incase of errors, which will cause issues with the id index *} + + {if isset($room_info['id'])} + + + + {/if} + {if isset($room_info['id'])} {hook h='displayHotelRoomListTableRowColumn' index=$key id_room=$room_info['id']} {else} @@ -1885,6 +1903,141 @@ return false; } } + //connected modal + $(document).on('click', '.connectedRoomModal', function(e) { + e.preventDefault(); + + let roomId = $(this).data('id-room'); + let hotelId = $(this).data('id-hotel'); + let currentRoomType = $('[name="id_product"]').val(); + $.ajax({ + type: 'POST', + url: prod_link, + dataType: 'json', + data: { + ajax: true, + action: 'getModalConnectedRooms', + room_id: roomId, + hotel_id: hotelId, + current_roomtype: currentRoomType, + }, + success: function(response) { + $('#modalLoader').remove(); + if (response.success) { + if ($('#connectedRoomModal').length) { + $('#connectedRoomModal').modal('hide'); + $('#connectedRoomModal').data('bs.modal', null); + $('#connectedRoomModal').remove(); + } + $('.modal-backdrop').remove(); + $('body').removeClass('modal-open'); + $("#footer").next(".bootstrap").append(response.html); + $('#connectedRoomModal').modal({ + backdrop: 'static', + keyboard: true + }); + } else { + alert(response.message); + } + } + + + }); + }); + function filterRoomsByType() { + var selectedType = $('#connect_room_type').val(); + var firstVisible = null; + $('#connect_room option').each(function() { + if ($(this).data('type') == selectedType) { + $(this).show(); + if (!firstVisible) firstVisible = $(this); + } else { + $(this).hide(); + } + }); + if (firstVisible) { + firstVisible.prop('selected', true); + } + } + $(document).on('change', '#connect_room_type', function() { + filterRoomsByType(); + }); + $(document).on('shown.bs.modal', '#connectedRoomModal', function() { + filterRoomsByType(); + }); + //add connected room + $(document).on('click', '#save_connected_room', function() { + var mainRoomId = $('#connected_room_main_id').val(); + var connectedRoomId = $('#connect_room').val(); + var hotelId = $('#hotel_id').val(); + let currentRoomType = $('[name="id_product"]').val(); + if (!connectedRoomId) { + alert('Please select a room'); + return; + } + $.ajax({ + url: prod_link, + type: 'POST', + dataType: 'json', + data: { + ajax: true, + action: 'ManageConnectedRoom', + mode: 'add', + hotel_id: hotelId, + room_id: mainRoomId, + connected_room_id: connectedRoomId, + current_roomtype: currentRoomType, + }, + beforeSend: function() { + $('#save_connected_room').prop('disabled', true); + }, + success: function(response) { + if (response.success) { + showSuccessMessage(response.message); + $('#connectedRoomModal .modal-content').replaceWith($(response.html).find('.modal-content')); + filterRoomsByType(); + } else { + alert(response.message); + } + }, + complete: function() { + $('#save_connected_room').prop('disabled', false); + } + }); + }); + //remove connected room + $(document).on('click', '.delete-connected-room', function() { + var roomId = $(this).data('room-id'); + var connectedRoomId = $(this).data('connected-room-id'); + var connectedId = $(this).data('connected-id'); + var hotelId = $(this).data('hotel-id'); + let currentRoomType = $('[name="id_product"]').val(); + $.ajax({ + url: prod_link, + type: 'POST', + dataType: 'json', + data: { + ajax: true, + action: 'ManageConnectedRoom', + mode: 'delete', + room_id: roomId, + connected_room_id: connectedRoomId, + connected_id: connectedId, + hotel_id: hotelId, + current_roomtype: currentRoomType, + }, + success: function(response) { + if (response.success) { + showSuccessMessage(response.message); + $('#connectedRoomModal .modal-content').replaceWith($(response.html).find( + '.modal-content')); + filterRoomsByType(); + } else { + alert(response.message); + } + } + }); + }); }); diff --git a/admin/themes/default/template/controllers/products/connected-rooms.tpl b/admin/themes/default/template/controllers/products/connected-rooms.tpl new file mode 100644 index 000000000..2e33a4daf --- /dev/null +++ b/admin/themes/default/template/controllers/products/connected-rooms.tpl @@ -0,0 +1,87 @@ +{** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*} +{if isset($htl_connected_rooms) && $htl_connected_rooms|@count > 0} + + +
+ + +
+
+{/if} + \ No newline at end of file diff --git a/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl b/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl new file mode 100644 index 000000000..38b34e2d8 --- /dev/null +++ b/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl @@ -0,0 +1,148 @@ +{** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*} + \ No newline at end of file diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30026bcca..1bc548457 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3485,6 +3485,7 @@ class AdminOrdersControllerCore extends AdminController $order_detail_data[$key]['amt_with_qty_tax_incl'] = $value['total_price_tax_incl']; $order_detail_data[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']); $order_detail_data[$key]['total_room_tax'] = $order_detail_data[$key]['total_room_price_ti'] - $order_detail_data[$key]['total_room_price_te']; + $order_detail_data[$key]['connected_rooms'] = HotelRoomConnected::getConnectedRoomsByHotel($value['id_hotel'], Context::getContext()->language->id, $value['id_room'], true); if (isset($value['refund_info']) && $value['refund_info']['refunded'] diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index be3cabc94..d57e208d0 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1331,6 +1331,7 @@ class HotelCartBookingData extends ObjectModel ); $cart_detail_data[$key]['amt_with_qty'] = $roomTypeDateRangePrice['total_price_tax_excl']; + $cart_detail_data[$key]['connected_rooms'] = HotelRoomConnected::getConnectedRoomsByHotel($obj_htl_room_info->id_hotel, Context::getContext()->language->id, $obj_htl_room_info->id, true); } } if ($cart_detail_data) { diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index ca44a2826..1260200cd 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -552,6 +552,14 @@ class HotelReservationSystemDb SELECT 5, `id_lang`, 'Hotel Amenities Block', 'Configure Hotels Amenities settings. You can display hotel amenities images using this block. This block will be displayed on home page.' FROM `"._DB_PREFIX_."lang` ORDER BY `id_lang`;", + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_connected_room` ( + `id_connected_room` int(11) NOT NULL AUTO_INCREMENT, + `id_room_information` int(11) NOT NULL, + `id_room` int(11) NOT NULL, + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_connected_room`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", ); } @@ -615,7 +623,8 @@ class HotelReservationSystemDb `'._DB_PREFIX_.'htl_room_type_bed_type`, `'._DB_PREFIX_.'htl_access`, `'._DB_PREFIX_.'htl_settings_link`, - `'._DB_PREFIX_.'htl_settings_link_lang`' + `'._DB_PREFIX_.'htl_settings_link_lang` + `'._DB_PREFIX_.'htl_connected_room`' ); } } diff --git a/modules/hotelreservationsystem/classes/HotelRoomConnected.php b/modules/hotelreservationsystem/classes/HotelRoomConnected.php new file mode 100644 index 000000000..be9ccaf6b --- /dev/null +++ b/modules/hotelreservationsystem/classes/HotelRoomConnected.php @@ -0,0 +1,86 @@ + 'htl_connected_room', + 'primary' => 'id_connected_room', + 'fields' => array( + 'id_room_information' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_room' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'date_add' => array('type' => self::TYPE_DATE), + 'date_upd' => array('type' => self::TYPE_DATE), + ), + ); + public static function getConnectedRoomsByHotel($idHotel, $idLang, $roomId = null, $isConnected = true) + { + if ($isConnected) { + $sql = 'SELECT + hcr.id_connected_room,hcr.id_room_information,hcr.id_room,main_room.id_hotel,main_room.room_num AS main_room_num,connected_room.room_num AS connected_room_num, + main_pl.name AS main_room_type,conn_pl.name AS connected_room_type + FROM `' . _DB_PREFIX_ . 'htl_connected_room` hcr + INNER JOIN `' . _DB_PREFIX_ . 'htl_room_information` main_room ON main_room.id = hcr.id_room_information + INNER JOIN `' . _DB_PREFIX_ . 'htl_room_information` connected_room ON connected_room.id = hcr.id_room + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` main_pl ON (main_pl.id_product = main_room.id_product AND main_pl.id_lang = ' . $idLang . ') + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` conn_pl ON (conn_pl.id_product = connected_room.id_product AND conn_pl.id_lang = ' . $idLang . ') + WHERE main_room.id_hotel = ' . $idHotel . ' + AND connected_room.id_hotel = ' . $idHotel; + if (!empty($roomId)) { + $sql .= ' AND main_room.id = ' . (int) $roomId; + $results = Db::getInstance()->executeS($sql); + } else { + $results = Db::getInstance()->executeS($sql); + } + $grouped = []; + foreach ($results as $row) { + $roomId = $row['id_room_information']; + $connType = $row['connected_room_type']; + if (!isset($grouped[$roomId])) { + $grouped[$roomId] = []; + } + if (!isset($grouped[$roomId][$connType])) { + $grouped[$roomId][$connType] = []; + } + $grouped[$roomId][$connType][] = $row; + } + return $grouped; + } else { + $sql = 'SELECT hri.*, pl.name AS room_type + FROM `' . _DB_PREFIX_ . 'htl_room_information` hri + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.id_product = hri.id_product AND pl.id_lang = ' . $idLang . ') + WHERE hri.id_hotel = ' . (int) $idHotel . ' + AND hri.id != ' . (int) $roomId . ' + AND NOT EXISTS (SELECT 1 FROM `' . _DB_PREFIX_ . 'htl_connected_room` cr WHERE cr.id_room_information = ' . (int) $roomId . ' AND cr.id_room = hri.id) + ORDER BY hri.room_num ASC'; + return Db::getInstance()->executeS($sql); + } + } +} + diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index fac60d468..3cccd6ca7 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -387,6 +387,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'link' => $this->context->link, 'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL, + 'htl_connected_rooms' => HotelRoomConnected::getConnectedRoomsByHotel($this->id_hotel, $this->context->language->id, 0, true), )); if (Configuration::get('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) { diff --git a/modules/hotelreservationsystem/define.php b/modules/hotelreservationsystem/define.php index e8a7cc909..141064a13 100644 --- a/modules/hotelreservationsystem/define.php +++ b/modules/hotelreservationsystem/define.php @@ -49,6 +49,7 @@ require_once 'classes/HotelRoomDisableDates.php'; require_once 'classes/HotelBranchRefundRules.php'; require_once 'classes/HotelBedType.php'; require_once 'classes/HotelRoomTypeBedType.php'; +require_once 'classes/HotelRoomConnected.php'; // linked products require_once 'classes/RoomTypeServiceProduct.php'; diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl index 7c68db350..e83979106 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl @@ -40,7 +40,11 @@ {foreach from=$book_v['data']['available'] key=avai_k item=avai_v} - {$avai_v['room_num']|escape:'htmlall':'UTF-8'} {hook h='displayRoomNumAfter' data=$avai_v type='available'} + {$avai_v['room_num']|escape:'htmlall':'UTF-8'} + {if isset($htl_connected_rooms[$avai_v['id_room']]) && $htl_connected_rooms[$avai_v['id_room']]|@count > 0} + {include file="controllers/products/connected-rooms.tpl" htl_connected_rooms=$htl_connected_rooms[$avai_v['id_room']]} + {/if} + {hook h='displayRoomNumAfter' data=$avai_v type='available'} {assign var="is_full_date" value=($show_full_date && ($date_from|date_format:'%D' == $date_to|date_format:'%D'))} {dateFormat date=$date_from full=$is_full_date} - {dateFormat date=$date_to full=$is_full_date} {$avai_v['room_comment']|escape:'htmlall':'UTF-8'} From 0a5a5a0289e4c84bb7d99550f4b5d03736827fe4 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Tue, 17 Feb 2026 17:52:55 +0530 Subject: [PATCH 04/66] fixed ajax error --- controllers/admin/AdminProductsController.php | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 0a7acb76f..113547c93 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5646,4 +5646,114 @@ class AdminProductsControllerCore extends AdminController return $tpl->fetch(); } + + public function ajaxProcessGetModalConnectedRooms() + { + $roomId = (int) Tools::getValue('room_id'); + $hotelId = (int) Tools::getValue('hotel_id'); + if (!$roomId || !$hotelId) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid data.') + ])); + } + $objRoomType = new HotelRoomType(); + $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); + $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); + $this->context->smarty->assign(array( + 'htl_connected_rooms' => $connectedRooms, + 'htl_not_connected_rooms' => $notConnectedRooms, + 'main_room_id' => $roomId, + 'hotel_id' => $hotelId, + 'current_roomtype' => Tools::getValue('current_roomtype') + )); + $modalContent = $this->context->smarty->fetch( + 'controllers/products/modal-connected-rooms.tpl' + ); + die(json_encode([ + 'success' => true, + 'html' => $modalContent + ])); + } + + public function ajaxProcessManageConnectedRoom() + { + $mode = Tools::getValue('mode'); + $roomId = (int) Tools::getValue('room_id'); + $connectedRoomId = (int) Tools::getValue('connected_room_id'); + $connectedId = (int) Tools::getValue('connected_id'); + $hotelId = Tools::getValue('hotel_id'); + if (!$roomId || !$connectedRoomId) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid room data.') + ])); + } + if ($roomId == $connectedRoomId) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('You cannot connect a room to itself.') + ])); + } + if ($mode === 'add') { + $connection = new HotelRoomConnected(); + $connection->id_room_information = $roomId; + $connection->id_room = $connectedRoomId; + if ($connection->add()) { + $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); + $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); + $this->context->smarty->assign(array( + 'htl_connected_rooms' => $connectedRooms, + 'htl_not_connected_rooms' => $notConnectedRooms, + 'main_room_id' => $roomId, + 'hotel_id' => $hotelId, + 'current_roomtype' => Tools::getValue('current_roomtype') + )); + $modalContent = $this->context->smarty->fetch( + 'controllers/products/modal-connected-rooms.tpl' + ); + die(json_encode([ + 'html' => $modalContent, + 'success' => true, + 'message' => $this->l('Room connected successfully.') + ])); + } + + die(json_encode([ + 'success' => false, + 'message' => $this->l('Failed to connect room.') + ])); + } + //remove room + if ($mode === 'delete') { + $objHotelRoomConnected = new HotelRoomConnected($connectedId); + if ($objHotelRoomConnected->delete()) { + $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); + $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); + $this->context->smarty->assign(array( + 'htl_connected_rooms' => $connectedRooms, + 'htl_not_connected_rooms' => $notConnectedRooms, + 'main_room_id' => $roomId, + 'hotel_id' => $hotelId, + 'current_roomtype' => Tools::getValue('current_roomtype') + )); + $modalContent = $this->context->smarty->fetch( + 'controllers/products/modal-connected-rooms.tpl' + ); + die(json_encode([ + 'success' => true, + 'html' => $modalContent, + 'message' => $this->l('Connected room removed successfully.') + ])); + } + die(json_encode([ + 'success' => false, + 'message' => $this->l('Failed to remove connected room.') + ])); + } + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid action.') + ])); + } } From 2b1ef726db7382e04f4d51213418daae69d0fb05 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Tue, 31 Mar 2026 18:03:35 +0530 Subject: [PATCH 05/66] added: Powered By webkul in frontend --- .../hotelreservationsystem/views/templates/hook/copyRight.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/views/templates/hook/copyRight.tpl b/modules/hotelreservationsystem/views/templates/hook/copyRight.tpl index 790a4a52c..38c1cd38b 100644 --- a/modules/hotelreservationsystem/views/templates/hook/copyRight.tpl +++ b/modules/hotelreservationsystem/views/templates/hook/copyRight.tpl @@ -1,5 +1,5 @@
\ No newline at end of file From 7756fb70713579f270679d8b42b31f81ac579f92 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Sat, 4 Apr 2026 17:10:32 +0530 Subject: [PATCH 06/66] BO: harden connected rooms (permissions, escaping, safe DB handling) --- .../controllers/products/configuration.tpl | 9 +- .../products/modal-connected-rooms.tpl | 26 +-- controllers/admin/AdminOrdersController.php | 10 +- controllers/admin/AdminProductsController.php | 149 +++++++++++++----- .../classes/HotelReservationSystemDb.php | 7 +- .../classes/HotelRoomConnected.php | 93 ++++++++--- 6 files changed, 218 insertions(+), 76 deletions(-) diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index c960e3f53..77f0e2b37 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -119,9 +119,9 @@ {if isset($room_info['id'])} + data-target="#connectedRoomModal" data-id-room="{$room_info['id']|intval}" + data-id-hotel="{$room_info['id_hotel']|intval}" data-room-num="{$room_info['room_num']|escape:'html':'UTF-8'}" + data-room-type="{$room_info['id_product']|intval}"> {/if} @@ -603,6 +603,7 @@ var rm_status = {$rm_status|@json_encode}; var confirmText = "{l s='Are you sure?' js=1}"; var removeDisableDateText = "{l s='Are you sure you want to remove the selected date range?' js=1}"; + var selectRoomText = "{l s='Please select a room' js=1}"; var currentRoomRow = 0; $(document).ready(function() { var tooltipCounter = 0; @@ -1972,7 +1973,7 @@ var hotelId = $('#hotel_id').val(); let currentRoomType = $('[name="id_product"]').val(); if (!connectedRoomId) { - alert('Please select a room'); + alert(selectRoomText); return; } $.ajax({ diff --git a/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl b/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl index 38b34e2d8..fe023de40 100644 --- a/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl +++ b/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl @@ -33,7 +33,7 @@
\ No newline at end of file + + diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index d7e024438..eb77bb77e 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3484,7 +3484,15 @@ class AdminOrdersControllerCore extends AdminController $order_detail_data[$key]['amt_with_qty_tax_incl'] = $value['total_price_tax_incl']; $order_detail_data[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']); $order_detail_data[$key]['total_room_tax'] = $order_detail_data[$key]['total_room_price_ti'] - $order_detail_data[$key]['total_room_price_te']; - $order_detail_data[$key]['connected_rooms'] = HotelRoomConnected::getConnectedRoomsByHotel($value['id_hotel'], Context::getContext()->language->id, $value['id_room'], true); + $order_detail_data[$key]['connected_rooms'] = array(); + if (class_exists('HotelRoomConnected')) { + $order_detail_data[$key]['connected_rooms'] = HotelRoomConnected::getConnectedRoomsByHotel( + (int) $value['id_hotel'], + (int) Context::getContext()->language->id, + (int) $value['id_room'], + true + ); + } if (isset($value['refund_info']) && $value['refund_info']['refunded'] diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 113547c93..ddd932a4d 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5647,8 +5647,39 @@ class AdminProductsControllerCore extends AdminController return $tpl->fetch(); } + /** + * Render connected rooms modal HTML for a given room/hotel. + * + * @param int $hotelId + * @param int $roomId + * @param int $currentRoomType + * + * @return string + */ + protected function getConnectedRoomsModalHtml($hotelId, $roomId, $currentRoomType) + { + $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); + $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); + $this->context->smarty->assign(array( + 'htl_connected_rooms' => $connectedRooms, + 'htl_not_connected_rooms' => $notConnectedRooms, + 'main_room_id' => (int) $roomId, + 'hotel_id' => (int) $hotelId, + 'current_roomtype' => (int) $currentRoomType, + )); + + return $this->context->smarty->fetch('controllers/products/modal-connected-rooms.tpl'); + } + public function ajaxProcessGetModalConnectedRooms() { + if ($this->tabAccess['edit'] !== 1) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Permission denied.') + ])); + } + $roomId = (int) Tools::getValue('room_id'); $hotelId = (int) Tools::getValue('hotel_id'); if (!$roomId || !$hotelId) { @@ -5657,19 +5688,25 @@ class AdminProductsControllerCore extends AdminController 'message' => $this->l('Invalid data.') ])); } - $objRoomType = new HotelRoomType(); - $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); - $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); - $this->context->smarty->assign(array( - 'htl_connected_rooms' => $connectedRooms, - 'htl_not_connected_rooms' => $notConnectedRooms, - 'main_room_id' => $roomId, - 'hotel_id' => $hotelId, - 'current_roomtype' => Tools::getValue('current_roomtype') - )); - $modalContent = $this->context->smarty->fetch( - 'controllers/products/modal-connected-rooms.tpl' + + if (!class_exists('HotelRoomConnected') || !HotelRoomConnected::isConnectedRoomTableAvailable()) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Connected rooms feature is not available. Please upgrade the Hotel Reservation System module.') + ])); + } + + $mainRoomHotelId = (int) Db::getInstance()->getValue( + 'SELECT `id_hotel` FROM `' . _DB_PREFIX_ . 'htl_room_information` WHERE `id` = ' . (int) $roomId ); + if ($mainRoomHotelId !== (int) $hotelId) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid room data.') + ])); + } + + $modalContent = $this->getConnectedRoomsModalHtml($hotelId, $roomId, (int) Tools::getValue('current_roomtype')); die(json_encode([ 'success' => true, 'html' => $modalContent @@ -5678,40 +5715,72 @@ class AdminProductsControllerCore extends AdminController public function ajaxProcessManageConnectedRoom() { + if ($this->tabAccess['edit'] !== 1) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Permission denied.') + ])); + } + $mode = Tools::getValue('mode'); $roomId = (int) Tools::getValue('room_id'); $connectedRoomId = (int) Tools::getValue('connected_room_id'); $connectedId = (int) Tools::getValue('connected_id'); - $hotelId = Tools::getValue('hotel_id'); + $hotelId = (int) Tools::getValue('hotel_id'); if (!$roomId || !$connectedRoomId) { die(json_encode([ 'success' => false, 'message' => $this->l('Invalid room data.') ])); } + + if (!class_exists('HotelRoomConnected') || !HotelRoomConnected::isConnectedRoomTableAvailable()) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Connected rooms feature is not available. Please upgrade the Hotel Reservation System module.') + ])); + } + if ($roomId == $connectedRoomId) { die(json_encode([ 'success' => false, 'message' => $this->l('You cannot connect a room to itself.') ])); } + + $mainRoomHotelId = (int) Db::getInstance()->getValue( + 'SELECT `id_hotel` FROM `' . _DB_PREFIX_ . 'htl_room_information` WHERE `id` = ' . (int) $roomId + ); + $connectedRoomHotelId = (int) Db::getInstance()->getValue( + 'SELECT `id_hotel` FROM `' . _DB_PREFIX_ . 'htl_room_information` WHERE `id` = ' . (int) $connectedRoomId + ); + if (!$hotelId || $mainRoomHotelId !== $hotelId || $connectedRoomHotelId !== $hotelId) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid room data.') + ])); + } + + $currentRoomType = (int) Tools::getValue('current_roomtype'); + if ($mode === 'add') { + $existingConnectedId = (int) Db::getInstance()->getValue( + 'SELECT `id_connected_room` FROM `' . _DB_PREFIX_ . 'htl_connected_room` WHERE `id_room_information` = ' . (int) $roomId . ' AND `id_room` = ' . (int) $connectedRoomId + ); + if ($existingConnectedId) { + $modalContent = $this->getConnectedRoomsModalHtml($hotelId, $roomId, $currentRoomType); + die(json_encode([ + 'html' => $modalContent, + 'success' => true, + 'message' => $this->l('Room is already connected.') + ])); + } + $connection = new HotelRoomConnected(); $connection->id_room_information = $roomId; $connection->id_room = $connectedRoomId; if ($connection->add()) { - $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); - $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); - $this->context->smarty->assign(array( - 'htl_connected_rooms' => $connectedRooms, - 'htl_not_connected_rooms' => $notConnectedRooms, - 'main_room_id' => $roomId, - 'hotel_id' => $hotelId, - 'current_roomtype' => Tools::getValue('current_roomtype') - )); - $modalContent = $this->context->smarty->fetch( - 'controllers/products/modal-connected-rooms.tpl' - ); + $modalContent = $this->getConnectedRoomsModalHtml($hotelId, $roomId, $currentRoomType); die(json_encode([ 'html' => $modalContent, 'success' => true, @@ -5726,20 +5795,26 @@ class AdminProductsControllerCore extends AdminController } //remove room if ($mode === 'delete') { + if (!$connectedId) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid data.') + ])); + } + + $matchesConnection = (int) Db::getInstance()->getValue( + 'SELECT `id_connected_room` FROM `' . _DB_PREFIX_ . 'htl_connected_room` WHERE `id_connected_room` = ' . (int) $connectedId . ' AND `id_room_information` = ' . (int) $roomId . ' AND `id_room` = ' . (int) $connectedRoomId + ); + if (!$matchesConnection) { + die(json_encode([ + 'success' => false, + 'message' => $this->l('Invalid data.') + ])); + } + $objHotelRoomConnected = new HotelRoomConnected($connectedId); if ($objHotelRoomConnected->delete()) { - $connectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, true); - $notConnectedRooms = HotelRoomConnected::getConnectedRoomsByHotel($hotelId, $this->context->language->id, $roomId, false); - $this->context->smarty->assign(array( - 'htl_connected_rooms' => $connectedRooms, - 'htl_not_connected_rooms' => $notConnectedRooms, - 'main_room_id' => $roomId, - 'hotel_id' => $hotelId, - 'current_roomtype' => Tools::getValue('current_roomtype') - )); - $modalContent = $this->context->smarty->fetch( - 'controllers/products/modal-connected-rooms.tpl' - ); + $modalContent = $this->getConnectedRoomsModalHtml($hotelId, $roomId, $currentRoomType); die(json_encode([ 'success' => true, 'html' => $modalContent, diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index 1260200cd..f907c111a 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -558,7 +558,10 @@ class HotelReservationSystemDb `id_room` int(11) NOT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_connected_room`) + PRIMARY KEY (`id_connected_room`), + UNIQUE KEY `uniq_room_connection` (`id_room_information`, `id_room`), + KEY `idx_id_room_information` (`id_room_information`), + KEY `idx_id_room` (`id_room`) ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", ); } @@ -623,7 +626,7 @@ class HotelReservationSystemDb `'._DB_PREFIX_.'htl_room_type_bed_type`, `'._DB_PREFIX_.'htl_access`, `'._DB_PREFIX_.'htl_settings_link`, - `'._DB_PREFIX_.'htl_settings_link_lang` + `'._DB_PREFIX_.'htl_settings_link_lang`, `'._DB_PREFIX_.'htl_connected_room`' ); } diff --git a/modules/hotelreservationsystem/classes/HotelRoomConnected.php b/modules/hotelreservationsystem/classes/HotelRoomConnected.php index be9ccaf6b..0bc358b55 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomConnected.php +++ b/modules/hotelreservationsystem/classes/HotelRoomConnected.php @@ -23,6 +23,9 @@ class HotelRoomConnected extends ObjectModel { + /** @var bool|null */ + protected static $connectedRoomTableAvailable = null; + public $id_connected_room; public $id_room_information; public $id_room; @@ -39,48 +42,100 @@ class HotelRoomConnected extends ObjectModel 'date_upd' => array('type' => self::TYPE_DATE), ), ); + + /** + * Check whether the connected room table exists and is queryable. + * + * @return bool + */ + public static function isConnectedRoomTableAvailable() + { + if (self::$connectedRoomTableAvailable !== null) { + return (bool) self::$connectedRoomTableAvailable; + } + + $result = Db::getInstance()->executeS('SELECT 1 FROM `' . _DB_PREFIX_ . 'htl_connected_room` LIMIT 1'); + self::$connectedRoomTableAvailable = ($result !== false); + + return (bool) self::$connectedRoomTableAvailable; + } + + /** + * Fetch connected/not-connected rooms for a hotel. + * + * @param int $idHotel + * @param int $idLang + * @param int|null $roomId + * @param bool $isConnected + * + * @return array + */ public static function getConnectedRoomsByHotel($idHotel, $idLang, $roomId = null, $isConnected = true) { + $idHotel = (int) $idHotel; + $idLang = (int) $idLang; + $roomId = (int) $roomId; + if ($isConnected) { + if (!self::isConnectedRoomTableAvailable()) { + return array(); + } + $sql = 'SELECT hcr.id_connected_room,hcr.id_room_information,hcr.id_room,main_room.id_hotel,main_room.room_num AS main_room_num,connected_room.room_num AS connected_room_num, main_pl.name AS main_room_type,conn_pl.name AS connected_room_type FROM `' . _DB_PREFIX_ . 'htl_connected_room` hcr INNER JOIN `' . _DB_PREFIX_ . 'htl_room_information` main_room ON main_room.id = hcr.id_room_information INNER JOIN `' . _DB_PREFIX_ . 'htl_room_information` connected_room ON connected_room.id = hcr.id_room - LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` main_pl ON (main_pl.id_product = main_room.id_product AND main_pl.id_lang = ' . $idLang . ') - LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` conn_pl ON (conn_pl.id_product = connected_room.id_product AND conn_pl.id_lang = ' . $idLang . ') - WHERE main_room.id_hotel = ' . $idHotel . ' - AND connected_room.id_hotel = ' . $idHotel; - if (!empty($roomId)) { + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` main_pl ON (main_pl.id_product = main_room.id_product AND main_pl.id_lang = ' . (int) $idLang . ') + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` conn_pl ON (conn_pl.id_product = connected_room.id_product AND conn_pl.id_lang = ' . (int) $idLang . ') + WHERE main_room.id_hotel = ' . (int) $idHotel . ' + AND connected_room.id_hotel = ' . (int) $idHotel; + if ($roomId > 0) { $sql .= ' AND main_room.id = ' . (int) $roomId; - $results = Db::getInstance()->executeS($sql); - } else { - $results = Db::getInstance()->executeS($sql); } - $grouped = []; + + $results = Db::getInstance()->executeS($sql); + if ($results === false) { + return array(); + } + + $grouped = array(); foreach ($results as $row) { - $roomId = $row['id_room_information']; - $connType = $row['connected_room_type']; - if (!isset($grouped[$roomId])) { - $grouped[$roomId] = []; + $mainRoomId = (int) $row['id_room_information']; + $connType = (string) $row['connected_room_type']; + if (!isset($grouped[$mainRoomId])) { + $grouped[$mainRoomId] = array(); } - if (!isset($grouped[$roomId][$connType])) { - $grouped[$roomId][$connType] = []; + if (!isset($grouped[$mainRoomId][$connType])) { + $grouped[$mainRoomId][$connType] = array(); } - $grouped[$roomId][$connType][] = $row; + $grouped[$mainRoomId][$connType][] = $row; } return $grouped; } else { + // If the connected room table is not yet available (e.g., older installs), + // fall back to returning all rooms except the main room. + if (!self::isConnectedRoomTableAvailable()) { + $sql = 'SELECT hri.*, pl.name AS room_type + FROM `' . _DB_PREFIX_ . 'htl_room_information` hri + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.id_product = hri.id_product AND pl.id_lang = ' . (int) $idLang . ') + WHERE hri.id_hotel = ' . (int) $idHotel . ' + AND hri.id != ' . (int) $roomId . ' + ORDER BY hri.room_num ASC'; + $results = Db::getInstance()->executeS($sql); + return ($results === false) ? array() : $results; + } + $sql = 'SELECT hri.*, pl.name AS room_type FROM `' . _DB_PREFIX_ . 'htl_room_information` hri - LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.id_product = hri.id_product AND pl.id_lang = ' . $idLang . ') + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.id_product = hri.id_product AND pl.id_lang = ' . (int) $idLang . ') WHERE hri.id_hotel = ' . (int) $idHotel . ' AND hri.id != ' . (int) $roomId . ' AND NOT EXISTS (SELECT 1 FROM `' . _DB_PREFIX_ . 'htl_connected_room` cr WHERE cr.id_room_information = ' . (int) $roomId . ' AND cr.id_room = hri.id) ORDER BY hri.room_num ASC'; - return Db::getInstance()->executeS($sql); + $results = Db::getInstance()->executeS($sql); + return ($results === false) ? array() : $results; } } } - From 00f93226fdc83c0ec6eedaae252a2130273b1af2 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Tue, 7 Apr 2026 12:50:01 +0530 Subject: [PATCH 07/66] Added: download and print functionality for payment receipts in the back-office --- .../controllers/orders/helpers/view/view.tpl | 12 +- classes/order/Order.php | 21 ++ classes/order/OrderPayment.php | 24 +++ classes/pdf/HTMLTemplatePaymentReceipt.php | 164 ++++++++++++++ classes/pdf/PDF.php | 1 + controllers/admin/AdminOrdersController.php | 1 + .../admin/AdminPaymentReceiptsController.php | 135 ++++++++++++ controllers/admin/AdminPdfController.php | 28 ++- install/data/db_structure.sql | 1 + install/data/xml/configuration.xml | 6 + install/data/xml/tab.xml | 3 + install/langs/en/data/configuration.xml | 3 + install/langs/en/data/tab.xml | 1 + pdf/payment-receipt.tpl | 79 +++++++ pdf/receipt.addresses-tab.tpl | 52 +++++ pdf/receipt.payment-info-tab.tpl | 63 ++++++ pdf/receipt.style-tab.tpl | 203 ++++++++++++++++++ 17 files changed, 794 insertions(+), 3 deletions(-) create mode 100644 classes/pdf/HTMLTemplatePaymentReceipt.php create mode 100644 controllers/admin/AdminPaymentReceiptsController.php create mode 100644 pdf/payment-receipt.tpl create mode 100644 pdf/receipt.addresses-tab.tpl create mode 100644 pdf/receipt.payment-info-tab.tpl create mode 100644 pdf/receipt.style-tab.tpl 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 c0c841758..11a6e1da7 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -419,6 +419,11 @@
 {l s="Payment"} {$order->getOrderPayments()|@count} + {if count($order->getOrderPayments()) > 0 && $receipt_management_active} + + {l s='View Payments '} + + {/if}
{if count($order->getOrderPayments()) > 0}

total_paid_tax_incl, 2) == round($total_paid, 2) || (isset($currentState) && $currentState->id == 6)} style="display: none;"{/if}> @@ -451,7 +456,7 @@ {l s='Transaction ID'} {l s='Amount'} {l s='Invoice'} - + @@ -463,6 +468,11 @@ {$payment['transaction_id']|escape:'html':'UTF-8'} {displayPrice price=$payment['real_paid_amount'] currency=$payment['id_currency']} {if isset($payment['invoice_number'])}{$payment['invoice_number']}{else}--{/if} + {if isset($receipt_management_active) && $receipt_management_active} + + {l s='View'} + + {/if} {l s='Details'} diff --git a/classes/order/Order.php b/classes/order/Order.php index 7bceb94cf..336fbec2e 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1874,6 +1874,16 @@ class OrderCore extends ObjectModel $order_payment->amount = $amount_paid; $order_payment->date_add = ($date ? $date : null); + $number = Configuration::get('PS_PAYMENT_RECEIPTS_START_NUMBER', null, null, $this->id_shop); + // If payment start number has been set, you clean the value of this configuration + if ($number) { + Configuration::updateValue('PS_PAYMENT_RECEIPTS_START_NUMBER', false, false, null, $this->id_shop); + }else{ + $number = Order::getLastPaymentNumber() + 1; + } + + $order_payment->number = $number; + // Add time to the date if needed if ($order_payment->date_add != null && preg_match('/^[0-9]+-[0-9]+-[0-9]+$/', $order_payment->date_add)) { $order_payment->date_add .= ' '.date('H:i:s'); @@ -1935,6 +1945,17 @@ class OrderCore extends ObjectModel return false; } + public static function getLastPaymentNumber() + { + $sql = 'SELECT MAX(`number`) FROM `'._DB_PREFIX_.'order_payment`'; + if (Configuration::get('PS_PAYMENT_RECEIPTS_RESET')) { + $sql .= ' WHERE DATE_FORMAT(`date_add`, "%Y") = '.(int)date('Y'); + } + return Db::getInstance()->getValue($sql); + } + + + /** * Returns the correct product taxes breakdown. * diff --git a/classes/order/OrderPayment.php b/classes/order/OrderPayment.php index b3f3c981b..4ad21bf86 100644 --- a/classes/order/OrderPayment.php +++ b/classes/order/OrderPayment.php @@ -32,6 +32,7 @@ class OrderPaymentCore extends ObjectModel public $order_reference; public $id_currency; + public $number; public $amount; public $payment_method; public $payment_type; @@ -52,6 +53,7 @@ class OrderPaymentCore extends ObjectModel 'fields' => array( 'order_reference' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 9), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'number' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254), 'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true), 'payment_method' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'payment_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), @@ -159,4 +161,26 @@ class OrderPaymentCore extends ObjectModel { return Db::getInstance()->getValue('SELECT (SUM(`amount` * `conversion_rate`) / SUM(`amount`)) FROM `'._DB_PREFIX_.'order_payment` WHERE `order_reference` = \''.pSQL($order_reference).'\' AND `id_currency` = '.(int)$idCurrency); } + + public static function getTransactionDetailByOrderid($id_order) + { + return ObjectModel::hydrateCollection('OrderPayment', Db::getInstance()->executeS(' + SELECT DISTINCT op.* + FROM `'._DB_PREFIX_.'order_payment` op + INNER JOIN `'._DB_PREFIX_.'order_payment_detail` opd ON (opd.`id_order_payment` = op.`id_order_payment`) + WHERE opd.`id_order` = '.(int) $id_order.' + ORDER BY op.`date_add` ASC, op.`id_order_payment` ASC + ')); + } + + public function getPaymentReceiptNumberFormated($id_lang, $id_shop = null) + { + $format = '%1$s%2$06d'; + + if (Configuration::get('PS_PAYMENT_RECEIPTS_USE_YEAR')) { + $format = '%1$s%2$06d/%3$s'; + } + + return sprintf($format, Configuration::get('PS_PAYMENT_RECEIPTS_PREFIX', (int)$id_lang, null, (int)$id_shop), $this->number, date('Y', strtotime($this->date_add))); + } } diff --git a/classes/pdf/HTMLTemplatePaymentReceipt.php b/classes/pdf/HTMLTemplatePaymentReceipt.php new file mode 100644 index 000000000..f6ea80f9e --- /dev/null +++ b/classes/pdf/HTMLTemplatePaymentReceipt.php @@ -0,0 +1,164 @@ + + * @copyright 2007-2017 PrestaShop SA + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +/** + * @since 1.5 + */ +class HTMLTemplatePaymentReceiptCore extends HTMLTemplate +{ + public $orderPayment; + public $order; + /** + * @param OrderPayment $orderPayment + * @param $smarty + * @throws PrestaShopException + */ + public function __construct(OrderPayment $orderPayment, $smarty, $bulk_mode = false) + { + $id_order = (int) Tools::getValue('id_order'); + $this->orderPayment = $orderPayment; + $this->order = new Order((int)$id_order); + $this->smarty = $smarty; + // header informations + $this->date = Tools::displayDate($this->orderPayment->date_add); + $id_lang = Context::getContext()->language->id; + $this->shop = new Shop((int)$this->order->id_shop); + $this->title = $this->orderPayment->getPaymentReceiptNumberFormated($id_lang, (int)$this->order->id_shop); + + } + + /** + * Returns the template's HTML header + * + * @return string HTML header + */ + public function getHeader() + { + $this->assignCommonHeaderData(); + $this->smarty->assign(array( + 'header' => HTMLTemplatePaymentReceipt::l('Receipt'), + )); + + return $this->smarty->fetch($this->getTemplate('header')); + } + + public function getFooter() + { + $shop_address = $this->getShopAddress(); + + $id_shop = (int)$this->shop->id; + + $this->smarty->assign(array( + 'shop_address' => $shop_address, + 'shop_fax' => Configuration::get('PS_SHOP_FAX', null, null, $id_shop), + 'shop_phone' => Configuration::get('PS_SHOP_PHONE', null, null, $id_shop), + 'shop_email' => Configuration::get('PS_SHOP_EMAIL', null, null, $id_shop), + 'free_text' => Configuration::get('PS_PAYMENT_RECEIPTS_FREE_TEXT', (int)Context::getContext()->language->id, null, $id_shop) + )); + + return $this->smarty->fetch($this->getTemplate('footer')); + } + + public function getContent() + { + $delivery_address = $invoice_address = new Address((int)$this->order->id_address_invoice); + $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '
', ' '); + $formatted_delivery_address = ''; + + if ($this->order->id_address_delivery != $this->order->id_address_invoice) { + $delivery_address = new Address((int)$this->order->id_address_delivery); + $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '
', ' '); + } + + $formattedHotelAddress = ''; + if (Module::isInstalled('hotelreservationsystem')) { + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($this->order->id)) { + $objHotelBranchInfo = new HotelBranchInformation((int) $idHotel, Context::getContext()->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((int)$this->order->id_customer); + + $this->orderPayment->payment_type = $this->getPaymentType($this->orderPayment->payment_type); + + $legal_free_text = Configuration::get('PS_PAYMENT_RECEIPTS_LEGAL_FREE_TEXT', (int)Context::getContext()->language->id, null, (int)$this->order->id_shop); + + $this->smarty->assign(array( + 'order' => $this->order, + 'payment_list' => array($this->orderPayment), + 'delivery_address' => $formatted_delivery_address, + 'invoice_address' => $formatted_invoice_address, + 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), + 'customer' => $customer, + 'hotel_address' => $formattedHotelAddress, + 'legal_free_text' => $legal_free_text, + )); + + $tpls = array( + 'style_tab' => $this->smarty->fetch($this->getTemplate('receipt.style-tab')), + 'addresses_tab' => $this->smarty->fetch($this->getTemplate('receipt.addresses-tab')), + 'payment_info_tab' => $this->smarty->fetch($this->getTemplate('receipt.payment-info-tab')), + ); + $this->smarty->assign($tpls); + $html = $this->smarty->fetch($this->getTemplate('payment-receipt')); + return($html); + } + + public function getFilename() + { + return 'payment-receipt-'.sprintf('%06d', $this->orderPayment->id).'.pdf'; + } + + public function getBulkFilename() + { + return 'payment-receipts.pdf'; + } + + protected function getPaymentType($paymentType = null) + { + $paymentTypeName = null; + switch ($paymentType) { + case OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL: + $paymentTypeName = HTMLTemplatePaymentReceipt::l('Pay at hotel'); + break; + case OrderPayment::PAYMENT_TYPE_ONLINE: + $paymentTypeName = HTMLTemplatePaymentReceipt::l('Online'); + break; + case OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT: + $paymentTypeName = HTMLTemplatePaymentReceipt::l('Remote payment'); + break; + default: + $paymentTypeName = null; + break; + } + return $paymentTypeName; + } +} \ No newline at end of file diff --git a/classes/pdf/PDF.php b/classes/pdf/PDF.php index 626d3a51a..833d5b17e 100644 --- a/classes/pdf/PDF.php +++ b/classes/pdf/PDF.php @@ -41,6 +41,7 @@ class PDFCore const TEMPLATE_ORDER_SLIP = 'OrderSlip'; const TEMPLATE_DELIVERY_SLIP = 'DeliverySlip'; const TEMPLATE_SUPPLY_ORDER_FORM = 'SupplyOrderForm'; + const TEMPLATE_PAYMENT_RECEIPT = 'PaymentReceipt'; /** * @param $objects diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30026bcca..1817c0269 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3676,6 +3676,7 @@ class AdminOrdersControllerCore extends AdminController 'payment_methods' => $payment_methods, 'payment_types' => $this->getPaymentsTypes(), 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), + 'receipt_management_active' => Configuration::get('PS_PAYMENT_RECEIPTS', null, null, $order->id_shop), 'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'HOOK_CONTENT_ORDER' => Hook::exec( 'displayAdminOrderContentOrder', diff --git a/controllers/admin/AdminPaymentReceiptsController.php b/controllers/admin/AdminPaymentReceiptsController.php new file mode 100644 index 000000000..44336b9f1 --- /dev/null +++ b/controllers/admin/AdminPaymentReceiptsController.php @@ -0,0 +1,135 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ +class AdminPaymentReceiptsControllerCore extends AdminControllerCore +{ + public function __construct() + { + $this->bootstrap = true; + parent::__construct(); + $this->context = Context::getContext(); + $this->lang = false; + $this->table = 'order_payment'; + + $this->fields_options = array( + 'general' => array( + 'title' => $this->l('Payment receipts options'), + 'fields' => array( + 'PS_PAYMENT_RECEIPTS' => array( + 'title' => $this->l('Enable Receipts'), + 'desc' => $this->l('If enabled, your customers will receive a receipt for their purchase(s).'), + 'cast' => 'intval', + 'type' => 'bool' + ), + 'PS_PAYMENT_RECEIPTS_PREFIX' => array( + 'title' => $this->l('Receipt prefix'), + 'desc' => $this->l('Prefix used for receipt name (e.g. #IN00001).'), + 'size' => 6, + 'type' => 'textLang' + ), + 'PS_PAYMENT_RECEIPTS_USE_YEAR' => array( + 'title' => $this->l('Add current year to receipt number'), + 'cast' => 'intval', + 'type' => 'bool' + ), + 'PS_PAYMENT_RECEIPTS_RESET' => array( + 'title' => $this->l('Reset Receipt progressive number at beginning of the year'), + 'cast' => 'intval', + 'type' => 'bool' + ), + 'PS_PAYMENT_RECEIPTS_START_NUMBER' => array( + 'title' => $this->l('Receipt number'), + 'desc' => sprintf($this->l('The next receipt will begin with this number, and then increase with each additional receipt. Set to 0 if you want to keep the current number (which is #%s).'), Order::getLastPaymentNumber() + 1), + 'size' => 6, + 'type' => 'text', + 'cast' => 'intval' + ), + 'PS_PAYMENT_RECEIPTS_LEGAL_FREE_TEXT' => array( + 'title' => $this->l('Legal free text'), + 'desc' => $this->l('Use this field to display additional text on your receipt, like specific legal information. It will appear below the payment methods summary.'), + 'size' => 50, + 'type' => 'textareaLang', + ), + 'PS_PAYMENT_RECEIPTS_FREE_TEXT' => array( + 'title' => $this->l('Footer text'), + 'desc' => $this->l('This text will appear at the bottom of the receipt, below your company details.'), + 'size' => 50, + 'type' => 'textLang', + ), + 'PS_PDF_USE_CACHE' => array( + 'title' => $this->l('Use the disk as cache for PDF receipts'), + 'desc' => $this->l('Saves memory but slows down the PDF generation.'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool' + ) + ), + 'submit' => array('title' => $this->l('Save')) + ) + ); + } + + public function initContent() + { + $this->display = 'edit'; + $this->initTabModuleList(); + $this->initToolbar(); + $this->initPageHeaderToolbar(); + $this->table = 'order_payment'; + $this->content .= $this->renderOptions(); + + $this->context->smarty->assign(array( + 'content' => $this->content, + 'url_post' => self::$currentIndex.'&token='.$this->token, + 'show_page_header_toolbar' => $this->show_page_header_toolbar, + 'page_header_toolbar_title' => $this->page_header_toolbar_title, + 'page_header_toolbar_btn' => $this->page_header_toolbar_btn + )); + } + + public function initToolbarTitle() + { + $this->toolbar_title = array_unique($this->breadcrumbs); + } + + public function initPageHeaderToolbar() + { + parent::initPageHeaderToolbar(); + unset($this->page_header_toolbar_btn['cancel']); + } + + public function postProcess() + { + parent::postProcess(); + } + + public function beforeUpdateOptions() + { + if ((int)Tools::getValue('PS_PAYMENT_RECEIPTS_START_NUMBER') != 0 && (int)Tools::getValue('PS_PAYMENT_RECEIPTS_START_NUMBER') <= Order::getLastPaymentNumber()) { + $this->errors[] = $this->l('Invalid receipt number.').Order::getLastPaymentNumber().')'; + } + } +} + diff --git a/controllers/admin/AdminPdfController.php b/controllers/admin/AdminPdfController.php index 7fba0f8e1..279529b2a 100644 --- a/controllers/admin/AdminPdfController.php +++ b/controllers/admin/AdminPdfController.php @@ -93,7 +93,6 @@ class AdminPdfControllerCore extends AdminController public function processGenerateInvoicesPDF() { $order_invoice_collection = OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')); - if (!count($order_invoice_collection)) { die(Tools::displayError('No invoice was found.')); } @@ -150,14 +149,39 @@ class AdminPdfControllerCore extends AdminController $id_supply_order = (int)Tools::getValue('id_supply_order'); $supply_order = new SupplyOrder($id_supply_order); - if (!Validate::isLoadedObject($supply_order)) { die(Tools::displayError('The supply order cannot be found within your database.')); } $this->generatePDF($supply_order, PDF::TEMPLATE_SUPPLY_ORDER_FORM); + } + + public function processGeneratePaymentReceipt() + { + $idOrderPayment = (int) Tools::getValue('id_order_payment'); + $idOrder = (int) Tools::getValue('id_order'); + + if ($idOrderPayment <= 0 && $idOrder <= 0) { + die(Tools::displayError('The order or order payment id is missing.')); + } + + if ($idOrderPayment > 0) { + $orderPayment = new OrderPayment($idOrderPayment); + + if (!Validate::isLoadedObject($orderPayment)) { + die(Tools::displayError('The order payment cannot be found.')); + } + } else { + $orderPayment = OrderPayment::getTransactionDetailByOrderid($idOrder); + if (!$orderPayment || !count($orderPayment)) { + die(Tools::displayError('No payment found for this order.')); + } + } + + $this->generatePDF($orderPayment, PDF::TEMPLATE_PAYMENT_RECEIPT); } + public function generateDeliverySlipPDFByIdOrder($id_order) { $order = new Order((int)$id_order); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 7550fbcad..8cfeeb755 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -1496,6 +1496,7 @@ CREATE TABLE `PREFIX_order_payment` ( `order_reference` VARCHAR(9), `id_currency` INT UNSIGNED NOT NULL, `amount` DECIMAL(10,2) NOT NULL, + `number` varchar(255) NOT NULL, `payment_method` varchar(255) NOT NULL, `payment_type` INT UNSIGNED NOT NULL, `conversion_rate` decimal(13,6) NOT NULL DEFAULT 1, diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 1c754ae50..dd1245e17 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -133,6 +133,9 @@ #IN + + + #IN {"avoid":[]} @@ -152,6 +155,9 @@ 1 + + 1 + 360 diff --git a/install/data/xml/tab.xml b/install/data/xml/tab.xml index 09eed80f3..8909ed603 100644 --- a/install/data/xml/tab.xml +++ b/install/data/xml/tab.xml @@ -102,6 +102,9 @@ AdminInvoices + + AdminPaymentReceipts + diff --git a/install/langs/en/data/configuration.xml b/install/langs/en/data/configuration.xml index b4bf4ef61..610649713 100644 --- a/install/langs/en/data/configuration.xml +++ b/install/langs/en/data/configuration.xml @@ -3,6 +3,9 @@ #IN + + #IN + #DE diff --git a/install/langs/en/data/tab.xml b/install/langs/en/data/tab.xml index ab5391a0f..2ccd45418 100644 --- a/install/langs/en/data/tab.xml +++ b/install/langs/en/data/tab.xml @@ -32,6 +32,7 @@ + diff --git a/pdf/payment-receipt.tpl b/pdf/payment-receipt.tpl new file mode 100644 index 000000000..470b49eae --- /dev/null +++ b/pdf/payment-receipt.tpl @@ -0,0 +1,79 @@ +{* +* 2007-2015 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{$style_tab} + + + + + + + + + + + + + + + + + + + + + + + + + {if isset($HOOK_DISPLAY_PDF)} + + + + + + + + {/if} + +
+ + {$addresses_tab} + +
 
+ {$payment_info_tab} +
 
+ + + + + +
+

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

+
+ +
 
+ {$HOOK_DISPLAY_PDF} +
diff --git a/pdf/receipt.addresses-tab.tpl b/pdf/receipt.addresses-tab.tpl new file mode 100644 index 000000000..df5e70de0 --- /dev/null +++ b/pdf/receipt.addresses-tab.tpl @@ -0,0 +1,52 @@ +{* +* 2007-2015 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + + + + + +
+ {if !empty($hotel_address)} + {l s='Hotel Detail' pdf='true'}

+ {$hotel_address} + {/if} +
+ {l s='Customer Detail' pdf='true'}

+ {if $invoice_address} + {$invoice_address} + {else} + {$customer->firstname} {$customer->lastname} +
+ {$customer->phone} + {/if} +
\ No newline at end of file diff --git a/pdf/receipt.payment-info-tab.tpl b/pdf/receipt.payment-info-tab.tpl new file mode 100644 index 000000000..d39879c19 --- /dev/null +++ b/pdf/receipt.payment-info-tab.tpl @@ -0,0 +1,63 @@ +{* +* 2007-2015 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if isset($payment_list) && $payment_list} + + + + + + + + + + + + + + + {foreach from=$payment_list key=rm_k item=payment} + {cycle values=["color_line_even", "color_line_odd"] assign=bgcolor_class} + + + + + + + + {/foreach} + +
{l s='Payment Details' pdf='true'}
{l s='Payment Date' pdf='true'}{l s='Payment Method' pdf='true'}{l s='Payment Type' pdf='true'}{l s='Transaction ID' pdf='true'}{l s='Amount' pdf='true'}
+ {dateFormat date=$payment->date_add full=true} + + {$payment->payment_method} + + {$payment->payment_type} + + {$payment->transaction_id} + + {displayPrice currency=$payment->id_currency price=$payment->amount} +
+{/if} \ No newline at end of file diff --git a/pdf/receipt.style-tab.tpl b/pdf/receipt.style-tab.tpl new file mode 100644 index 000000000..e34c365c9 --- /dev/null +++ b/pdf/receipt.style-tab.tpl @@ -0,0 +1,203 @@ +{* +* 2007-2015 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{assign var=color_header value="#F0F0F0"} +{assign var=color_border value="#000000"} +{assign var=color_border_lighter value="#CCCCCC"} +{assign var=color_line_even value="#FFFFFF"} +{assign var=color_line_odd value="#F9F9F9"} +{assign var=font_size_text value="9pt"} +{assign var=font_size_header value="9pt"} +{assign var=font_size_product value="9pt"} +{assign var=height_header value="20px"} +{assign var=table_padding value="4px"} + + From 17d8e63e31cd3f4e7587ba14b0107d1891b259e8 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Tue, 7 Apr 2026 17:30:01 +0530 Subject: [PATCH 08/66] composer file updated --- composer.json | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 74ff00cb0..0e5523d61 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,32 @@ { + "name": "qloapps/qloapps", + "description": "QloApps is an Open-source and Free hotel reservation system and booking engine. With the help of QloApps, you can launch your hotel booking website without any cost and take & manage online bookings.", + "type": "project", + "homepage": "https://qloapps.com", + "license": "OSL-3.0", + "authors": [ + { + "name": "QloApps", + "email": "support@qloapps.com" + }, + { + "name": "QloApps Community", + "homepage": "https://qloapps.com" + } + ], + "support": { + "forum": "https://forums.qloapps.com/", + "issues": "https://github.com/Qloapps/QloApps/issues", + "source": "https://github.com/Qloapps/QloApps" + }, "require": { - "php": ">=5.4 <8.0", + "php": ">=8.0 <8.5", "ext-simplexml": "*", "ext-curl": "*", "ext-gd": "*", "ext-zip": "*", "ext-soap": "*" }, - "name": "webkul/qloapps", - "description": "QloApps is an Open-source and Free hotel reservation system and booking engine. With the help of QloApps, you can launch your hotel booking website without any cost and take & manage online bookings.", - "type": "project", - "license": "OSL-3.0", - "authors": [ - { - "name": "webkul", - "email": "support@qloapps.com" - } - ], "minimum-stability": "dev", "prefer-stable": true } \ No newline at end of file From 8d2c1294750ee0c558197cf19130500f3291c2ff Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Wed, 8 Apr 2026 19:51:23 +0530 Subject: [PATCH 09/66] ui updated --- admin/themes/default/sass/admin-theme.sass | 1 + .../default/sass/partials/_qlotooltip.sass | 100 +++++++++ .../controllers/products/configuration.tpl | 125 ++++++++++-- .../controllers/products/connected-rooms.tpl | 103 +++++----- .../products/modal-connected-rooms.tpl | 193 ++++++++++-------- controllers/admin/AdminProductsController.php | 30 +-- .../classes/HotelRoomConnected.php | 47 +++++ 7 files changed, 418 insertions(+), 181 deletions(-) create mode 100644 admin/themes/default/sass/partials/_qlotooltip.sass diff --git a/admin/themes/default/sass/admin-theme.sass b/admin/themes/default/sass/admin-theme.sass index 33b4084b0..92f9e4282 100644 --- a/admin/themes/default/sass/admin-theme.sass +++ b/admin/themes/default/sass/admin-theme.sass @@ -85,6 +85,7 @@ @import "partials/multistore" @import "partials/product" @import "partials/skeleton-loading" + @import "partials/qlotooltip" //Controllers @import "controllers/carrier-wizard" diff --git a/admin/themes/default/sass/partials/_qlotooltip.sass b/admin/themes/default/sass/partials/_qlotooltip.sass new file mode 100644 index 000000000..369a3c790 --- /dev/null +++ b/admin/themes/default/sass/partials/_qlotooltip.sass @@ -0,0 +1,100 @@ +.qlo-tooltip + display: none + position: absolute + top: 130% + left: 50% + transform: translateX(-50%) + z-index: 99999 + font-size: 11px !important + line-height: 1.35 !important + font-family: "Open Sans", Arial, sans-serif !important + text-align: left + color: #666 !important + background: #ffffff !important + border: 1px solid #e5e5e5 !important + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12) !important + padding: 10px 12px !important + border-radius: 4px !important + width: fit-content + min-width: 0 + max-width: none + +.qlo-tooltip-wrapper + position: relative + display: inline-block + cursor: pointer + color: #333 + +.qlo-tooltip-wrapper:hover .qlo-tooltip + display: block + +.qlo-tooltip.align-right + left: auto + right: 0 + transform: none + +.qlo-tooltip.align-left + left: 0 + transform: none + +.qlo-tooltip .qlo_tooltip_content, +.qlo-tooltip .qlo_tooltip_cont + width: 100% + +.qlo-tooltip .qlo_header + margin-bottom: 6px + +.qlo-tooltip .qlo_date + font-weight: 700 + font-size: 12px + color: #333 + white-space: nowrap + +.qlo-tooltip .qlo_body.grid + display: grid + grid-template-columns: repeat(2, minmax(0, max-content)) + gap: 10px 18px + justify-content: start + justify-items: start + width: max-content + +.qlo-tooltip .qlo_body.grid.single-col + grid-template-columns: 1fr + +.qlo-tooltip .qlo_body.grid.single-col .qlo_element + display: block + width: auto + +.qlo-tooltip.single-col + min-width: 0 + max-width: 240px + width: fit-content + +.qlo-tooltip .qlo_element_value + color: #666 + font-weight: 600 + +.qlo_tooltip_list + list-style: none !important + padding: 0 !important + margin: 0 !important + +.qlo_tooltip_list li + margin: 0 !important + padding: 0 !important + font-weight: 600 !important + color: #666 !important + +@media (max-width: 768px) + .qlo-tooltip + left: 0 + right: auto + transform: none + min-width: 0 + max-width: calc(100vw - 24px) + +.qlo-tooltip .qlo_element_heading + font-weight: 700 + color: #333 + margin-bottom: 2px + font-size: 11px diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 77f0e2b37..884fa5a80 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -122,7 +122,12 @@ data-target="#connectedRoomModal" data-id-room="{$room_info['id']|intval}" data-id-hotel="{$room_info['id_hotel']|intval}" data-room-num="{$room_info['room_num']|escape:'html':'UTF-8'}" data-room-type="{$room_info['id_product']|intval}"> - + + + + {if isset($room_info['connected_rooms_count'])}{$room_info['connected_rooms_count']|intval}{else}0{/if} + + {/if} @@ -596,6 +601,26 @@ border: 1px solid #f2f2f2; margin-top: 10px; } + .connected-room-icon-wrapper { + display: inline-flex; + align-items: center; + gap: 4px; + justify-content: center; + } + .connected-room-count { + min-width: 14px; + height: 14px; + padding: 0 3px; + border-radius: 9px; + background: #f5f5f5; + color: #666; + border: 1px solid #d5d5d5; + font-size: 9px; + line-height: 12px; + font-weight: 600; + text-align: center; + box-shadow: none; + } diff --git a/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl b/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl index fe023de40..66548ac80 100644 --- a/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl +++ b/admin/themes/default/template/controllers/products/modal-connected-rooms.tpl @@ -20,95 +20,75 @@ * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 *}

@@ -44,7 +44,7 @@
{include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}
@@ -53,7 +53,7 @@ languages=$languages input_name='meta_description' input_value=$product->meta_description - maxchar=160 + maxchar=255 }
@@ -91,16 +91,11 @@ -
-
- {foreach from=$languages item=language} -
- {l s='The product link will look like this:'}
- {if isset($rewritten_links[$language.id_lang][0])}{$rewritten_links[$language.id_lang][0]|escape:'html':'UTF-8'}{/if}{if isset($product->id)}{$product->link_rewrite[$language.id_lang]|escape:'html':'UTF-8'}{/if}{if isset($rewritten_links[$language.id_lang][1])}{$rewritten_links[$language.id_lang][1]|escape:'html':'UTF-8'}{/if} -
- {/foreach} -
-
+ {include file="seo_preview.tpl" + languages = $languages + preview_link = $rewritten_links|default:'' + inputs = ['meta_title'=>$product->meta_title ,'meta_description' => $product->meta_description,'link_rewrite' => $product->link_rewrite, 'name' => $product->name, 'description_short' => $product->description_short] + }
@@ -61,6 +61,10 @@ {/foreach} }); {/if} - $(".textarea-autosize").autosize(); + $(".textarea-autosize").each(function() { + var $ta = $(this), val = $ta.val(); + $ta.val('').autosize(); + if (val) { $ta.val(val).trigger('input'); } + }); diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index c07968f9d..fad6ca46e 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -32,9 +32,7 @@ {if isset($selectedRoomDemands) && $selectedRoomDemands} {/if} - {if isset($serviceProducts) && $serviceProducts} -
  • {l s='Services'}
  • - {/if} +
  • {l s='Services'}
  • {if isset($selectedRoomDemands) && $selectedRoomDemands} diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 0451cd31d..1482462e9 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1572,6 +1572,7 @@ id_room: idRoom, id_cart: idCart, id_product: idProduct, + id_customer: id_customer, id_hotel_cart_booking: idHotelCartBooking, action: 'getRoomTypeCartDemands', ajax: true @@ -1877,7 +1878,7 @@ {l s='Customer'}
    -
    +
    id_customer) && $cart->id_customer && isset($customer) && $customer }style="display:none;"{/if} class="form-group">
    -
    +
    + {if isset($cart->id_customer) && $cart->id_customer && isset($customer) && $customer } +
    +
    +
    + {$customer->firstname} {$customer->lastname} #{$customer->id} +
    + {$customer->email}
    +
    + +
    +
    + {/if} +
    {*
    {include file='controllers/orders/_current_cart_details_data.tpl'} - @@ -451,7 +456,7 @@ {l s='Transaction ID'} {l s='Amount'} {l s='Invoice'} - + @@ -463,6 +468,11 @@ {$payment['transaction_id']|escape:'html':'UTF-8'} {displayPrice price=$payment['real_paid_amount'] currency=$payment['id_currency']} {if isset($payment['invoice_number'])}{$payment['invoice_number']}{else}--{/if} + {if isset($receipt_management_active) && $receipt_management_active} + + {l s='Receipt'} + + {/if} {l s='Details'} @@ -707,7 +717,7 @@ {if isset($messages) && $messages}
    -  {l s='Order Private Notes'} +  {l s='Order Notes'}
    {foreach from=$messages item=message name=customerMessage} @@ -720,11 +730,11 @@ {$message['elastname']|escape:'html':'UTF-8'}{else}{$message['cfirstname']|escape:'html':'UTF-8'} {$message['clastname']|escape:'html':'UTF-8'} {/if},   - {dateFormat date=$message['date_add']} + {dateFormat date=$message.date_add full=1} - {if ($message['private'] == 1)} + {* {if ($message['private'] == 1)} {l s='Private'} - {/if} + {/if} *}

    {if !$smarty.foreach.customerMessage.last}
    {/if} @@ -1302,7 +1312,30 @@ {/if}
    - + {* Css for handling order disable status modal *} + + {strip} {addJsDefL name=no_rm_avail_txt}{l s='No room available.' js=1}{/addJsDefL} {addJsDefL name=no_realloc_rm_avail_txt}{l s='No room available for reallocation.' js=1}{/addJsDefL} @@ -1335,7 +1368,6 @@ {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL} {addJsDefL name='select_room_txt'}{l s='Select room' js=1}{/addJsDefL} {addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'} - {addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_IN=$ROOM_STATUS_CHECKED_IN|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_OUT=$ROOM_STATUS_CHECKED_OUT|escape:'quotes':'UTF-8'} {addJsDef ALLOTMENT_MANUAL=$ALLOTMENT_MANUAL|escape:'quotes':'UTF-8'} @@ -1346,4 +1378,4 @@ {addJsDefL name=txt_booking_document_delete_success}{l s='Document deleted successfully.' js=1}{/addJsDefL} {addJsDefL name='error_found_txt'}{l s='Errors found' js=1}{/addJsDefL} {/strip} -{/block} +{/block} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl index b9e6524cf..c9d897d84 100644 --- a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl @@ -128,6 +128,12 @@ {/if} +
    +
    + + +
    +
    {if isset($invoices_collection) && sizeof($invoices_collection)} +
    +
    + + +
    +
    + +
    +
    + + +
    +
    - \ No newline at end of file diff --git a/admin/themes/default/template/controllers/products/helpers/form/form.tpl b/admin/themes/default/template/controllers/products/helpers/form/form.tpl index 5a97a1cec..6b1030882 100644 --- a/admin/themes/default/template/controllers/products/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/products/helpers/form/form.tpl @@ -218,6 +218,7 @@ $('.product-tab-content').on('displayed', function(e) { $('#toolbar-footer').appendTo($(this).children('.product-tab')); + $(window).trigger('resize.autosize'); }); }); diff --git a/admin/themes/default/template/controllers/products/informations.tpl b/admin/themes/default/template/controllers/products/informations.tpl index cb97d2652..c8716ea36 100644 --- a/admin/themes/default/template/controllers/products/informations.tpl +++ b/admin/themes/default/template/controllers/products/informations.tpl @@ -104,7 +104,7 @@
    {include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}
    diff --git a/admin/themes/default/template/controllers/products/input_text_lang.tpl b/admin/themes/default/template/controllers/products/input_text_lang.tpl index 81f63038a..7f92a362c 100644 --- a/admin/themes/default/template/controllers/products/input_text_lang.tpl +++ b/admin/themes/default/template/controllers/products/input_text_lang.tpl @@ -39,7 +39,6 @@ class="form-control {if isset($input_class)}{$input_class} {/if}" name="{$input_name}_{$language.id_lang}" value="{$input_value[$language.id_lang]|default:''|escape:'html'}" - onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onblur="updateLinkRewrite();" {if isset($required)} required="required"{/if} {if isset($maxchar)} data-maxchar="{$maxchar}"{/if} diff --git a/admin/themes/default/template/controllers/products/seo.tpl b/admin/themes/default/template/controllers/products/seo.tpl index 8544f75a1..062d3ee5a 100644 --- a/admin/themes/default/template/controllers/products/seo.tpl +++ b/admin/themes/default/template/controllers/products/seo.tpl @@ -30,7 +30,7 @@
    {include file="controllers/products/multishop/checkbox.tpl" field="meta_title" type="default" multilang="true"}
    @@ -39,7 +39,7 @@ languages=$languages input_name='meta_title' input_value=$product->meta_title - maxchar=70 + maxchar=128 }
    @@ -47,7 +47,7 @@
    {include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}
    @@ -56,7 +56,7 @@ languages=$languages input_name='meta_description' input_value=$product->meta_description - maxchar=160 + maxchar=255 } @@ -94,16 +94,11 @@ -
    -
    - {foreach from=$languages item=language} -
    - {l s='The product link will look like this:'}
    - {if isset($rewritten_links[$language.id_lang][0])}{$rewritten_links[$language.id_lang][0]|escape:'html':'UTF-8'}{/if}{if isset($product->id)}{$product->link_rewrite[$language.id_lang]|escape:'html':'UTF-8'}{/if}{if isset($rewritten_links[$language.id_lang][1])}{$rewritten_links[$language.id_lang][1]|escape:'html':'UTF-8'}{/if} -
    - {/foreach} -
    -
    + {include file="seo_preview.tpl" + languages = $languages + preview_link = $rewritten_links|default:'' + inputs = ['meta_title'=>$product->meta_title ,'meta_description' => $product->meta_description,'link_rewrite' => $product->link_rewrite, 'name' => $product->name, 'description_short' => $product->description_short] + } @@ -64,6 +64,10 @@ {/foreach} }); {/if} - $(".textarea-autosize").autosize(); + $(".textarea-autosize").each(function() { + var $ta = $(this), val = $ta.val(); + $ta.val('').autosize(); + if (val) { $ta.val(val).trigger('input'); } + }); diff --git a/admin/themes/default/template/header.tpl b/admin/themes/default/template/header.tpl index 148be94a4..bb6f6f97f 100644 --- a/admin/themes/default/template/header.tpl +++ b/admin/themes/default/template/header.tpl @@ -298,6 +298,18 @@ {/if}