Merge branch 'develop' into gli-1096

This commit is contained in:
Amit sharma
2026-06-01 17:36:33 +05:30
19 changed files with 477 additions and 109 deletions

View File

@@ -36,6 +36,7 @@
</a>
{/if}
</div>
{if $can_edit}
<div class="well">
<form action="{$link->getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}&amp;viewcustomer_thread&amp;id_customer_thread={$id_customer_thread|intval}" method="post" enctype="multipart/form-data" class="form-horizontal">
{foreach $actions as $action}
@@ -48,6 +49,7 @@
</button>
</form>
</div>
{/if}
<div class="row">
<div class="message-item-initial media">
<span class="avatar-md pull-left"><i class="icon-user icon-3x"></i></span>
@@ -97,6 +99,7 @@
{/foreach}
</div>
</div>
{if $can_edit}
<div class="panel">
<form action="{$link->getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}&amp;id_customer_thread={$thread->id|intval}&amp;viewcustomer_thread" method="post" enctype="multipart/form-data" class="form-horizontal">
<h3>{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}</h3>
@@ -125,7 +128,7 @@
</div>
</form>
</div>
{/if}
{if count($timeline_items)}
<div class="panel">
<h3>

View File

@@ -2337,17 +2337,14 @@
<label class="control-label col-lg-3" for="order_message">{l s='Order message'}</label>
<div class="col-lg-6">
<textarea name="order_message" id="order_message" rows="3" cols="45"></textarea>
</div>
</div>
<div class="form-group col-lg-12">
<span class="col-lg-3"></span>
<p class="checkbox col-lg-6">
<p class="checkbox">
<label class="control-label" for="visibility">
<input type="checkbox" name="visibility" id="visibility" value="1" />
{l s='Display Message to Customer?'}
</label>
</p>
</div>
</div>
</div>
<div class="form-group" {if $order_total <= 0}style="display: none;"{/if}>
{if !$PS_CATALOG_MODE}
<div class="col-lg-9 col-lg-offset-3">

View File

@@ -712,7 +712,7 @@
{if isset($messages) && $messages}
<div class="panel order-notes">
<div class="panel-heading">
<i class="icon-undo"></i> &nbsp;{l s='Order Private Notes'}
<i class="icon-undo"></i> &nbsp;{l s='Order Notes'}
</div>
<div class="panel-content">
{foreach from=$messages item=message name=customerMessage}
@@ -725,11 +725,11 @@
<span>{$message['elastname']|escape:'html':'UTF-8'}{else}{$message['cfirstname']|escape:'html':'UTF-8'} {$message['clastname']|escape:'html':'UTF-8'}</span>
{/if},
<span class="message-date">&nbsp;<i class="icon-calendar"></i>
{dateFormat date=$message['date_add']}
{dateFormat date=$message.date_add full=1}
</span>
{if ($message['private'] == 1)}
{* {if ($message['private'] == 1)}
<span class="badge badge-info">{l s='Private'}</span>
{/if}
{/if} *}
</p>
</div>
{if !$smarty.foreach.customerMessage.last}<hr/>{/if}

View File

@@ -128,6 +128,12 @@
</div>
{/if}
</div>
<div class="form-group row">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" name="message" maxlength="250"></textarea>
</div>
</div>
{if isset($invoices_collection) && sizeof($invoices_collection)}
<div class="form-group" style="display: none;">

View File

@@ -0,0 +1,55 @@
{*
* 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
*}
<div class="modal-body">
<input type="hidden" name="id_product" value="{$id_product|intval}">
<input type="hidden" name="id_order_detail" value="{$id_order_detail|intval}">
<input type="hidden" name="id_hotel" value="{$id_hotel|intval}">
<input type="hidden" name="id_room" value="{$id_room|intval}">
<input type="hidden" name="id_htl_booking" value="{$id_htl_booking|intval}">
<input type="hidden" name="id_order" value="{$id_order|intval}">
<input type="hidden" name="date_from" value="{$date_from|escape:'html':'UTF-8'}">
<input type="hidden" name="date_to" value="{$date_to|escape:'html':'UTF-8'}">
<div class="form-group">
<div class="form-group" id="remarkGroup">
<label class="control-label required" for="room_remark">
{l s='Remark'}
</label>
<textarea id="room_remark" class="form-control" name="message"
placeholder="{l s='Enter remark for room deletion'}" maxlength="250"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s='Close'}</button>
<button type="button" id="submitRoomDelete" class="btn btn-danger">
<i class="icon icon-trash"></i>&nbsp;{l s="Delete Room"}
</button>
</div>
<script>
$(document).ready(function() {
$('#room_remark').on('input', function() {
if ($(this).val().trim() !== '') {
$('#remarkGroup').removeClass('has-error');
}
});
});
</script>

View File

@@ -139,6 +139,12 @@
</div>
</div>
</div>
<div class="row form-group">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" name="message" maxlength="250"></textarea>
</div>
</div>
<div class="product_invoice" style="display: none;">
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
@@ -152,4 +158,4 @@
<div class="modal-footer">
<button type="button" id="submitRoomChange" class="btn btn-primary"><i class="icon icon-bed"></i> &nbsp;{l s="Update Rooms"}</button>
</div>
</div>
</div>

View File

@@ -95,6 +95,12 @@
</div>
<p class="error_text" id="realloc_sel_rm_err_p"></p>
</div>
<div class="row form-group">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" name="message" maxlength="250"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s="Close"}</button>
@@ -139,6 +145,12 @@
</div>
</div>
</div>
<div class="row form-group">
<div class="col-sm-12">
<label class="control-label">{l s='Remark'}</label>
<textarea class="form-control room_remark" name="message" maxlength="250"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s="Close"}</button>

View File

@@ -525,7 +525,7 @@ abstract class PaymentModuleCore extends Module
$msg->id_cart = (int)$id_cart;
$msg->id_customer = (int)($order->id_customer);
$msg->id_order = (int)$order->id;
$msg->private = 1;
$msg->private = 0;
$msg->add();
}
}
@@ -707,28 +707,32 @@ abstract class PaymentModuleCore extends Module
if ($old_message && !$old_message['private']) {
$update_message = new Message((int)$old_message['id_message']);
$update_message->id_order = (int)$order->id;
$update_message->id_employee = (isset($this->context->employee) && $this->context->employee->id) ? (int)$this->context->employee->id : 0;
$update_message->private = !Tools::getValue('visibility');
$update_message->update();
if (Tools::getValue('visibility')) {
// Add this message in the customer thread
$customer_thread = new CustomerThread();
$customer_thread->id_contact = 0;
$customer_thread->id_contact = (int)Configuration::get('PS_CUSTOMER_SERVICE_CONTACT');
$customer_thread->id_customer = (int)$order->id_customer;
$customer_thread->id_shop = (int)$this->context->shop->id;
$customer_thread->id_order = (int)$order->id;
$customer_thread->id_lang = (int)$this->context->language->id;
$customer_thread->email = $this->context->customer->email;
$customer_thread->phone = $this->context->customer->phone ? $this->context->customer->phone : '';
$customer_thread->status = CustomerThread::QLO_CUSTOMER_THREAD_STATUS_OPEN;
$customer_thread->token = Tools::passwdGen(12);
$customer_thread->add();
$customer_message = new CustomerMessage();
$customer_message->id_customer_thread = $customer_thread->id;
$customer_message->id_employee = 0;
$customer_message->id_employee = (isset($this->context->employee) && $this->context->employee->id) ? (int)$this->context->employee->id : 0;
$customer_message->ip_address = (int)ip2long(Tools::getRemoteAddr());
$customer_message->message = $update_message->message;
$customer_message->private = !Tools::getValue('visibility');
$customer_message->private = 0;
if (!$customer_message->add()) {
$this->errors[] = Tools::displayError('An error occurred while saving message');
}
}
}

View File

@@ -90,6 +90,14 @@ class AdminCustomerThreadsControllerCore extends AdminController
'align' => 'center',
'class' => 'fixed-width-xs'
),
'id_order' => array(
'title' => $this->l('ID Order'),
'filter_key' => 'a!id_order',
'align' => 'center',
'optional' => true,
'callback' => 'getOrderLink',
'visible_default' => true,
),
'customer' => array(
'title' => $this->l('Customer'),
'filter_key' => 'customer',
@@ -172,13 +180,6 @@ class AdminCustomerThreadsControllerCore extends AdminController
'type' => 'datetime',
'optional' => true,
),
'id_order' => array(
'title' => $this->l('ID Order'),
'filter_key' => 'a!id_order',
'optional' => false,
'visible_default' => false,
'displayed' => false,
),
);
$this->bulk_actions = array(
@@ -346,6 +347,14 @@ class AdminCustomerThreadsControllerCore extends AdminController
return $customer;
}
public function getOrderLink($order, $tr)
{
if ($tr['id_order']) {
return '<a href="'.$this->context->link->getAdminLink('AdminOrders').'&vieworder&id_order='.$tr['id_order'].'">'.'#'.$order.'</a>';
}else{
return '--';
}
}
public function setMedia()
{
@@ -976,6 +985,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
'count_ok' => isset($orders_ok) ? count($orders_ok) : false,
'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', (int)$thread->id_lang)),
'timeline_items' => $timeline_items,
'can_edit' => $this->tabAccess['edit'],
);
return parent::renderView();

View File

@@ -1276,6 +1276,68 @@ class AdminOrdersControllerCore extends AdminController
die(Tools::jsonEncode($response));
}
public function ajaxProcessInitDeleteRoomBookingModal()
{
if ($this->tabAccess['edit'] !== 1) {
die(Tools::jsonEncode(array(
'hasError' => 1,
'error' => Tools::displayError('You do not have permission to edit this order.')
)));
}
// set modal details
$response['hasError'] = 1;
$id_order = (int) Tools::getValue('id_order');
$idProduct = (int) Tools::getValue('id_product');
$idOrderDetail = (int) Tools::getValue('id_order_detail');
$idRoom = (int) Tools::getValue('id_room');
$idHtlBooking = (int) Tools::getValue('id_htl_booking');
$idHotel = (int) Tools::getValue('id_hotel');
$dateFrom = (string) Tools::getValue('date_from');
$dateTo = (string) Tools::getValue('date_to');
if ($id_order
&& $idProduct
&& $idOrderDetail
&& $idRoom
&& $idHtlBooking
&& $idHotel
&& $dateFrom
&& $dateTo
) {
if (!Validate::isDate($dateFrom) || !Validate::isDate($dateTo)) {
die(Tools::jsonEncode(array(
'hasError' => 1,
'error' => Tools::displayError('Invalid date range.')
)));
}
$smartyVars = array(
'id_product' => $idProduct,
'id_order_detail' => $idOrderDetail,
'id_room' => $idRoom,
'date_from' => $dateFrom,
'date_to' => $dateTo,
'id_htl_booking' => $idHtlBooking,
'id_hotel' => $idHotel,
'id_order' => $id_order,
);
$this->context->smarty->assign($smartyVars);
$modal = array(
'modal_id' => 'delete-room-booking-modal',
'modal_class' => 'modal-md order_detail_modal',
'modal_title' => '<i class="icon icon-bed"></i> &nbsp'.$this->l('Delete Room'),
'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_delete_room_booking.tpl'),
);
$this->context->smarty->assign($modal);
$response['hasError'] = 0;
$response['modalHtml'] = $this->context->smarty->fetch('modal.tpl');
} else {
$response['error'] = Tools::displayError('Invalid data.');
}
die(Tools::jsonEncode($response));
}
public function setMedia()
{
@@ -1558,7 +1620,23 @@ class AdminOrdersControllerCore extends AdminController
if (!count($this->errors)) {
// Finally, reallocate the room
if ($objBookingDetail->reallocateBooking($idHtlBookingFrom, $idRoomToReallocate, $priceDiff)) {
if ($objBookingDetail->reallocateBooking($idHtlBookingFrom, $idRoomToReallocate, $priceDiff)) {
$order = new Order((int) $idOrder);
$fromRoomType = Product::getProductName($objHotelBooking->id_product, null, $this->context->language->id);
$toRoomType = Product::getProductName($objRoomInfo->id_product, null, $this->context->language->id);
$dateFrom = date('d/m/Y', strtotime($objHotelBooking->date_from));
$dateTo = date('d/m/Y', strtotime($objHotelBooking->date_to));
$autoMsg = $this->l('Room Reallocate').': '.$objHotelBooking->room_num.' - '.$fromRoomType.' '.$this->l('to').' '.$objRoomInfo->room_num.' - '.$toRoomType.': ('.$dateFrom.' - '.$dateTo.')';
$userRemark = Tools::getValue('message');
$noteMessage = $autoMsg.($userRemark && Validate::isMessage($userRemark) ? ' | '.$this->l('Remark').': '.$userRemark : '');
$message = new Message();
$message->message = $noteMessage;
$message->id_cart = (int)$order->id_cart;
$message->id_customer = (int)$order->id_customer;
$message->id_order = (int)$idOrder;
$message->id_employee = (int)$this->context->employee->id;
$message->private = 1;
$message->save();
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $idOrder.'&vieworder&conf=52&token='.$this->token);
} else {
$this->errors[] = $this->l('Some error occured. Please try again.');
@@ -1600,7 +1678,22 @@ class AdminOrdersControllerCore extends AdminController
if (!count($this->errors)) {
$objBookingDetail = new HotelBookingDetail();
if ($objBookingDetail->swapBooking($idHtlBookingFrom, $idHtlBookingToSwap)) {
if ($objBookingDetail->swapBooking($idHtlBookingFrom, $idHtlBookingToSwap)) {
$order = new Order((int) $idOrder);
$room1Type = Product::getProductName($objHotelBooking->id_product, null, $this->context->language->id);
$dateFrom = date('d/m/Y', strtotime($objHotelBooking->date_from));
$dateTo = date('d/m/Y', strtotime($objHotelBooking->date_to));
$autoMsg = $this->l('Room Swap').': ('.$room1Type.') '.$objHotelBooking->room_num.' '.$this->l('with').' '.$objHotelBookingTo->room_num.': ('.$dateFrom.' - '.$dateTo.')';
$userRemark = Tools::getValue('message');
$noteMessage = $autoMsg.($userRemark && Validate::isMessage($userRemark) ? ' | '.$this->l('Remark').': '.$userRemark : '');
$message = new Message();
$message->message = $noteMessage;
$message->id_cart = (int)$order->id_cart;
$message->id_customer = (int)$order->id_customer;
$message->id_order = (int)$idOrder;
$message->id_employee = (int)$this->context->employee->id;
$message->private = 1;
$message->save();
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$idOrder.'&vieworder&conf=53&token='.$this->token);
} else {
$this->errors[] = $this->l('Some error occured. Please try again.');
@@ -1746,7 +1839,7 @@ class AdminOrdersControllerCore extends AdminController
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($customer->email, $order->id);
if (!$id_customer_thread) {
$customer_thread = new CustomerThread();
$customer_thread->id_contact = (int)Configuration::get('PS_MAIL_EMAIL_MESSAGE');
$customer_thread->id_contact = (int)Configuration::get('PS_CUSTOMER_SERVICE_CONTACT');
$customer_thread->id_customer = (int)$order->id_customer;
$customer_thread->user_name = $customer->firstname.' '.$customer->lastname;
$customer_thread->phone = $customer->phone;
@@ -1762,7 +1855,6 @@ class AdminOrdersControllerCore extends AdminController
} else {
$customer_thread = new CustomerThread((int)$id_customer_thread);
}
$customer_message = new CustomerMessage();
$customer_message->id_customer_thread = $customer_thread->id;
$customer_message->id_employee = (int)$this->context->employee->id;
@@ -1786,7 +1878,7 @@ class AdminOrdersControllerCore extends AdminController
'{order_name}' => $order->getUniqReference(),
'{message}' => $message
);
if (@Mail::Send(
Mail::Send(
(int)$order->id_lang,
'order_merchant_comment',
Mail::l('New message regarding your booking', (int)$order->id_lang),
@@ -1800,11 +1892,10 @@ class AdminOrdersControllerCore extends AdminController
_PS_MAIL_DIR_,
true,
(int)$order->id_shop
)) {
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=11'.'&token='.$this->token);
}
);
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$order->id.'&vieworder&conf=11&token='.$this->token);
}
$this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.');
Tools::dieOrLog(Tools::displayError('An error occurred while sending an email to the customer.'),false);
}
}
} else {
@@ -3580,7 +3671,7 @@ class AdminOrdersControllerCore extends AdminController
}
$objCustomerThread = new CustomerThread();
$messages = Message::getMessagesByOrderId($order->id, true);
$messages = Message::getMessagesByOrderId($order->id, null);
if ($customerMessages = CustomerMessage::getMessagesByOrderId($order->id, true)) {
foreach ($messages as $messageKey => $message) {
foreach ($customerMessages as $customerMessageKey => $customerMessage) {
@@ -5136,7 +5227,22 @@ class AdminOrdersControllerCore extends AdminController
$order->total_discounts_tax_incl += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
// Save changes of order
$order->update();
if($order->update()){
$roomType = Product::getProductName($product->id, null, $this->context->language->id);
$dateFromFormatted = date('d/m/Y', strtotime($date_from));
$dateToFormatted = date('d/m/Y', strtotime($date_to));
$autoMsg = $this->l('Room Add').': '.$roomType.': ('.$dateFromFormatted.' - '.$dateToFormatted.')';
$userRemark = Tools::getValue('message');
$noteMessage = $autoMsg.($userRemark && Validate::isMessage($userRemark) ? ' | '.$this->l('Remark').': '.$userRemark : '');
$message = new Message();
$message->message = $noteMessage;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$order->id;
$message->id_employee = (int)$this->context->employee->id;
$message->private = 1;
$message->save();
}
// Update weight SUM
$order_carrier = new OrderCarrier((int)$order->getIdOrderCarrier());
@@ -6196,7 +6302,24 @@ class AdminOrdersControllerCore extends AdminController
$order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
$order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
$order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_);
$order->save();
if($order->save()){
$roomType = Product::getProductName($id_product, null, $this->context->language->id);
$oldDateFromFormatted = date('d/m/Y', strtotime($old_date_from));
$oldDateToFormatted = date('d/m/Y', strtotime($old_date_to));
$newDateFromFormatted = date('d/m/Y', strtotime($new_date_from));
$newDateToFormatted = date('d/m/Y', strtotime($new_date_to));
$autoMsg = $this->l('Room Edit').': '.$obj_booking_detail->room_num.' - '.$roomType.': ('.$oldDateFromFormatted.' - '.$oldDateToFormatted.')';
$userRemark = Tools::getValue('message');
$noteMessage = $autoMsg.($userRemark && Validate::isMessage($userRemark) ? ' | '.$this->l('Remark').': '.$userRemark : '');
$message = new Message();
$message->message = $noteMessage;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->id_order = (int)$order->id;
$message->id_employee = (int)$this->context->employee->id;
$message->private = 1;
$message->save();
}
// Save order invoice
if (isset($order_invoice) && $order_invoice instanceof OrderInvoice) {
@@ -6356,7 +6479,7 @@ class AdminOrdersControllerCore extends AdminController
public function ajaxProcessDeleteRoomLine()
{
// Check tab access is allowed to edit
if (!$this->tabAccess['edit'] === 1) {
if ($this->tabAccess['edit'] !== 1) {
die(json_encode(array(
'result' => false,
'error' => Tools::displayError('You do not have permission to edit this order.')
@@ -6635,7 +6758,22 @@ class AdminOrdersControllerCore extends AdminController
$objBookingDetail->id_order
);
$objBookingDetail->delete();
if($objBookingDetail->delete()){
$roomType = Product::getProductName($objBookingDetail->id_product, null, $this->context->language->id);
$dateFrom = date('d/m/Y', strtotime($objBookingDetail->date_from));
$dateTo = date('d/m/Y', strtotime($objBookingDetail->date_to));
$autoMsg = $this->l('Room Delete').': '.$objBookingDetail->room_num.' - '.$roomType.': ('.$dateFrom.' - '.$dateTo.')';
$userRemark = Tools::getValue('message');
$noteMessage = $autoMsg.($userRemark && Validate::isMessage($userRemark) ? ' | '.$this->l('Remark').': '.$userRemark : '');
$message = new Message();
$message->message = $noteMessage;
$message->id_cart = (int)$objBookingDetail->id_cart;
$message->id_customer = (int)$order->id_customer;
$message->id_order = (int)$order->id;
$message->id_employee = (int)$this->context->employee->id;
$message->private = 1;
$message->save();
}
// delete refund request of the room if exists.
OrderReturnDetail::deleteReturnDetailByIdBookingDetail($id_order, $idHotelBooking);

View File

@@ -748,26 +748,35 @@ class AdminTranslationsControllerCore extends AdminController
$files_list = AdminTranslationsController::filterTranslationFiles($gz->listContent());
$files_paths = AdminTranslationsController::filesListToPaths($files_list);
if (empty($files_list)) {
$this->errors[] = Tools::displayError('No valid translation files found in the archive.');
return false;
}
$uniqid = uniqid();
$sandbox = _PS_CACHE_DIR_.'sandbox'.DIRECTORY_SEPARATOR.$uniqid.DIRECTORY_SEPARATOR;
if ($gz->extractList($files_paths, $sandbox)) {
foreach ($files_list as $file2check) {
//don't validate index.php, will be overwrite when extract in translation directory
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php') {
continue;
}
if (preg_match('@^[0-9a-z-_/\\\\]+\.php$@i', $file2check['filename'])) {
if (!@filemtime($sandbox.$file2check['filename']) || !AdminTranslationsController::checkTranslationFile(file_get_contents($sandbox.$file2check['filename']))) {
$this->errors[] = sprintf(Tools::displayError('Validation failed for: %s'), $file2check['filename']);
}
} elseif (!preg_match('@mails[0-9a-z-_/\\\\]+\.(html|tpl|txt)$@i', $file2check['filename'])) {
$this->errors[] = sprintf(Tools::displayError('Unidentified file found: %s'), $file2check['filename']);
}
}
if (!$gz->extractList($files_paths, $sandbox)) {
$this->errors[] = Tools::displayError('The archive cannot be extracted.');
Tools::deleteDirectory($sandbox, true);
return false;
}
foreach ($files_list as $file2check) {
//don't validate index.php, will be overwrite when extract in translation directory
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php') {
continue;
}
if (preg_match('@^[0-9a-z-_/\\\\]+\.php$@i', $file2check['filename'])) {
if (!@filemtime($sandbox.$file2check['filename']) || !AdminTranslationsController::checkTranslationFile(file_get_contents($sandbox.$file2check['filename']))) {
$this->errors[] = sprintf(Tools::displayError('Validation failed for: %s'), $file2check['filename']);
}
} elseif (!preg_match('@mails[0-9a-z-_/\\\\]+\.(html|tpl|txt)$@i', $file2check['filename'])) {
$this->errors[] = sprintf(Tools::displayError('Unidentified file found: %s'), $file2check['filename']);
}
}
Tools::deleteDirectory($sandbox, true);
$i = 0;
$tmp_array = array();
foreach ($files_paths as $files_path) {
@@ -837,11 +846,26 @@ class AdminTranslationsControllerCore extends AdminController
public static function filterTranslationFiles($list)
{
$kept = array();
$allowedExtensions = array('php', 'html', 'tpl', 'txt');
foreach ($list as $file) {
if ('index.php' == basename($file['filename'])) {
$filename = $file['filename'];
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if (!in_array($extension, $allowedExtensions)) {
continue;
}
if (preg_match('#^modules/([^/]+)/#', $file['filename'], $m)) {
if ('index.php' == basename($filename)) {
continue;
}
if ($extension === 'php'
&& !preg_match('#^modules/([^/]+)/#', $filename)
&& !preg_match('@^translations/[a-z]{2,3}/[a-z0-9_-]+\.php$@i', $filename)) {
continue;
}
if (preg_match('#^modules/([^/]+)/#', $filename, $m)) {
if (is_dir(_PS_MODULE_DIR_.$m[1])) {
$kept[] = $file;
}
@@ -3045,8 +3069,13 @@ class AdminTranslationsControllerCore extends AdminController
$email_file = _PS_ROOT_DIR_.$email;
}
$email_html = file_get_contents($email_file);
$sanitizedFilePath = realpath($email_file);
$permittedMailDir = realpath(_PS_MAIL_DIR_) . DIRECTORY_SEPARATOR;
return $email_html;
if ($sanitizedFilePath === false || $permittedMailDir === false || strpos($sanitizedFilePath, $permittedMailDir) !== 0) {
return false;
}
return file_get_contents($sanitizedFilePath);
}
}

View File

@@ -490,7 +490,7 @@ class OrderDetailControllerCore extends FrontController
'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues,
'deliveryState' => (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
'is_guest' => false,
'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id),
'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false),
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'),

View File

@@ -255,7 +255,7 @@
<value>1</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_FILE_UPLOAD" name="PS_CUSTOMER_SERVICE_FILE_UPLOAD">
<value>1</value>
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_SIGNATURE" name="PS_CUSTOMER_SERVICE_SIGNATURE">
<value/>
@@ -957,10 +957,10 @@
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_REQUIRED_NAME" name="PS_CUSTOMER_SERVICE_REQUIRED_NAME">
<value>1</value>
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_DISPLAY_NAME" name="PS_CUSTOMER_SERVICE_DISPLAY_NAME">
<value>1</value>
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_REQUIRED_PHONE" name="PS_CUSTOMER_SERVICE_REQUIRED_PHONE">
<value>1</value>
@@ -969,7 +969,10 @@
<value>1</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT" name="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT">
<value>1</value>
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_SERVICE_CONTACT" name="PS_CUSTOMER_SERVICE_CONTACT">
<value>2</value>
</configuration>
<configuration id="PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE" name="PS_STANDARD_PRODUCT_ORDER_ADDRESS_PREFRENCE">
<value>1</value>

View File

@@ -744,7 +744,7 @@ function initRoomEvents()
var query = 'ajax=1&token='+token+'&action=addRoomOnOrder&id_order='+id_order+'&';
// query += $('#add_product_warehouse').serialize()+'&';
query += $('#new_room select, #new_room input').serialize();
query += $('#new_room select, #new_room input ,#new_room textarea').serialize();
if ($('select#add_product_product_invoice').val() == 0)
query += '&'+$('tr#new_invoice select, tr#new_invoice input').serialize();
@@ -854,46 +854,102 @@ function initRoomEvents()
}
}
});
var DeleteRoomBookingModal = {
show: function(data) {
$(".loading_overlay").show();
$('.delete_room_line').unbind('click').click(function(e) {
if (!confirm(txt_confirm))
return false;
var tr_product = $(this).closest('.product-line-row');
var id_room = tr_product.data('id_room');
var id_product = tr_product.data('id_product');
var id_hotel = tr_product.data('id_hotel');
var date_from = tr_product.data('date_from');
var date_to = tr_product.data('date_to');
var id_order_detail = tr_product.data('id_order_detail');
var id_htl_booking = tr_product.data('id_htl_booking');
//var id_order_detail = $(this).closest('.product-line-row').find('td .edit_product_id_order_detail').val();
var query = 'ajax=1&action=deleteRoomLine&token='+token+'&id_order='+id_order+'&id_htl_booking='+id_htl_booking+'&id_room='+id_room+'&id_product='+id_product+'&id_hotel='+id_hotel+'&date_from='+date_from+'&date_to='+date_to+'&id_order_detail='+id_order_detail;
query += $(this).parent().parent().find('input, select:visible, .edit_product_id_order_detail').serialize();
$.ajax({
type: 'POST',
url: admin_order_tab_link,
cache: false,
dataType: 'json',
data : query,
success : function(data)
{
if (data.result)
{
tr_product.fadeOut('slow', function() {
$(this).remove();
});
updateAmounts(data.order);
updateInvoice(data.invoices);
updateDocuments(data.documents_html);
// Remove any previous modal to avoid duplicate IDs/handlers
if ($('#delete-room-booking-modal').length) {
$('#delete-room-booking-modal').remove();
$('.modal-backdrop').remove();
$('body').removeClass('modal-open');
}
window.location.href = admin_order_tab_link + '&conf=1&vieworder&id_order=' + data.order.id;
}
else
jAlert(data.error);
}
});
e.preventDefault();
});
$.ajax({
type: 'POST',
url: admin_order_tab_link,
dataType: 'json',
data: $.extend({ ajax: true, action: 'initDeleteRoomBookingModal' }, data),
beforeSend: function () {
$("#page-loader").show();
},
success: function (result) {
if (!result.hasError && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
$('#delete-room-booking-modal').modal('show');
$('#delete-room-booking-modal').on('hidden.bs.modal', function() {
$(this).remove();
});
} else if (result.error) {
showErrorMessage(result.error);
}
},
complete: function () {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
close: function() {
$('#delete-room-booking-modal').modal('hide');
}
};
$(document).off('click', '.delete_room_line').on('click', '.delete_room_line', function(e) {
e.preventDefault();
var tr_product = $(this).closest('.product-line-row');
var data = {
id_room : tr_product.data('id_room'),
id_product : tr_product.data('id_product'),
id_hotel : tr_product.data('id_hotel'),
date_from : tr_product.data('date_from'),
date_to : tr_product.data('date_to'),
id_order_detail : tr_product.data('id_order_detail'),
id_htl_booking : tr_product.data('id_htl_booking'),
id_order : id_order
};
DeleteRoomBookingModal.show(data);
});
$(document).off('click', '#submitRoomDelete').on('click', '#submitRoomDelete', function(e) {
e.preventDefault();
var remark = $('#room_remark').val().trim();
if (remark === '') {
$('#remarkGroup').addClass('has-error');
$('#room_remark').focus();
return false;
}
var id_room = $('input[name="id_room"]').val();
var id_product = $('input[name="id_product"]').val();
var id_hotel = $('input[name="id_hotel"]').val();
var date_from = $('input[name="date_from"]').val();
var date_to = $('input[name="date_to"]').val();
var id_order_detail = $('input[name="id_order_detail"]').val();
var id_htl_booking = $('input[name="id_htl_booking"]').val();
var id_order = $('input[name="id_order"]').val();
var query = 'ajax=1&action=deleteRoomLine&token='+token+'&id_order='+id_order+'&id_htl_booking='+id_htl_booking+'&id_room='+id_room+'&id_product='+id_product+'&id_hotel='+id_hotel+'&date_from='+date_from+'&date_to='+date_to+'&id_order_detail='+id_order_detail;
query += '&' + $(this).closest('.modal-content').find('input, select:visible, textarea').serialize();
$.ajax({
type: 'POST',
url: admin_order_tab_link,
cache: false,
dataType: 'json',
data: query,
success: function(data)
{
if (data.result)
{
updateAmounts(data.order);
updateInvoice(data.invoices);
updateDocuments(data.documents_html);
window.location.href = admin_order_tab_link + '&conf=1&vieworder&id_order=' + data.order.id;
}
else {
jAlert(data.error);
}
}
});
});
// order-payment-modal hide and show
$('#add_new_payment').on('click', function(e) {
@@ -1638,7 +1694,7 @@ $(document).ready(function() {
if (confirm(txt_confirm)) {
let query = 'ajax=1&token='+token+'&action=editRoomOnOrder&'+
$('#edit_product').find('input, select').serialize();
$('#edit_product').find('input, select ,textarea').serialize();
$(".loading_overlay").show();
$.ajax({
type: 'POST',

View File

@@ -104,6 +104,7 @@ const RoomReallocationModal = {
} else {
$(".swap_avail_rooms_container").empty().text(no_swap_rm_avail_txt).addClass('text-danger');
$("#swap_room_tab .modal-footer").hide();
$("#swap_room_tab .room_remark").closest('.form-group').hide();
}
// For Rooms Reallocation

View File

@@ -923,6 +923,8 @@ $(document).ready(function() {
// set positions of popups when required
if (page_name == 'index') {
setBookingSearchPositions();
$('#hotel_location, #id_hotel_button_chosen, #guest_occupancy').focus(function () {
setBookingSearchPositions();
});
@@ -934,6 +936,10 @@ $(document).ready(function() {
});
});
$('select#id_hotel_button').on('chosen:showing_dropdown', function() {
setBookingSearchPositions();
});
$('#daterange_value').click(function () {
setBookingSearchPositions();
});
@@ -993,9 +999,8 @@ function setBookingSearchPositions() {
// calculate max height for dropdowns
let maxHeightNeeded = 0;
$(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) {
if (!inputFieldAndDropdown.input.length) return false;
if (!inputFieldAndDropdown.input.length || !inputFieldAndDropdown.input.is(':visible')) return true;
// find needed space height
let cssMaxHeight = parseInt(inputFieldAndDropdown.dropdown.css('max-height'));
if (Number.isInteger(cssMaxHeight)) {
maxHeightNeeded = Math.max(maxHeightNeeded, cssMaxHeight);
@@ -1003,7 +1008,7 @@ function setBookingSearchPositions() {
});
// determine position class
if (spaceBottom < maxHeightNeeded && spaceTop > spaceBottom) {
if (spaceTop > spaceBottom && (maxHeightNeeded === 0 || spaceBottom < maxHeightNeeded)) {
positionClass = 'top';
}
}

View File

@@ -134,7 +134,12 @@
{/if}
</div>
<div class="col-xs-10">
<p>{$product['name']|escape:'html':'UTF-8'}</p>
<div>{$product['name']|escape:'html':'UTF-8'}</div>
{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}
<div class="price-per-night">
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}{if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{/if}{l s='/night'}
</div>
{/if}
{if $product.allow_multiple_quantity}
<div class="qty_container">
<input type="text" class="form-control qty" id="qty_{$product.id_product}" name="room_service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" data-max_quantity="{$product.max_quantity}" value="{if $serviceSelected}{$cartRoom['selected_service'][$product['id_product']]['quantity']}{else}1{/if}">
@@ -150,7 +155,21 @@
</div>
<div class="col-xs-4">
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}
<span class="pull-right">{if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}{l s='/Night'}{/if}</span>
<span class="room-service-product-value pull-right" data-unit_price="{if !$priceDisplay}{$product.price_tax_incl}{else}{$product.price_tax_exc}{/if}" data-currency_sign="{$currency->sign}">
{if !$priceDisplay}
{if $serviceSelected}
{convertPrice price=$cartRoom['selected_service'][$product['id_product']]['total_price_tax_incl']}
{else}
{convertPrice price=$product.price_tax_incl}
{/if}
{else}
{if $serviceSelected}
{convertPrice price=$cartRoom['selected_service'][$product['id_product']]['total_price_tax_excl']}
{else}
{convertPrice price=$product.price_tax_exc}
{/if}
{/if}
</span>
{/if}
</div>

View File

@@ -9052,6 +9052,11 @@ a.open_rooms_extra_services_panel {
border-radius: 0 0 4px 0;
box-shadow: 0 1px 0 0 rgb(0 0 0 / 13%);
}
#rooms_extra_services .price-per-night {
font-size: 12px;
color: #777;
margin-bottom: 5px;
}
/* fancybox changes */

View File

@@ -638,6 +638,9 @@ $(document).ready(function()
$(document).on('click', '#rooms_extra_services .qty_up', function(e) {
e.preventDefault();
qtyfield = $(this).closest('.qty_container').find('input.qty');
roomServiceProductValue = $(this).closest('.room_demand_block').find('.room-service-product-value');
roomServiceProductUnitPrice = roomServiceProductValue.data('unit_price');
roomServiceProductCurrencySign = roomServiceProductValue.data('currency_sign');
var newQuantity = parseInt(qtyfield.val()) + 1;
if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) {
newQuantity = qtyfield.data('max_quantity');
@@ -647,6 +650,8 @@ $(document).ready(function()
showErrorMessage(txtMaxQuantityAdded);
}
} else {
roomServiceProductTotalPriceQtyUp = newQuantity*roomServiceProductUnitPrice;
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQtyUp.toFixed(priceDisplayPrecision))
qtyfield.val(newQuantity).trigger('focusout');
}
});
@@ -654,9 +659,15 @@ $(document).ready(function()
$(document).on('click', '#rooms_extra_services .qty_down', function(e) {
e.preventDefault();
qtyfield = $(this).closest('.qty_container').find('input.qty');
roomServiceProductValue = $(this).closest('.room_demand_block').find('.room-service-product-value');
roomServiceProductUnitPrice = roomServiceProductValue.data('unit_price');
roomServiceProductCurrencySign = roomServiceProductValue.data('currency_sign');
var currentVal = parseInt(qtyfield.val());
if (!isNaN(currentVal) && currentVal > 1) {
qtyfield.val(currentVal - 1).trigger('focusout');
roomServiceProductTotalPriceQtyDown = qtyfield.val()*roomServiceProductUnitPrice;
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQtyDown.toFixed(priceDisplayPrecision))
} else {
qtyfield.val(1);
if (currentVal != 1) {
@@ -667,12 +678,20 @@ $(document).ready(function()
$(document).on('focusout', '#rooms_extra_services .qty', function(e) {
var qty_wntd = $(this).val();
if (qty_wntd == '' || !$.isNumeric(qty_wntd)) {
roomServiceProductValue = $(this).closest('.room_demand_block').find('.room-service-product-value');
roomServiceProductUnitPrice = roomServiceProductValue.data('unit_price');
roomServiceProductCurrencySign = roomServiceProductValue.data('currency_sign');
if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) {
$(this).val(1);
}
if ($(this).data('max_quantity') && $(this).data('max_quantity') < qty_wntd) {
$(this).val(qtyfield.data('max_quantity'));
}
roomServiceProductTotalPriceQty = $(this).val()*roomServiceProductUnitPrice;
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQty.toFixed(priceDisplayPrecision))
if ($(this).closest('.room_demand_block').find('.change_room_type_service_product').is(':checked')) {
updateServiceProducts($(this).closest('.room_demand_block').find('.change_room_type_service_product'));
}