Merge branch 'develop' into gli-2840
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
{if $can_edit}
|
||||
<div class="well">
|
||||
<form action="{$link->getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}&viewcustomer_thread&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'}&id_customer_thread={$thread->id|intval}&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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -712,7 +712,7 @@
|
||||
{if isset($messages) && $messages}
|
||||
<div class="panel order-notes">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-undo"></i> {l s='Order Private Notes'}
|
||||
<i class="icon-undo"></i> {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"> <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}
|
||||
|
||||
@@ -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;">
|
||||
|
||||
@@ -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> {l s="Delete Room"}
|
||||
</button>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#room_remark').on('input', function() {
|
||||
if ($(this).val().trim() !== '') {
|
||||
$('#remarkGroup').removeClass('has-error');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -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> {l s="Update Rooms"}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1179,9 +1179,10 @@ abstract class AdminTabCore
|
||||
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
|
||||
continue;
|
||||
}
|
||||
/* Automatically encrypt password in MD5 */
|
||||
/* Automatically hash password */
|
||||
if ($key == 'passwd' && !empty($value)) {
|
||||
$value = Tools::encrypt($value);
|
||||
$objHash = new PasswordHashing();
|
||||
$value = $objHash->passwordHash($value);
|
||||
}
|
||||
$object->{$key} = $value;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ class CustomerCore extends ObjectModel
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 32),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 60),
|
||||
'last_passwd_gen' => array('type' => self::TYPE_STRING, 'copy_post' => false),
|
||||
'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate'),
|
||||
@@ -383,19 +383,28 @@ class CustomerCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `email` = \''.pSQL($email).'\'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.(isset($passwd) ? 'AND `passwd` = \''.pSQL(Tools::encrypt($passwd)).'\'' : '').'
|
||||
AND `deleted` = 0
|
||||
'.($ignore_guest ? ' AND `is_guest` = 0' : ''));
|
||||
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
if (isset($passwd)) {
|
||||
$objHash = new PasswordHashing();
|
||||
if (!$objHash->validateHash($passwd, $result['passwd'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->id = $result['id_customer'];
|
||||
foreach ($result as $key => $value) {
|
||||
if (property_exists($this, $key)) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
}
|
||||
if (isset($passwd) && !$objHash->isPrimaryHash($passwd, $result['passwd'])) {
|
||||
$this->passwd = $objHash->passwordHash($passwd);
|
||||
$this->update();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -560,7 +569,7 @@ class CustomerCore extends ObjectModel
|
||||
*/
|
||||
public static function checkPassword($id_customer, $passwd)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_customer) || !Validate::isMd5($passwd)) {
|
||||
if (!Validate::isUnsignedId($id_customer)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
$cache_id = 'Customer::checkPassword'.(int)$id_customer.'-'.$passwd;
|
||||
@@ -852,7 +861,8 @@ class CustomerCore extends ObjectModel
|
||||
}
|
||||
|
||||
$this->is_guest = 0;
|
||||
$this->passwd = Tools::encrypt($password);
|
||||
$objHash = new PasswordHashing();
|
||||
$this->passwd = $objHash->passwordHash($password);
|
||||
$this->cleanGroups();
|
||||
$this->addGroups(array(Configuration::get('PS_CUSTOMER_GROUP'))); // add default customer group
|
||||
$this->id_default_group = (int) Configuration::get('PS_CUSTOMER_GROUP');
|
||||
@@ -887,7 +897,8 @@ class CustomerCore extends ObjectModel
|
||||
public function setWsPasswd($passwd)
|
||||
{
|
||||
if ($this->id == 0 || $this->passwd != $passwd) {
|
||||
$this->passwd = Tools::encrypt($passwd);
|
||||
$objHash = new PasswordHashing();
|
||||
$this->passwd = $objHash->passwordHash($passwd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class EmployeeCore extends ObjectModel
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 60),
|
||||
'last_passwd_gen' => array('type' => self::TYPE_STRING),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'optin' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
@@ -281,11 +281,17 @@ class EmployeeCore extends ObjectModel
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'employee`
|
||||
WHERE `email` = \''.pSQL($email).'\'
|
||||
'.($active_only ? ' AND `active` = 1' : '')
|
||||
.($passwd !== null ? ' AND `passwd` = \''.Tools::encrypt($passwd).'\'' : ''));
|
||||
'.($active_only ? ' AND `active` = 1' : ''));
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($passwd !== null) {
|
||||
$objHash = new PasswordHashing();
|
||||
if (!$objHash->validateHash($passwd, $result['passwd'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->id = $result['id_employee'];
|
||||
$this->id_profile = $result['id_profile'];
|
||||
foreach ($result as $key => $value) {
|
||||
@@ -293,6 +299,11 @@ class EmployeeCore extends ObjectModel
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($passwd !== null && !$objHash->isPrimaryHash($passwd, $result['passwd'])) {
|
||||
$this->passwd = $objHash->passwordHash($passwd);
|
||||
$this->update();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -316,7 +327,7 @@ class EmployeeCore extends ObjectModel
|
||||
*/
|
||||
public static function checkPassword($id_employee, $passwd)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_employee) || !Validate::isPasswd($passwd, 8)) {
|
||||
if (!Validate::isUnsignedId($id_employee)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
@@ -364,19 +375,20 @@ class EmployeeCore extends ObjectModel
|
||||
// validate and set password for the employee
|
||||
public function setWsPasswd($passwd)
|
||||
{
|
||||
$objHash = new PasswordHashing();
|
||||
if ($this->id != 0) {
|
||||
if ($this->passwd != $passwd) {
|
||||
if (!Validate::isPasswd($passwd, Validate::ADMIN_PASSWORD_LENGTH)) {
|
||||
WebserviceRequest::getInstance()->setError(400, 'The password must be at least '.Validate::ADMIN_PASSWORD_LENGTH.' characters long.', 134);
|
||||
} else {
|
||||
$this->passwd = Tools::encrypt($passwd);
|
||||
$this->passwd = $objHash->passwordHash($passwd);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!Validate::isPasswd($passwd, Validate::ADMIN_PASSWORD_LENGTH)) {
|
||||
WebserviceRequest::getInstance()->setError(400, 'The password must be at least '.Validate::ADMIN_PASSWORD_LENGTH.' characters long.', 134);
|
||||
} else {
|
||||
$this->passwd = Tools::encrypt($passwd);
|
||||
$this->passwd = $objHash->passwordHash($passwd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1188,7 +1188,8 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
}
|
||||
if ($field == 'passwd') {
|
||||
if ($value = Tools::getValue($field)) {
|
||||
$this->{$field} = Tools::encrypt($value);
|
||||
$objHash = new PasswordHashing();
|
||||
$this->{$field} = $objHash->passwordHash($value);
|
||||
}
|
||||
} else {
|
||||
$this->{$field} = $value;
|
||||
|
||||
122
classes/PasswordHashing.php
Normal file
122
classes/PasswordHashing.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?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 PasswordHashingCore
|
||||
{
|
||||
/** @var array Available password hashing methods. */
|
||||
private $passwordHashMethods = array();
|
||||
|
||||
/**
|
||||
* Check whether the stored hash matches the primary hashing method.
|
||||
*
|
||||
* @param string $passwd Plain-text password to validate.
|
||||
* @param string $hash Stored password hash.
|
||||
* @param string $staticSalt Static salt used by legacy hash methods.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPrimaryHash($passwd, $hash, $staticSalt = _COOKIE_KEY_)
|
||||
{
|
||||
if (!count($this->passwordHashMethods)) {
|
||||
$this->initPasswordHashMethods();
|
||||
}
|
||||
|
||||
$closure = reset($this->passwordHashMethods);
|
||||
|
||||
return $closure['verify']($passwd, $hash, $staticSalt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a password against all supported hashing methods.
|
||||
*
|
||||
* @param string $passwd Plain-text password to validate.
|
||||
* @param string $hash Stored password hash.
|
||||
* @param string $staticSalt Static salt used by legacy hash methods.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateHash($passwd, $hash, $staticSalt = _COOKIE_KEY_)
|
||||
{
|
||||
if (!count($this->passwordHashMethods)) {
|
||||
$this->initPasswordHashMethods();
|
||||
}
|
||||
|
||||
foreach ($this->passwordHashMethods as $closure) {
|
||||
if ($closure['verify']($passwd, $hash, $staticSalt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash a plain-text password with the primary hashing method.
|
||||
*
|
||||
* @param string $plaintextPassword Password to hash.
|
||||
* @param string $staticSalt Static salt reserved for legacy hash methods.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function passwordHash($plaintextPassword, $staticSalt = _COOKIE_KEY_)
|
||||
{
|
||||
if (!count($this->passwordHashMethods)) {
|
||||
$this->initPasswordHashMethods();
|
||||
}
|
||||
|
||||
$closure = reset($this->passwordHashMethods);
|
||||
|
||||
return $closure['hash']($plaintextPassword, $staticSalt, $closure['option']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the supported password hashing methods.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function initPasswordHashMethods()
|
||||
{
|
||||
$this->passwordHashMethods = array(
|
||||
'bcrypt' => array(
|
||||
'option' => array(),
|
||||
'hash' => function ($passwd, $staticSalt, $option) {
|
||||
return password_hash($passwd, PASSWORD_BCRYPT);
|
||||
},
|
||||
'verify' => function ($passwd, $hash, $staticSalt) {
|
||||
return password_verify($passwd, $hash);
|
||||
},
|
||||
),
|
||||
'md5' => array(
|
||||
'option' => array(),
|
||||
'hash' => function ($passwd, $staticSalt, $option) {
|
||||
return md5($staticSalt.$passwd);
|
||||
},
|
||||
'verify' => function ($passwd, $hash, $staticSalt) {
|
||||
return md5($staticSalt.$passwd) === $hash;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class ReferrerCore extends ObjectModel
|
||||
'primary' => 'id_referrer',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'size' => 32),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'size' => 60),
|
||||
'http_referer_regexp' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 64),
|
||||
'request_uri_regexp' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 64),
|
||||
'http_referer_like' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 64),
|
||||
|
||||
@@ -1140,4 +1140,4 @@ class ValidateCore
|
||||
{
|
||||
return (preg_match('/^(?:'.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).')\s*([0-9]+)$/i', $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3842,9 +3842,10 @@ class AdminControllerCore extends Controller
|
||||
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
|
||||
continue;
|
||||
}
|
||||
/* Automatically encrypt password in MD5 */
|
||||
/* Automatically hash password */
|
||||
if ($key == 'passwd' && !empty($value)) {
|
||||
$value = Tools::encrypt($value);
|
||||
$objHash = new PasswordHashing();
|
||||
$value = $objHash->passwordHash($value);
|
||||
}
|
||||
$object->{$key} = $value;
|
||||
}
|
||||
@@ -4821,4 +4822,4 @@ class AdminControllerCore extends Controller
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,6 +689,7 @@ abstract class ModuleCore
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
Hook::exec('actionModuleUninstallBefore', array('object' => $this));
|
||||
// Check module installation id validation
|
||||
if (!Validate::isUnsignedId($this->id)) {
|
||||
$this->_errors[] = Tools::displayError('The module is not installed.');
|
||||
|
||||
@@ -1392,7 +1392,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$objCustomer->firstname = $customerDetails['firstname'];
|
||||
$objCustomer->lastname = $customerDetails['lastname'];
|
||||
$objCustomer->email = $customerDetails['email'];
|
||||
$objCustomer->passwd = md5(time()._COOKIE_KEY_);
|
||||
$objHash = new PasswordHashing();
|
||||
$objCustomer->passwd = $objHash->passwordHash(Tools::passwdGen(32, 'RANDOM'));
|
||||
$objCustomer->phone = (isset($customerDetails['phone']) ? $customerDetails['phone'] : '');
|
||||
$objCustomer->cleanGroups();
|
||||
$objCustomer->add();
|
||||
|
||||
@@ -45,6 +45,8 @@ ini_set('magic_quotes_sybase', 0);
|
||||
/* correct Apache charset (except if it's too late */
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
header('X-Powered-By: QloApps');
|
||||
header('X-Built-With: QloApps');
|
||||
}
|
||||
|
||||
/* No settings file? goto installer... */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2835,7 +2835,8 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $customer);
|
||||
if ($customer->passwd) {
|
||||
$customer->passwd = Tools::encrypt($customer->passwd);
|
||||
$objHash = new PasswordHashing();
|
||||
$customer->passwd = $objHash->passwordHash($customer->passwd);
|
||||
}
|
||||
|
||||
$customers_shop = array();
|
||||
|
||||
@@ -263,7 +263,8 @@ class AdminLoginControllerCore extends AdminController
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$pwd = Tools::passwdGen(10, 'RANDOM');
|
||||
$employee->passwd = Tools::encrypt($pwd);
|
||||
$objHash = new PasswordHashing();
|
||||
$employee->passwd = $objHash->passwordHash($pwd);
|
||||
$employee->last_passwd_gen = date('Y-m-d H:i:s', time());
|
||||
|
||||
$params = array(
|
||||
|
||||
@@ -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>  '.$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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class IdentityControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('This email address is not valid');
|
||||
} elseif ($this->customer->email != $email && Customer::customerExists($email, true)) {
|
||||
$this->errors[] = Tools::displayError('An account using this email address has already been registered.');
|
||||
} elseif (!Tools::getIsset('old_passwd') || (Tools::encrypt($old_passwd) != $this->context->cookie->passwd)) {
|
||||
} elseif (!Tools::getIsset('old_passwd') || !(new PasswordHashing())->validateHash($old_passwd, $this->context->cookie->passwd)) {
|
||||
$this->errors[] = Tools::displayError('The password you entered is incorrect.');
|
||||
} elseif (Tools::getValue('passwd') != Tools::getValue('confirmation')) {
|
||||
$this->errors[] = Tools::displayError('The password and confirmation do not match.');
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -73,7 +73,8 @@ class PasswordControllerCore extends FrontController
|
||||
} elseif ((strtotime($customer->last_passwd_gen.'+'.(int)Configuration::get('PS_PASSWD_TIME_FRONT').' minutes') - time()) > 0) {
|
||||
Tools::redirect('index.php?controller=authentication&error_regen_pwd');
|
||||
} else {
|
||||
$customer->passwd = Tools::encrypt($password = Tools::passwdGen(MIN_PASSWD_LENGTH, 'RANDOM'));
|
||||
$objHash = new PasswordHashing();
|
||||
$customer->passwd = $objHash->passwordHash($password = Tools::passwdGen(MIN_PASSWD_LENGTH, 'RANDOM'));
|
||||
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
|
||||
if ($customer->update()) {
|
||||
Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password));
|
||||
|
||||
@@ -675,6 +675,7 @@ class ProductControllerCore extends FrontController
|
||||
'id_room_type' => $idProduct,
|
||||
'id_cart' => $idCart,
|
||||
'id_guest' => $idGuest,
|
||||
'search_unavai' => 1,
|
||||
);
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$bookingParams['occupancy'] = $occupancy;
|
||||
@@ -693,9 +694,39 @@ class ProductControllerCore extends FrontController
|
||||
}
|
||||
|
||||
$totalAvailableRooms = 0;
|
||||
$losRestrictionFailed = false;
|
||||
$losMinFailed = false;
|
||||
$losMaxFailed = false;
|
||||
// Initialize LOS values for the selected room type/date
|
||||
$objRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
|
||||
$losRestriction = $objRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($idProduct, $dateFrom);
|
||||
$losMinDays = (int) ($losRestriction ? $losRestriction['min_los'] : 1);
|
||||
$losMaxDays = (int) ($losRestriction ? $losRestriction['max_los'] : 0);
|
||||
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
|
||||
$totalAvailableRooms = $hotelRoomData['stats']['num_avail'];
|
||||
$quantity = ($quantity > $totalAvailableRooms) ? $totalAvailableRooms : $quantity;
|
||||
// Check if rooms are unavailable due to LOS restriction
|
||||
if ($totalAvailableRooms <= 0 && !empty($hotelRoomData['rm_data'][$idProduct]['data']['unavailable'])) {
|
||||
foreach ($hotelRoomData['rm_data'][$idProduct]['data']['unavailable'] as $unavailableRoom) {
|
||||
if (empty($unavailableRoom['detail'])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($unavailableRoom['detail'] as $detail) {
|
||||
if (!empty($detail['id_status']) && $detail['id_status'] == HotelRoomInformation::STATUS_SEARCH_LOS_UNSATISFIED) {
|
||||
$losRestrictionFailed = true;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($losRestrictionFailed) {
|
||||
// Determine which restriction failed
|
||||
if ($numDays < $losMinDays) {
|
||||
$losMinFailed = true;
|
||||
} elseif ($losMaxDays > 0 && $numDays > $losMaxDays) {
|
||||
$losMaxFailed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate room type price first
|
||||
@@ -863,6 +894,11 @@ class ProductControllerCore extends FrontController
|
||||
$smartyVars['num_days'] = $numDays;
|
||||
$smartyVars['warning_count'] = $warningCount;
|
||||
$smartyVars['total_available_rooms'] = $totalAvailableRooms;
|
||||
$smartyVars['los_restriction_failed'] = $losRestrictionFailed;
|
||||
$smartyVars['los_min_days'] = $losMinDays;
|
||||
$smartyVars['los_max_days'] = $losMaxDays;
|
||||
$smartyVars['los_min_failed'] = $losMinFailed;
|
||||
$smartyVars['los_max_failed'] = $losMaxFailed;
|
||||
$smartyVars['has_room_type_demands'] = $roomTypeDemands ? true : false; // whether to show price breakup
|
||||
$smartyVars['rooms_price'] = $totalRoomPrice;
|
||||
$smartyVars['demands_price_per_room'] = $demandsPricePerRoom;
|
||||
|
||||
@@ -593,7 +593,7 @@ CREATE TABLE `PREFIX_customer` (
|
||||
`firstname` varchar(32) NOT NULL,
|
||||
`lastname` varchar(32) NOT NULL,
|
||||
`email` varchar(128) NOT NULL,
|
||||
`passwd` varchar(32) NOT NULL,
|
||||
`passwd` varchar(60) NOT NULL,
|
||||
`last_passwd_gen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`birthday` date DEFAULT NULL,
|
||||
`newsletter` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
@@ -779,7 +779,7 @@ CREATE TABLE `PREFIX_employee` (
|
||||
`lastname` varchar(32) NOT NULL,
|
||||
`firstname` varchar(32) NOT NULL,
|
||||
`email` varchar(128) NOT NULL,
|
||||
`passwd` varchar(32) NOT NULL,
|
||||
`passwd` varchar(60) NOT NULL,
|
||||
`last_passwd_gen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`stats_date_from` date DEFAULT NULL,
|
||||
`stats_date_to` date DEFAULT NULL,
|
||||
@@ -1781,7 +1781,7 @@ CREATE TABLE `PREFIX_range_weight` (
|
||||
CREATE TABLE `PREFIX_referrer` (
|
||||
`id_referrer` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`passwd` varchar(32) DEFAULT NULL,
|
||||
`passwd` varchar(60) DEFAULT NULL,
|
||||
`http_referer_regexp` varchar(64) DEFAULT NULL,
|
||||
`http_referer_like` varchar(64) DEFAULT NULL,
|
||||
`request_uri_regexp` varchar(64) DEFAULT NULL,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -35,7 +35,8 @@ class InstallFixturesFashion extends InstallXmlLoader
|
||||
public function createEntityCustomer($identifier, array $data, array $data_lang)
|
||||
{
|
||||
if ($identifier == 'John') {
|
||||
$data['passwd'] = Tools::encrypt('123456789');
|
||||
$objHash = new PasswordHashing();
|
||||
$data['passwd'] = $objHash->passwordHash('123456789');
|
||||
$data['last_passwd_gen'] = date('Y-m-d H:i:s');
|
||||
$data['birthday'] = date('Y-m-d', strtotime('-30 years'));
|
||||
$data['newsletter_date_add'] = date('Y-m-d H:i:s');
|
||||
|
||||
@@ -566,7 +566,8 @@ class InstallModelInstall extends InstallAbstractModel
|
||||
$employee->firstname = Tools::ucfirst($data['admin_firstname']);
|
||||
$employee->lastname = Tools::ucfirst($data['admin_lastname']);
|
||||
$employee->email = $data['admin_email'];
|
||||
$employee->passwd = md5(_COOKIE_KEY_.$data['admin_password']);
|
||||
$objHash = new PasswordHashing();
|
||||
$employee->passwd = $objHash->passwordHash($data['admin_password']);
|
||||
$employee->last_passwd_gen = date('Y-m-d h:i:s', strtotime('-360 minutes'));
|
||||
$employee->bo_theme = 'default';
|
||||
$employee->default_tab = 1;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,17 @@
|
||||
{/block}
|
||||
{else}
|
||||
<div class="sold_out_alert">
|
||||
<span>{l s='All rooms sold out!'}</span>
|
||||
{if isset($los_restriction_failed) && $los_restriction_failed}
|
||||
<span>
|
||||
{if isset($los_min_failed) && $los_min_failed}
|
||||
{l s='Minimum stay allowed is %d nights.' sprintf=[$los_min_days]}
|
||||
{elseif isset($los_max_failed) && $los_max_failed}
|
||||
{l s='Maximum stay allowed is %d nights.' sprintf=[$los_max_days]}
|
||||
{/if}
|
||||
</span>
|
||||
{else}
|
||||
<span>{l s='All rooms sold out!'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{if isset($meta_keywords) AND $meta_keywords}
|
||||
<meta name="keywords" content="{$meta_keywords|escape:'html':'UTF-8'}" />
|
||||
{/if}
|
||||
<meta name="generator" content="QloApps" />
|
||||
<meta name="generator" content="QloApps {{ _QLO_VERSION_ }}" />
|
||||
<meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=0.25, maximum-scale=1.6, initial-scale=1.0" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
@@ -77,7 +77,8 @@
|
||||
<!-- <link href='https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700,700italic' rel='stylesheet' type='text/css'> -->
|
||||
<link href='//fonts.googleapis.com/css?family=Oxygen:400,300,700' rel='stylesheet' type='text/css'>
|
||||
</head>
|
||||
<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {' '|implode:$body_classes}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} hide-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}" style="{if $page_name == 'index'}height: 100%;{/if}">
|
||||
<!-- Built with QloApps -->
|
||||
<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="qloapps {if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {' '|implode:$body_classes}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} hide-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}" style="{if $page_name == 'index'}height: 100%;{/if}">
|
||||
{if !isset($content_only) || !$content_only}
|
||||
{if isset($restricted_country_mode) && $restricted_country_mode}
|
||||
<div id="restricted-country">
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user