From 2b1ef726db7382e04f4d51213418daae69d0fb05 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Tue, 31 Mar 2026 18:03:35 +0530 Subject: [PATCH 01/21] 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 00f93226fdc83c0ec6eedaae252a2130273b1af2 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Tue, 7 Apr 2026 12:50:01 +0530 Subject: [PATCH 02/21] 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 03/21] 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 5994798d8decb8fc4e7c40385f1390b6e7742020 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Fri, 10 Apr 2026 12:28:23 +0530 Subject: [PATCH 04/21] chaned text from Webkul to Qloapps, and added qloapps hyperlink to it --- .../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 38c1cd38b..15906d128 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 821283169194237e3a0321a2a3707c212080c9bb Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 24 Apr 2026 15:42:44 +0530 Subject: [PATCH 05/21] fix: use order payment detail records as the canonical source for receipt generation --- .../controllers/orders/helpers/view/view.tpl | 7 +- classes/order/Order.php | 27 ++--- classes/order/OrderPayment.php | 23 ---- classes/order/OrderPaymentDetail.php | 47 ++++++++ classes/pdf/HTMLTemplatePaymentReceipt.php | 91 ++++++++------- .../admin/AdminPaymentReceiptsController.php | 107 ++++++++++++++---- controllers/admin/AdminPdfController.php | 39 ++++--- install/data/db_structure.sql | 2 +- pdf/payment-receipt.tpl | 23 ++-- ....tpl => payment.receipt.addresses-tab.tpl} | 23 ++-- pdf/payment.receipt.payment-info-tab.tpl | 50 ++++++++ ...-tab.tpl => payment.receipt.style-tab.tpl} | 25 ++-- pdf/receipt.payment-info-tab.tpl | 63 ----------- 13 files changed, 288 insertions(+), 239 deletions(-) rename pdf/{receipt.addresses-tab.tpl => payment.receipt.addresses-tab.tpl} (58%) create mode 100644 pdf/payment.receipt.payment-info-tab.tpl rename pdf/{receipt.style-tab.tpl => payment.receipt.style-tab.tpl} (82%) delete mode 100644 pdf/receipt.payment-info-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 11a6e1da7..e507ad5ae 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -419,11 +419,6 @@
 {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}> @@ -470,7 +465,7 @@ {if isset($payment['invoice_number'])}{$payment['invoice_number']}{else}--{/if} {if isset($receipt_management_active) && $receipt_management_active} - {l s='View'} + {l s='View'} {/if} diff --git a/classes/order/Order.php b/classes/order/Order.php index 336fbec2e..a62293679 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1874,16 +1874,6 @@ 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'); @@ -1915,7 +1905,15 @@ class OrderCore extends ObjectModel $order_payment_detail->id_order = $this->id; $order_payment_detail->id_order_payment = (int)$payment->id; $order_payment_detail->amount = $amount; + $receipt_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 ($receipt_number) { + Configuration::updateValue('PS_PAYMENT_RECEIPTS_START_NUMBER', false, false, null, $this->id_shop); + }else{ + $receipt_number = OrderPaymentDetail::getLastPaymentReceiptNumber() + 1; + } + $order_payment_detail->receipt_number = $receipt_number; if ($payment->id_currency == $this->id_currency) { $this->total_paid_real += $order_payment_detail->amount; } else { @@ -1945,15 +1943,6 @@ 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); - } - /** diff --git a/classes/order/OrderPayment.php b/classes/order/OrderPayment.php index 4ad21bf86..c20215785 100644 --- a/classes/order/OrderPayment.php +++ b/classes/order/OrderPayment.php @@ -32,7 +32,6 @@ class OrderPaymentCore extends ObjectModel public $order_reference; public $id_currency; - public $number; public $amount; public $payment_method; public $payment_type; @@ -53,7 +52,6 @@ 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), @@ -162,25 +160,4 @@ 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/order/OrderPaymentDetail.php b/classes/order/OrderPaymentDetail.php index f1e616bc8..72ae48635 100644 --- a/classes/order/OrderPaymentDetail.php +++ b/classes/order/OrderPaymentDetail.php @@ -26,6 +26,7 @@ class OrderPaymentDetailCore extends ObjectModel public $id_order_payment; public $id_order; public $amount; + public $receipt_number; public $date_add; public static $definition = array( @@ -35,6 +36,7 @@ class OrderPaymentDetailCore extends ObjectModel 'id_order_payment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true), + 'receipt_number' => array('type' => self::TYPE_INT, 'validate' => 'isGenericName', 'size' => 64), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ) ); @@ -71,4 +73,49 @@ class OrderPaymentDetailCore extends ObjectModel WHERE oip.`id_order_invoice` = '.(int)$id_invoice ); } + + public static function getLastPaymentReceiptNumber() + { + $sql = 'SELECT MAX(`receipt_number`) FROM `'._DB_PREFIX_.'order_payment_detail`'; + if (Configuration::get('PS_PAYMENT_RECEIPTS_RESET')) { + $sql .= ' WHERE DATE_FORMAT(`date_add`, "%Y") = '.(int)date('Y'); + } + return Db::getInstance()->getValue($sql); + } + + public static function getPaymentDetailsByPaymentId($id_order_payment) + { + return Db::getInstance()->executeS(' + SELECT * + FROM `'._DB_PREFIX_.'order_payment_detail` + WHERE `id_order_payment` = '.(int)$id_order_payment + ); + } + + public static function getByDateInterval($date_from, $date_to) + { + $payment_list = Db::getInstance()->executeS(' + SELECT DISTINCT opd.* + FROM `'._DB_PREFIX_.'order_payment_detail` opd + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = opd.`id_order`) + WHERE DATE_ADD(opd.`date_add`, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' + AND opd.`date_add` >= \''.pSQL($date_from).'\' + AND opd.`receipt_number` > 0 + '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' + ORDER BY opd.`date_add` ASC, opd.`id_order_payment_detail` ASC + '); + + return ObjectModel::hydrateCollection('OrderPaymentDetail', $payment_list); + } + + 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->receipt_number, date('Y', strtotime($this->date_add))); + } } diff --git a/classes/pdf/HTMLTemplatePaymentReceipt.php b/classes/pdf/HTMLTemplatePaymentReceipt.php index f6ea80f9e..cb6762205 100644 --- a/classes/pdf/HTMLTemplatePaymentReceipt.php +++ b/classes/pdf/HTMLTemplatePaymentReceipt.php @@ -1,53 +1,60 @@ - * @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 - */ +* 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 +*/ /** * @since 1.5 */ class HTMLTemplatePaymentReceiptCore extends HTMLTemplate { + public $paymentReceipt; public $orderPayment; public $order; /** - * @param OrderPayment $orderPayment + * @param OrderPaymentDetail $paymentReceipt * @param $smarty * @throws PrestaShopException */ - public function __construct(OrderPayment $orderPayment, $smarty, $bulk_mode = false) + public function __construct(OrderPaymentDetail $paymentReceipt, $smarty, $bulk_mode = false) { - $id_order = (int) Tools::getValue('id_order'); - $this->orderPayment = $orderPayment; - $this->order = new Order((int)$id_order); + $this->paymentReceipt = $paymentReceipt; $this->smarty = $smarty; - // header informations - $this->date = Tools::displayDate($this->orderPayment->date_add); + $this->date = Tools::displayDate($this->paymentReceipt->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); - + $this->orderPayment = new OrderPayment((int)$this->paymentReceipt->id_order_payment); + if (!Validate::isLoadedObject($this->orderPayment)) { + throw new PrestaShopException('Cannot load the payment associated with this payment receipt.'); + } + + $this->order = new Order((int)$this->paymentReceipt->id_order); + + if (!Validate::isLoadedObject($this->order)) { + throw new PrestaShopException('Cannot load the order associated with this payment receipt.'); + } + + $id_shop = (int)$this->order->id_shop; + $this->shop = new Shop($id_shop); + $this->orderPayment->amount = $this->paymentReceipt->amount; + $this->title = $this->paymentReceipt->getPaymentReceiptNumberFormated($id_lang, $id_shop); } /** @@ -122,19 +129,19 @@ class HTMLTemplatePaymentReceiptCore extends HTMLTemplate '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')), + $smarty_tpls = array( + 'style_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.receipt.style-tab')), + 'addresses_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.receipt.addresses-tab')), + 'payment_info_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.receipt.payment-info-tab')), ); - $this->smarty->assign($tpls); - $html = $this->smarty->fetch($this->getTemplate('payment-receipt')); - return($html); + $this->smarty->assign($smarty_tpls); + return $this->smarty->fetch($this->getTemplate('payment-receipt')); + } public function getFilename() { - return 'payment-receipt-'.sprintf('%06d', $this->orderPayment->id).'.pdf'; + return 'payment-receipt-'.sprintf('%06d', $this->paymentReceipt->id).'.pdf'; } public function getBulkFilename() @@ -161,4 +168,4 @@ class HTMLTemplatePaymentReceiptCore extends HTMLTemplate } return $paymentTypeName; } -} \ No newline at end of file +} diff --git a/controllers/admin/AdminPaymentReceiptsController.php b/controllers/admin/AdminPaymentReceiptsController.php index 44336b9f1..3643a6d5b 100644 --- a/controllers/admin/AdminPaymentReceiptsController.php +++ b/controllers/admin/AdminPaymentReceiptsController.php @@ -1,28 +1,26 @@ -* @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 +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 */ + class AdminPaymentReceiptsControllerCore extends AdminControllerCore { public function __construct() @@ -61,7 +59,7 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore ), '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), + '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).'), OrderPaymentDetail::getLastPaymentReceiptNumber() + 1), 'size' => 6, 'type' => 'text', 'cast' => 'intval' @@ -77,13 +75,6 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore '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')) @@ -98,6 +89,8 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore $this->initToolbar(); $this->initPageHeaderToolbar(); $this->table = 'order_payment'; + $this->content .= $this->initFormByDate(); + $this->content .= $this->renderOptions(); $this->context->smarty->assign(array( @@ -109,6 +102,50 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore )); } + public function initFormByDate() + { + $this->fields_form = array( + 'legend' => array( + 'title' => $this->l('By date'), + 'icon' => 'icon-calendar' + ), + 'input' => array( + array( + 'type' => 'date', + 'label' => $this->l('From'), + 'name' => 'date_from', + 'maxlength' => 10, + 'required' => true, + 'hint' => $this->l('Format: 2011-12-31 (inclusive).') + ), + array( + 'type' => 'date', + 'label' => $this->l('To'), + 'name' => 'date_to', + 'maxlength' => 10, + 'required' => true, + 'hint' => $this->l('Format: 2012-12-31 (inclusive).') + ) + ), + 'submit' => array( + 'title' => $this->l('Generate PDF file by date'), + 'id' => 'submitPrint', + 'icon' => 'process-icon-download-alt' + ) + ); + + $this->fields_value = array( + 'date_from' => date('Y-m-d'), + 'date_to' => date('Y-m-d') + ); + + $this->table = 'order_payment'; + $this->show_toolbar = false; + $this->show_form_cancel_button = false; + $this->toolbar_title = $this->l('Print PDF invoices'); + return parent::renderForm(); + } + public function initToolbarTitle() { $this->toolbar_title = array_unique($this->breadcrumbs); @@ -122,13 +159,33 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore public function postProcess() { - parent::postProcess(); + if(Tools::isSubmit('submitAddorder_payment')) { + if (!Validate::isDate(Tools::getValue('date_from'))) { + $this->errors[] = $this->l('Invalid "From" date'); + } + + if (!Validate::isDate(Tools::getValue('date_to'))) { + $this->errors[] = $this->l('Invalid "To" date'); + } + if(Tools::getValue('date_from') > Tools::getValue('date_to')) { + $this->errors[] = $this->l('"From" date must be earlier than "To" date'); + } + if (!count($this->errors)) { + if (count(OrderPaymentDetail::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')))) { + Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generatePaymentReceiptsPDF&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to'))); + } + + $this->errors[] = $this->l('No payment receipt has been found for this period.'); + } + }else{ + 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().')'; + if ((int)Tools::getValue('PS_PAYMENT_RECEIPTS_START_NUMBER') != 0 && (int)Tools::getValue('PS_PAYMENT_RECEIPTS_START_NUMBER') <= OrderPaymentDetail::getLastPaymentReceiptNumber()) { + $this->errors[] = $this->l('Invalid receipt number.').OrderPaymentDetail::getLastPaymentReceiptNumber().')'; } } } diff --git a/controllers/admin/AdminPdfController.php b/controllers/admin/AdminPdfController.php index 279529b2a..2e534d75b 100644 --- a/controllers/admin/AdminPdfController.php +++ b/controllers/admin/AdminPdfController.php @@ -156,29 +156,28 @@ class AdminPdfControllerCore extends AdminController $this->generatePDF($supply_order, PDF::TEMPLATE_SUPPLY_ORDER_FORM); } + public function processGeneratePaymentReceiptsPDF() + { + $order_payment_collection = OrderPaymentDetail::getByDateInterval( + Tools::getValue('date_from'), + Tools::getValue('date_to') + ); + + if (!count($order_payment_collection)) { + die(Tools::displayError('No payment receipt was found.')); + } + + $this->generatePDF($order_payment_collection, PDF::TEMPLATE_PAYMENT_RECEIPT); + } + 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.')); + $idOrderPaymentDetail = (int) Tools::getValue('id_order_payment_detail'); + $orderPaymentDetail = new OrderPaymentDetail($idOrderPaymentDetail); + if (!Validate::isLoadedObject($orderPaymentDetail)) { + die(Tools::displayError('The order payment detail cannot be found.')); } - - 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); + $this->generatePDF($orderPaymentDetail, PDF::TEMPLATE_PAYMENT_RECEIPT); } diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 8cfeeb755..71fb5e17a 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -1496,7 +1496,6 @@ 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, @@ -1515,6 +1514,7 @@ CREATE TABLE `PREFIX_order_payment_detail` ( `id_order_payment` INT(10) unsigned NOT NULL, `id_order` INT(10) unsigned NOT NULL, `amount` DECIMAL(10,2) NOT NULL, + `receipt_number` INT(10) NOT NULL, `date_add` DATETIME NOT NULL, PRIMARY KEY (`id_order_payment_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; diff --git a/pdf/payment-receipt.tpl b/pdf/payment-receipt.tpl index 470b49eae..a0a0141d3 100644 --- a/pdf/payment-receipt.tpl +++ b/pdf/payment-receipt.tpl @@ -1,26 +1,23 @@ {* -* 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. +* 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: -* http://opensource.org/licenses/afl-3.0.php +* 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 license@prestashop.com so we can send you a copy immediately. +* 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 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. +* 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 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 +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 *} {$style_tab} diff --git a/pdf/receipt.addresses-tab.tpl b/pdf/payment.receipt.addresses-tab.tpl similarity index 58% rename from pdf/receipt.addresses-tab.tpl rename to pdf/payment.receipt.addresses-tab.tpl index df5e70de0..2ca023cbe 100644 --- a/pdf/receipt.addresses-tab.tpl +++ b/pdf/payment.receipt.addresses-tab.tpl @@ -1,26 +1,23 @@ {* -* 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. +* 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: -* http://opensource.org/licenses/afl-3.0.php +* 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 license@prestashop.com so we can send you a copy immediately. +* 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 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. +* 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 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 +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 *} diff --git a/pdf/payment.receipt.payment-info-tab.tpl b/pdf/payment.receipt.payment-info-tab.tpl new file mode 100644 index 000000000..307bc1de1 --- /dev/null +++ b/pdf/payment.receipt.payment-info-tab.tpl @@ -0,0 +1,50 @@ +{* +* 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($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 Method' pdf='true'}{l s='Payment Type' pdf='true'}{l s='Transaction ID' pdf='true'}{l s='Amount' pdf='true'}{l s='Payment Date' pdf='true'}
{$payment->payment_method}{$payment->payment_type}{$payment->transaction_id}{displayPrice currency=$payment->id_currency price=$payment->amount}{dateFormat date=$payment->date_add full=true}
+{/if} \ No newline at end of file diff --git a/pdf/receipt.style-tab.tpl b/pdf/payment.receipt.style-tab.tpl similarity index 82% rename from pdf/receipt.style-tab.tpl rename to pdf/payment.receipt.style-tab.tpl index e34c365c9..e6fb20ae7 100644 --- a/pdf/receipt.style-tab.tpl +++ b/pdf/payment.receipt.style-tab.tpl @@ -1,26 +1,23 @@ {* -* 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. +* 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: -* http://opensource.org/licenses/afl-3.0.php +* 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 license@prestashop.com so we can send you a copy immediately. +* 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 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. +* 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 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 +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 *} {assign var=color_header value="#F0F0F0"} @@ -150,7 +147,7 @@ } .left { - text-align: left; + text-align: left!important; } .fright { diff --git a/pdf/receipt.payment-info-tab.tpl b/pdf/receipt.payment-info-tab.tpl deleted file mode 100644 index d39879c19..000000000 --- a/pdf/receipt.payment-info-tab.tpl +++ /dev/null @@ -1,63 +0,0 @@ -{* -* 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 From 9376843be4f919d168cfcdfb69939fa9b5680f88 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Wed, 29 Apr 2026 11:03:38 +0530 Subject: [PATCH 06/21] composer updated --- composer.json | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 0e5523d61..38b986fee 100644 --- a/composer.json +++ b/composer.json @@ -4,29 +4,53 @@ "type": "project", "homepage": "https://qloapps.com", "license": "OSL-3.0", + "keywords": [ + "hotel", + "hotel-management", + "booking", + "booking-engine", + "reservation", + "hospitality", + "property-management", + "qloapps", + "cms" + ], "authors": [ { "name": "QloApps", - "email": "support@qloapps.com" + "email": "support@qloapps.com", + "homepage": "https://qloapps.com" }, { "name": "QloApps Community", - "homepage": "https://qloapps.com" + "homepage": "https://github.com/Qloapps/QloApps/graphs/contributors" } ], "support": { + "docs": "https://qloapps.com/docs/", + "email": "support@qloapps.com", "forum": "https://forums.qloapps.com/", "issues": "https://github.com/Qloapps/QloApps/issues", "source": "https://github.com/Qloapps/QloApps" }, "require": { - "php": ">=8.0 <8.5", - "ext-simplexml": "*", + "php": ">8.0 <8.5", "ext-curl": "*", + "ext-dom": "*", "ext-gd": "*", - "ext-zip": "*", - "ext-soap": "*" + "ext-intl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-pdo": "*", + "ext-phar": "*", + "ext-simplexml": "*", + "ext-soap": "*", + "ext-zip": "*" }, - "minimum-stability": "dev", - "prefer-stable": true + "minimum-stability": "stable", + "prefer-stable": true, + "config": { + "sort-packages": true + } } \ No newline at end of file From c5e73506de11a584de16697c173dc7109af71061 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Fri, 1 May 2026 17:25:32 +0530 Subject: [PATCH 09/21] update file names --- classes/pdf/HTMLTemplatePaymentReceipt.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/pdf/HTMLTemplatePaymentReceipt.php b/classes/pdf/HTMLTemplatePaymentReceipt.php index cb6762205..27374e5e3 100644 --- a/classes/pdf/HTMLTemplatePaymentReceipt.php +++ b/classes/pdf/HTMLTemplatePaymentReceipt.php @@ -130,9 +130,9 @@ class HTMLTemplatePaymentReceiptCore extends HTMLTemplate )); $smarty_tpls = array( - 'style_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.receipt.style-tab')), - 'addresses_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.receipt.addresses-tab')), - 'payment_info_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.receipt.payment-info-tab')), + 'style_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.style-tab')), + 'addresses_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.addresses-tab')), + 'payment_info_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.payment-info-tab')), ); $this->smarty->assign($smarty_tpls); return $this->smarty->fetch($this->getTemplate('payment-receipt')); From 3ae1dd20a9af99f0bb446aa1068cc47ce6858d10 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Mon, 4 May 2026 12:01:10 +0530 Subject: [PATCH 10/21] update desc hint in configuration --- controllers/admin/AdminPaymentReceiptsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminPaymentReceiptsController.php b/controllers/admin/AdminPaymentReceiptsController.php index 3643a6d5b..2d76d03ab 100644 --- a/controllers/admin/AdminPaymentReceiptsController.php +++ b/controllers/admin/AdminPaymentReceiptsController.php @@ -37,7 +37,7 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore '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).'), + 'desc' => $this->l('If enabled, receipts will be generated for orders.'), 'cast' => 'intval', 'type' => 'bool' ), From fef0be689a24511950dd371622e7296eb2183f38 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 4 May 2026 12:56:56 +0530 Subject: [PATCH 11/21] composer updated --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index 38b986fee..0878ca817 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,11 @@ "ext-soap": "*", "ext-zip": "*" }, + "require-dev": { + }, + "autoload": { + "classmap": ["classes/", "Core/", "Adapter/"] + }, "minimum-stability": "stable", "prefer-stable": true, "config": { From 114d9498d83234ccd0309ccc65c22b26a79af970 Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Tue, 5 May 2026 11:19:59 +0530 Subject: [PATCH 12/21] Fixed: Fix code review changes Co-authored-by: Name --- .../controllers/orders/helpers/view/view.tpl | 2 +- classes/order/Order.php | 22 +++++++++++ classes/pdf/HTMLTemplatePaymentReceipt.php | 12 +++--- controllers/admin/AdminOrdersController.php | 28 +++----------- .../admin/AdminPaymentReceiptsController.php | 2 +- ....tpl => payment-receipt.addresses-tab.tpl} | 0 ...l => payment-receipt.payment-info-tab.tpl} | 38 +++++++++---------- ...-tab.tpl => payment-receipt.style-tab.tpl} | 0 8 files changed, 54 insertions(+), 50 deletions(-) rename pdf/{payment.receipt.addresses-tab.tpl => payment-receipt.addresses-tab.tpl} (100%) rename pdf/{payment.receipt.payment-info-tab.tpl => payment-receipt.payment-info-tab.tpl} (53%) rename pdf/{payment.receipt.style-tab.tpl => payment-receipt.style-tab.tpl} (100%) 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 e507ad5ae..15d63afd7 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -465,7 +465,7 @@ {if isset($payment['invoice_number'])}{$payment['invoice_number']}{else}--{/if} {if isset($receipt_management_active) && $receipt_management_active} - {l s='View'} + {l s='Receipt'} {/if} diff --git a/classes/order/Order.php b/classes/order/Order.php index a62293679..e5ed30602 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -3158,4 +3158,26 @@ class OrderCore extends ObjectModel return $totalOrder; } + + public function getPaymentsTypes() + { + $module = Module::getInstanceByName('hotelreservationsystem'); + return array( + OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL => array( + 'key' => 'PAYMENT_TYPE_PAY_AT_HOTEL', + 'value' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL, + 'name' => $module->l('Pay at hotel') + ), + OrderPayment::PAYMENT_TYPE_ONLINE => array( + 'key' => 'PAYMENT_TYPE_ONLINE', + 'value' => OrderPayment::PAYMENT_TYPE_ONLINE, + 'name' => $module->l('Online') + ), + OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT => array( + 'key' => 'PAYMENT_TYPE_REMOTE_PAYMENT', + 'value' => OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT, + 'name' => $module->l('Remote payment') + ), + ); + } } diff --git a/classes/pdf/HTMLTemplatePaymentReceipt.php b/classes/pdf/HTMLTemplatePaymentReceipt.php index 27374e5e3..ec5ab1c87 100644 --- a/classes/pdf/HTMLTemplatePaymentReceipt.php +++ b/classes/pdf/HTMLTemplatePaymentReceipt.php @@ -113,9 +113,9 @@ class HTMLTemplatePaymentReceiptCore extends HTMLTemplate } } $customer = new Customer((int)$this->order->id_customer); - - $this->orderPayment->payment_type = $this->getPaymentType($this->orderPayment->payment_type); - + $getPaymentTypes = $this->order->getPaymentsTypes(); + $this->orderPayment->payment_type = isset($getPaymentTypes[$this->orderPayment->payment_type]) ? $getPaymentTypes[$this->orderPayment->payment_type] : null; + $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( @@ -130,9 +130,9 @@ class HTMLTemplatePaymentReceiptCore extends HTMLTemplate )); $smarty_tpls = array( - 'style_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.style-tab')), - 'addresses_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.addresses-tab')), - 'payment_info_tab' => $this->smarty->fetch($this->getTemplate('payment.receipt.payment-info-tab')), + 'style_tab' => $this->smarty->fetch($this->getTemplate('payment-receipt.style-tab')), + 'addresses_tab' => $this->smarty->fetch($this->getTemplate('payment-receipt.addresses-tab')), + 'payment_info_tab' => $this->smarty->fetch($this->getTemplate('payment-receipt.payment-info-tab')), ); $this->smarty->assign($smarty_tpls); return $this->smarty->fetch($this->getTemplate('payment-receipt')); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 1817c0269..f35954d26 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -419,7 +419,9 @@ class AdminOrdersControllerCore extends AdminController } $paymentTypes = array(); - foreach ($this->getPaymentsTypes() as $paymentType) { + $objOrder = new Order(); + + foreach ($objOrder->getPaymentsTypes() as $paymentType) { if ($paymentType['value'] != OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT) { $paymentTypes[] = $paymentType; } @@ -683,7 +685,7 @@ class AdminOrdersControllerCore extends AdminController 'order' => $objOrder, 'currencies' => $currencies, 'payment_methods' => $payment_methods, - 'payment_types' => $this->getPaymentsTypes(), + 'payment_types' => $objOrder->getPaymentsTypes(), 'invoices_collection' => $objOrder->getInvoicesCollection(), 'current_id_lang' => $this->context->language->id, ) @@ -3674,7 +3676,7 @@ class AdminOrdersControllerCore extends AdminController 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, - 'payment_types' => $this->getPaymentsTypes(), + 'payment_types' => $order->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'), @@ -7137,26 +7139,6 @@ class AdminOrdersControllerCore extends AdminController return $products; } - protected function getPaymentsTypes() - { - return array( - OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL => array( - 'key' => 'PAYMENT_TYPE_PAY_AT_HOTEL', - 'value' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL, - 'name' => $this->l('Pay at hotel') - ), - OrderPayment::PAYMENT_TYPE_ONLINE => array( - 'key' => 'PAYMENT_TYPE_ONLINE', - 'value' => OrderPayment::PAYMENT_TYPE_ONLINE, - 'name' => $this->l('Online') - ), - OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT => array( - 'key' => 'PAYMENT_TYPE_REMOTE_PAYMENT', - 'value' => OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT, - 'name' => $this->l('Remote payment') - ), - ); - } /** * @param OrderInvoice $order_invoice diff --git a/controllers/admin/AdminPaymentReceiptsController.php b/controllers/admin/AdminPaymentReceiptsController.php index 2d76d03ab..1ca890269 100644 --- a/controllers/admin/AdminPaymentReceiptsController.php +++ b/controllers/admin/AdminPaymentReceiptsController.php @@ -37,7 +37,7 @@ class AdminPaymentReceiptsControllerCore extends AdminControllerCore 'fields' => array( 'PS_PAYMENT_RECEIPTS' => array( 'title' => $this->l('Enable Receipts'), - 'desc' => $this->l('If enabled, receipts will be generated for orders.'), + 'desc' => $this->l('If enabled, receipts will be generated for order payments.'), 'cast' => 'intval', 'type' => 'bool' ), diff --git a/pdf/payment.receipt.addresses-tab.tpl b/pdf/payment-receipt.addresses-tab.tpl similarity index 100% rename from pdf/payment.receipt.addresses-tab.tpl rename to pdf/payment-receipt.addresses-tab.tpl diff --git a/pdf/payment.receipt.payment-info-tab.tpl b/pdf/payment-receipt.payment-info-tab.tpl similarity index 53% rename from pdf/payment.receipt.payment-info-tab.tpl rename to pdf/payment-receipt.payment-info-tab.tpl index 307bc1de1..048dd3171 100644 --- a/pdf/payment.receipt.payment-info-tab.tpl +++ b/pdf/payment-receipt.payment-info-tab.tpl @@ -21,30 +21,30 @@ *} {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 Method' pdf='true'} {l s='Payment Type' pdf='true'} {l s='Transaction ID' pdf='true'} {l s='Amount' pdf='true'} {l s='Payment Date' pdf='true'}
{$payment->payment_method}{$payment->payment_type}{$payment->transaction_id}{displayPrice currency=$payment->id_currency price=$payment->amount}{dateFormat date=$payment->date_add full=true}
+ + + + {foreach from=$payment_list key=rm_k item=payment} + {cycle values=["color_line_even", "color_line_odd"] assign=bgcolor_class} + + {$payment->payment_method|default:'-'} + {$payment->payment_type.name|default:'-'} + {$payment->transaction_id|default:'-'} + {displayPrice currency=$payment->id_currency price=$payment->amount} + {dateFormat date=$payment->date_add full=true} + + {/foreach} + + {/if} \ No newline at end of file diff --git a/pdf/payment.receipt.style-tab.tpl b/pdf/payment-receipt.style-tab.tpl similarity index 100% rename from pdf/payment.receipt.style-tab.tpl rename to pdf/payment-receipt.style-tab.tpl From 476d3b5756bd26983e3ad6ac7c2ebc54e6cb78fb Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Fri, 29 May 2026 20:06:53 +0530 Subject: [PATCH 13/21] Fixed: Show correct check-in and check-out time in order detail page and invoice based on date format selected from languages from back-office Co-authored-by: Name --- classes/pdf/HTMLTemplateInvoice.php | 15 +++++++++++++-- controllers/admin/AdminOrdersController.php | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index c23fdd280..7fd8aefae 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -363,6 +363,17 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $objBookingDemand = new HotelBookingDemands(); foreach ($order_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); + $display_date_from = $data_v['date_from']; + $display_date_to = $data_v['date_to']; + $objHotelBranchInformation = new HotelBranchInformation($data_v['id_hotel']); + if ($objHotelBranchInformation->check_in) { + $display_date_from = date('Y-m-d', strtotime($data_v['date_from'])) + . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in)); + } + if ($objHotelBranchInformation->check_out) { + $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) + . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out)); + } /*Product price when order was created*/ $order_details_obj = new OrderDetail($data_v['id_order_detail']); @@ -474,8 +485,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $fullDate = (isset($context->controller->show_full_date) && $context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false; - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from'], null, $fullDate); - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to'], null, $fullDate); + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, $fullDate); + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, $fullDate); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 8a3722b84..affff25da 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3395,6 +3395,16 @@ class AdminOrdersControllerCore extends AdminController $objBookingDemand = new HotelBookingDemands(); $objHotelRoomType = new HotelRoomType(); foreach ($order_detail_data as $key => $value) { + $objHotelBranchInformation = new HotelBranchInformation($value['id_hotel']); + if ($objHotelBranchInformation->check_in) { + $order_detail_data[$key]['date_from'] = date('Y-m-d', strtotime($value['date_from'])) + . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in)); + } + if ($objHotelBranchInformation->check_out) { + $order_detail_data[$key]['date_to'] = date('Y-m-d', strtotime($value['date_to'])) + . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out)); + } + $order_detail_data[$key]['total_room_price_te'] = $value['total_price_tax_excl']; $order_detail_data[$key]['total_room_price_ti'] = $value['total_price_tax_incl']; @@ -3624,6 +3634,16 @@ class AdminOrdersControllerCore extends AdminController // get booking information by order $bookingOrderInfo = $objBookingDetail->getBookingDataByOrderId($order->id); foreach ($bookingOrderInfo as &$bookingOrderRoomInfo) { + $objHotelBranchInformation = new HotelBranchInformation($bookingOrderRoomInfo['id_hotel']); + if ($objHotelBranchInformation->check_in) { + $bookingOrderRoomInfo['date_from'] = date('Y-m-d', strtotime($bookingOrderRoomInfo['date_from'])) + . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in)); + } + if ($objHotelBranchInformation->check_out) { + $bookingOrderRoomInfo['date_to'] = date('Y-m-d', strtotime($bookingOrderRoomInfo['date_to'])) + . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out)); + } + // Get last refund request for booking if ($bookingRefundDetail = OrderReturn::getOrdersReturnDetail($bookingOrderRoomInfo['id_order'], 0, $bookingOrderRoomInfo['id'])) { $bookingRefundDetail = reset($bookingRefundDetail); From c3abb0d067c7f69c8775db208f447f08f378ce78 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Tue, 2 Jun 2026 16:30:34 +0530 Subject: [PATCH 14/21] Updated: spacing issue --- .../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 15906d128..eb3541799 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 d3d0ba26ee336871319cb47abe3ce7fc8d7a5c5e Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Tue, 2 Jun 2026 18:56:53 +0530 Subject: [PATCH 15/21] Fixed: Display dynamic check-in and check-out times in invoice PDF based on room booking status, and remove changes from order detail page Co-authored-by: Name --- classes/pdf/HTMLTemplateInvoice.php | 40 +++++++++++++-------- controllers/admin/AdminOrdersController.php | 20 ----------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 7fd8aefae..7c79514f7 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -363,17 +363,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $objBookingDemand = new HotelBookingDemands(); foreach ($order_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); - $display_date_from = $data_v['date_from']; - $display_date_to = $data_v['date_to']; - $objHotelBranchInformation = new HotelBranchInformation($data_v['id_hotel']); - if ($objHotelBranchInformation->check_in) { - $display_date_from = date('Y-m-d', strtotime($data_v['date_from'])) - . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in)); - } - if ($objHotelBranchInformation->check_out) { - $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) - . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out)); - } /*Product price when order was created*/ $order_details_obj = new OrderDetail($data_v['id_order_detail']); @@ -484,9 +473,32 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $num_days = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; - $fullDate = (isset($context->controller->show_full_date) && $context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false; - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, $fullDate); - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, $fullDate); + $display_date_from = $data_v['date_from']; + $display_date_to = $data_v['date_to']; + if ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_OUT) { + if ($data_v['check_in']) { + $display_date_from = $data_v['check_in']; + } + if ($data_v['check_out']) { + $display_date_to = $data_v['check_out']; + } + } elseif ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_IN) { + if ($data_v['check_in']) { + $display_date_from = $data_v['check_in']; + } + if ($data_v['check_out_time']) { + $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time'])); + } + } else { + if ($data_v['check_in_time']) { + $display_date_from = date('Y-m-d', strtotime($data_v['date_from'])) . ' ' . date('H:i:s', strtotime($data_v['check_in_time'])); + } + if ($data_v['check_out_time']) { + $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time'])); + } + } + ppp($cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, true)); + ppp($cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, true)); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index affff25da..8a3722b84 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3395,16 +3395,6 @@ class AdminOrdersControllerCore extends AdminController $objBookingDemand = new HotelBookingDemands(); $objHotelRoomType = new HotelRoomType(); foreach ($order_detail_data as $key => $value) { - $objHotelBranchInformation = new HotelBranchInformation($value['id_hotel']); - if ($objHotelBranchInformation->check_in) { - $order_detail_data[$key]['date_from'] = date('Y-m-d', strtotime($value['date_from'])) - . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in)); - } - if ($objHotelBranchInformation->check_out) { - $order_detail_data[$key]['date_to'] = date('Y-m-d', strtotime($value['date_to'])) - . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out)); - } - $order_detail_data[$key]['total_room_price_te'] = $value['total_price_tax_excl']; $order_detail_data[$key]['total_room_price_ti'] = $value['total_price_tax_incl']; @@ -3634,16 +3624,6 @@ class AdminOrdersControllerCore extends AdminController // get booking information by order $bookingOrderInfo = $objBookingDetail->getBookingDataByOrderId($order->id); foreach ($bookingOrderInfo as &$bookingOrderRoomInfo) { - $objHotelBranchInformation = new HotelBranchInformation($bookingOrderRoomInfo['id_hotel']); - if ($objHotelBranchInformation->check_in) { - $bookingOrderRoomInfo['date_from'] = date('Y-m-d', strtotime($bookingOrderRoomInfo['date_from'])) - . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in)); - } - if ($objHotelBranchInformation->check_out) { - $bookingOrderRoomInfo['date_to'] = date('Y-m-d', strtotime($bookingOrderRoomInfo['date_to'])) - . ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out)); - } - // Get last refund request for booking if ($bookingRefundDetail = OrderReturn::getOrdersReturnDetail($bookingOrderRoomInfo['id_order'], 0, $bookingOrderRoomInfo['id'])) { $bookingRefundDetail = reset($bookingRefundDetail); From 757c72de09d6ab1c732dc75082468488586b0439 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Tue, 2 Jun 2026 19:05:51 +0530 Subject: [PATCH 16/21] Removed: extra code for debugging Co-authored-by: Name --- classes/pdf/HTMLTemplateInvoice.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 7c79514f7..e5b36b518 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -473,6 +473,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $num_days = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; + $fullDate = (isset($context->controller->show_full_date) && $context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false; $display_date_from = $data_v['date_from']; $display_date_to = $data_v['date_to']; if ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_OUT) { @@ -497,8 +498,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time'])); } } - ppp($cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, true)); - ppp($cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, true)); + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, true); + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, true); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; From 4b1f340b319d7bd856a02cb9695de3410d7a2d0b Mon Sep 17 00:00:00 2001 From: Amit sharma Date: Thu, 4 Jun 2026 18:24:10 +0530 Subject: [PATCH 17/21] fix: make rating field optional for hotels --- .../hotelreservationsystem/classes/HotelBranchInformation.php | 4 ++-- .../controllers/admin/AdminAddHotelController.php | 4 ---- .../views/templates/admin/add_hotel/helpers/form/form.tpl | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index b4fb0ada8..0797c7035 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -51,7 +51,7 @@ class HotelBranchInformation extends ObjectModel 'fields' => array( 'id_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'email' => array('type' => self::TYPE_STRING,'validate' => 'isEmail', 'size' => 255, 'required' => true), - 'rating' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'rating' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'check_in' => array('type' => self::TYPE_STRING, 'required' => true), 'check_out' => array('type' => self::TYPE_STRING, 'required' => true), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), @@ -1160,7 +1160,7 @@ class HotelBranchInformation extends ObjectModel { // set additional hotel address and restriction fields validations here if (isset($this->webservice_validation) && $this->webservice_validation) { - if ($this->rating < 1 || $this->rating > 5) { + if ($this->rating && ($this->rating < 1 || $this->rating > 5)) { $message = Tools::displayError('Rating must be between 1 and 5.'); } elseif (!strtotime($this->check_in)) { $message = Tools::displayError('Check In time is invalid.'); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index f804b11ba..868012630 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -391,10 +391,6 @@ class AdminAddHotelController extends ModuleAdminController $this->errors[] = $this->l('Check Out time must be before Check In time.'); } - if (!$rating) { - $this->errors[] = $this->l('Rating is required field.'); - } - if (!$address = trim($address)) { $this->errors[] = $this->l('Address is required field.'); } diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 22ae63e61..978872548 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -214,11 +214,11 @@
- +
+ {if !empty($tab.has_kpi)} + +   » {l s='KPI'} + + + + + + + + + + + {/if} {foreach $tabs AS $child} {if $child.id_parent === $tab.id_tab} {if isset($access[$child.id_tab])} @@ -372,6 +439,32 @@ + {if !empty($child.has_kpi)} + +   » {l s='KPI'} + + + + + + + + + + + {/if} {/if} {/if} {/foreach} @@ -438,4 +531,4 @@
{/foreach} -
+
\ No newline at end of file diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl index b42bea915..471eeb0ba 100644 --- a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl @@ -36,6 +36,7 @@ {/if} + {if $can_edit}
{foreach $actions as $action} @@ -48,6 +49,7 @@
+ {/if}
@@ -97,6 +99,7 @@ {/foreach}
+{if $can_edit}

{l s="Your answer to"} {if isset($customer->firstname)}{$customer->firstname|escape:'html':'UTF-8'} {$customer->lastname|escape:'html':'UTF-8'} {else} {$thread->email}{/if}

@@ -125,7 +128,7 @@
- +{/if} {if count($timeline_items)}

diff --git a/admin/themes/default/template/controllers/modules/js.tpl b/admin/themes/default/template/controllers/modules/js.tpl index d91c1b3bb..79097c46a 100644 --- a/admin/themes/default/template/controllers/modules/js.tpl +++ b/admin/themes/default/template/controllers/modules/js.tpl @@ -48,21 +48,65 @@ function modules_management(action) { var modules = document.getElementsByName('modules'); - var module_list = ''; + var module_list = []; for (var i = 0; i < modules.length; i++) { - if (modules[i].checked == true) + if (modules[i].checked) { - rel = modules[i].getAttribute('data-rel'); + var rel = modules[i].getAttribute('data-rel'); if (rel != "false" && action == "uninstall") { if (!confirm(rel)) return false; } - module_list += '|'+modules[i].value; + module_list.push(modules[i].value); } } - document.location.href=currentIndex+'&token='+token+'&'+action+'='+module_list.substring(1, module_list.length); + + module_list = encodeURIComponent(module_list.join('|')); + if (action == 'enable' || action == 'disable') { + var type = action == 'disable' ? 0 : 1; + document.location.href = currentIndex+'&token='+token+'&enable='+type+'&module_name='+module_list; + return false; + } + + document.location.href = currentIndex+'&token='+token+'&'+action+'='+module_list; + return false; + } + + function filter_modules_by_name(table, moduleName) + { + var moduleNames = moduleName.split('|'); + var filteredNames = []; + for (var i = 0; i < moduleNames.length; i++) { + moduleNames[i] = $.trim(moduleNames[i]); + if (moduleNames[i] !== '') { + filteredNames.push(moduleNames[i].toLowerCase()); + } + } + + if (!filteredNames.length) { + return; + } + + if (filteredNames.length === 1) { + $.uiTableFilter(table, filteredNames[0]); + return; + } + + table.find('tbody tr').each(function() { + var rowText = $(this).text().toLowerCase(); + var isMatch = false; + + for (var i = 0; i < filteredNames.length; i++) { + if (rowText.indexOf(filteredNames[i]) !== -1) { + isMatch = true; + break; + } + } + + $(this).toggle(isMatch); + }); } $('document').ready( function() { @@ -71,7 +115,7 @@ $.uiTableFilter($('#moduleContainer').find('table'), anchor); if (module_name != '') - $.uiTableFilter($('#moduleContainer').find('table'), module_name); + filter_modules_by_name($('#moduleContainer').find('table'), module_name); $('#moduleQuicksearch').on('keyup', function(){ val = this.value; diff --git a/admin/themes/default/template/controllers/modules/list.tpl b/admin/themes/default/template/controllers/modules/list.tpl index 6166962a4..9fab8630b 100644 --- a/admin/themes/default/template/controllers/modules/list.tpl +++ b/admin/themes/default/template/controllers/modules/list.tpl @@ -190,6 +190,19 @@

@@ -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}