Merge branch 'develop' into gli-3047

This commit is contained in:
azhar bhat
2026-08-14 12:23:25 +05:30
59 changed files with 1526 additions and 57 deletions

View File

@@ -384,13 +384,13 @@ class AdminAddressesControllerCore extends AdminController
public function processExport($text_delimiter = '"')
{
$this->fields_list = array_merge($this->fields_list, array(
'email' => array('title' => $this->l('Customer Email')),
'phone' => array('title' => $this->l('Phone'), 'filter_key' => 'a!phone'),
'phone_mobile' => array('title' => $this->l('Mobile phone')),
'address1' => array('title' => $this->l('Address (2)')),
'dni' => array('title' => $this->l('Identification Number')),
'vat_number' => array('title' => $this->l('VAT number')),
'other' => array('title' => $this->l('Other')),
'email' => array('title' => $this->l('Customer Email'), 'displayed' => false),
'phone' => array('title' => $this->l('Phone'), 'filter_key' => 'a!phone', 'displayed' => false),
'phone_mobile' => array('title' => $this->l('Mobile phone'), 'displayed' => false),
'address2' => array('title' => $this->l('Address (2)'), 'displayed' => false),
'dni' => array('title' => $this->l('Identification Number'), 'displayed' => false),
'vat_number' => array('title' => $this->l('VAT number'), 'displayed' => false),
'other' => array('title' => $this->l('Other'), 'displayed' => false),
));
return parent::processExport($text_delimiter);

View File

@@ -0,0 +1,123 @@
<?php
/**
* 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
*/
class AdminGuestRegistrationControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->table = 'configuration';
$this->className = 'Configuration';
$this->identifier = 'id_configuration';
parent::__construct();
}
public function initContent()
{
$this->display = 'view';
$this->initToolbar();
parent::initContent();
}
public function renderView()
{
$grcInfoJson = Configuration::get('QLO_GUEST_REGISTRATION_CARD_INFO');
$savedSections = array();
if ($grcInfoJson !== false && $grcInfoJson !== '') {
$grcData = Tools::jsonDecode($grcInfoJson, true);
if (is_array($grcData)) {
$savedSections = $grcData;
}
}
$allSelected = empty($savedSections);
$nodes = array();
$objHotelBookingDetail = new HotelBookingDetail();
foreach ($objHotelBookingDetail->getRegistrationCardInfo() as $sectionId => $section) {
$sectionFields = isset($savedSections[$sectionId]) ? $savedSections[$sectionId] : array();
$fieldNodes = array();
foreach ($section['fields'] as $fieldId => $fieldName) {
$fieldSelected = $allSelected || in_array($fieldId, $sectionFields);
$fieldNodes[] = array(
'value' => $fieldId,
'name' => $fieldName,
'input_name' => 'grc_field_'.$sectionId,
'selected' => $fieldSelected,
);
}
$fieldsSelected = $allSelected || !empty(array_filter($fieldNodes, function ($n) { return $n['selected']; }));
$nodes[] = array(
'value' => $sectionId,
'name' => $section['name'],
'input_name' => 'grc_section',
'selected' => $fieldsSelected,
'children' => $fieldNodes,
);
}
$tree = new HelperTree('grc-card-info-tree');
$tree->setData($nodes)
->setUseCheckBox(true)
->setAutoSelectChildren(true)
->setUseBulkActions(true);
$this->context->smarty->assign(array(
'guest_reg_card_info_tree' => $tree->render(),
'guest_reg_card_form_action' => self::$currentIndex.'&token='.$this->token,
'guest_reg_card_preview_img_url' => $this->context->link->getBaseLink().'img/admin/guest_registration_preview.jpg',
'guest_reg_card_preview_title' => $this->l('Guest Registration Card Preview'),
));
return parent::renderView();
}
public function initToolbarTitle()
{
$this->toolbar_title = array($this->l('Guest Registration Card'));
}
public function postProcess()
{
if (Tools::isSubmit('submitGrcCardInfo')) {
$grcInfo = array();
$objHotelBookingDetail = new HotelBookingDetail();
foreach (array_keys($objHotelBookingDetail->getRegistrationCardInfo()) as $sectionId) {
$fields = array_values(array_filter(array_map('intval', (array)Tools::getValue('grc_field_'.$sectionId, array()))));
if (!empty($fields)) {
$grcInfo[$sectionId] = $fields;
}
}
if (empty($grcInfo)) {
$this->errors[] = $this->l('Please select at least one field for the Guest Registration Card.');
return;
}
Configuration::updateValue('QLO_GUEST_REGISTRATION_CARD_INFO', Tools::jsonEncode($grcInfo));
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
return;
}
parent::postProcess();
}
}

View File

@@ -64,6 +64,15 @@ class AdminPdfControllerCore extends AdminController
}
}
public function processGenerateGuestRegistrationFormPDF()
{
if (Tools::isSubmit('id_hotel_booking_detail')) {
$this->generateGuestRegistrationFormPDF((int)Tools::getValue('id_hotel_booking_detail'));
} else {
die(Tools::displayError('The hotel booking detail ID is missing.'));
}
}
public function processGenerateBookingVoucherPDF()
{
if (Tools::isSubmit('id_order')) {
@@ -234,6 +243,17 @@ class AdminPdfControllerCore extends AdminController
$this->generatePDF($order_invoice, PDF::TEMPLATE_INVOICE);
}
public function generateGuestRegistrationFormPDF($idHotelBookingDetail)
{
$idHotelBookingDetail = (int)$idHotelBookingDetail;
if (!$idHotelBookingDetail || !Validate::isLoadedObject(new HotelBookingDetail($idHotelBookingDetail))) {
die(Tools::displayError('The hotel booking cannot be found within your database.'));
}
$pdf = new PDF($idHotelBookingDetail, PDF::TEMPLATE_GUEST_REGISTRATION_FORM, Context::getContext()->smarty);
$pdf->render('I');
}
public function generateBookingVoucherPDFByIdOrder($id_order)
{
$order = new Order((int)$id_order);

View File

@@ -195,6 +195,19 @@ class AdminPreferencesControllerCore extends AdminController
'class' => 'fixed-width-xl',
'desc' => sprintf($this->l('If set to 0, the maximum limit will be %d characters.'), Configuration::PS_SHORT_DESC_LIMIT)
),
'PS_EXPORT_FIELDS_TYPE' => array(
'title' => $this->l('CSV export fields'),
'desc' => $this->l('Choose whether list CSV exports include all fields, or only the fields currently checked in the "Available Fields" selector of the list being exported.'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'select',
'list' => array(
array('id' => HelperList::QLO_EXPORT_FIELDS_ALL, 'name' => $this->l('All Fields')),
array('id' => HelperList::QLO_EXPORT_FIELDS_SELECTED, 'name' => $this->l('Selected Fields')),
),
'identifier' => 'id',
'defaultValue' => HelperList::QLO_EXPORT_FIELDS_ALL,
),
// 'PS_DISPLAY_SUPPLIERS' => array(
// 'title' => $this->l('Display suppliers and manufacturers'),
// 'desc' => $this->l('Enable suppliers and manufacturers pages on your front office even when their respective modules are disabled.'),

View File

@@ -92,37 +92,45 @@ class CategoryControllerCore extends FrontController
public function init()
{
// Get category ID
$id_category = (int)Tools::getValue('id_category');
if (!$id_category || !Validate::isUnsignedId($id_category)) {
$this->errors[] = Tools::displayError('Missing category ID');
}
$idCategory = (int) Tools::getValue('id_category');
$this->category = new Category($idCategory, $this->context->language->id);
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
$idHotel = HotelBranchInformation::getHotelIdByIdCategory($id_category);
if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
$idHotel = HotelBranchInformation::getHotelIdByIdCategory($idCategory);
if (!$idCategory || !Validate::isUnsignedId($idCategory)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
// Instantiate category
$this->category = new Category($id_category, $this->context->language->id);
parent::init();
// Check if the category is active and return 404 error if is disable.
if (!$this->category->active || !Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop() || in_array($this->category->id, array(Configuration::get('PS_HOME_CATEGORY'), Configuration::get('PS_ROOT_CATEGORY')))) {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
} elseif (!Validate::isLoadedObject($this->category) || !$this->category->active) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
} else
// Check if category can be accessible by current customer and return 403 if not
if (!$this->category->checkAccess($this->context->customer->id)) {
} elseif ($idHotel && !(new HotelBranchInformation())->hotelBranchInfoByCategoryId($idCategory)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
} elseif ($idHotel && !HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
} else {
parent::init();
if (
!$this->category->inShop()
|| !$this->category->isAssociatedToShop()
|| in_array(
$this->category->id,
array(
Configuration::get('PS_HOME_CATEGORY'),
Configuration::get('PS_ROOT_CATEGORY')
)
)
) {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
} elseif (!$this->category->checkAccess($this->context->customer->id)) {
header('HTTP/1.1 403 Forbidden');
header('Status: 403 Forbidden');
$this->errors[] = Tools::displayError('You do not have access to this category.');
$this->customer_access = false;
}
}
}
/**
@@ -130,14 +138,15 @@ class CategoryControllerCore extends FrontController
*/
public function initContent()
{
if (!$this->customer_access) {
$this->display_column_left = false;
$this->display_column_right = false;
}
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_.'category.tpl');
if (!$this->customer_access) {
return;
}
$id_category = Tools::getValue('id_category');
$displayAllRoomsTypes = false;

View File

@@ -126,6 +126,12 @@ class ProductControllerCore extends FrontController
$objHotelRoomType = new HotelRoomType();
if ($hotelRoomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id)) {
$idHotel = (int) $hotelRoomInfo['id_hotel'];
// If the hotel this room type belongs to is disabled, redirect to home page
if (!(new HotelBranchInformation())->hotelBranchesInfo(false, 1, 0, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}