Merge branch 'develop' into gli-2007

This commit is contained in:
Shreesh Arora
2024-10-04 17:03:51 +05:30
38 changed files with 421 additions and 335 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -20,7 +20,7 @@ $chosen-focus-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82,
$chosen-focus-transition: border linear .2s, box-shadow linear .2s
$chosen-height: $input-height-base
$chosen-multi-height: $input-height-base + 6px
$chosen-sprite-path: '../img/chosen-sprite.png'
$chosen-sprite-path: '#{$img-path}/chosen-sprite.png'
.chosen-select
width: 100%

View File

@@ -86,7 +86,7 @@ Version: 3.4.6 Timestamp: Sat Mar 22 22:30:15 EDT 2014
text-decoration: none;
border: 0;
background: url('../img/select2.png') right top no-repeat;
background: url('#{$img-path}/select2.png') right top no-repeat;
cursor: pointer;
outline: 0;
}
@@ -182,7 +182,7 @@ Version: 3.4.6 Timestamp: Sat Mar 22 22:30:15 EDT 2014
display: block;
width: 100%;
height: 100%;
background: url('../img/select2.png') no-repeat 0 1px;
background: url('#{$img-path}/select2.png') no-repeat 0 1px;
}
.select2-search {
@@ -215,8 +215,8 @@ Version: 3.4.6 Timestamp: Sat Mar 22 22:30:15 EDT 2014
-webkit-box-shadow: none;
box-shadow: none;
background: #fff url('../img/select2.png') no-repeat 100% -22px;
background: url('../img/select2.png') no-repeat 100% -22px;
background: #fff url('#{$img-path}/select2.png') no-repeat 100% -22px;
background: url('#{$img-path}/select2.png') no-repeat 100% -22px;
}
.select2-drop.select2-drop-above .select2-search input {
@@ -224,8 +224,8 @@ Version: 3.4.6 Timestamp: Sat Mar 22 22:30:15 EDT 2014
}
.select2-search input.select2-active {
background: #fff url('../img/select2-spinner.gif') no-repeat 100%;
background: url('../img/select2-spinner.gif') no-repeat 100%;
background: #fff url('#{$img-path}/select2-spinner.gif') no-repeat 100%;
background: url('#{$img-path}/select2-spinner.gif') no-repeat 100%;
}
.select2-container-active .select2-choice,
@@ -369,7 +369,7 @@ disabled look for disabled choices in the results dropdown
}
.select2-more-results.select2-active {
background: #f4f4f4 url('../img/select2-spinner.gif') no-repeat 100%;
background: #f4f4f4 url('#{$img-path}/select2-spinner.gif') no-repeat 100%;
}
.select2-more-results {
@@ -456,7 +456,7 @@ html[dir="rtl"] .select2-container-multi .select2-choices li
}
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
background: #fff url('../img/select2-spinner.gif') no-repeat 100% !important;
background: #fff url('#{$img-path}/select2-spinner.gif') no-repeat 100% !important;
}
.select2-default {
@@ -512,7 +512,7 @@ html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
font-size: 1px;
outline: none;
background: url('../img/select2.png') right top no-repeat;
background: url('#{$img-path}/select2.png') right top no-repeat;
}
html[dir="rtl"] .select2-search-choice-close {
right: auto;
@@ -590,7 +590,7 @@ html[dir="rtl"] .select2-search-choice-close {
.select2-search-choice-close,
.select2-container .select2-choice abbr,
.select2-container .select2-choice .select2-arrow b {
background-image: url('../img/select2x2.png') !important;
background-image: url('#{$img-path}/select2x2.png') !important;
background-repeat: no-repeat !important;
background-size: 60px 40px !important;
}
@@ -607,7 +607,7 @@ html[dir="rtl"] .select2-search-choice-close {
}
.form-control .select2-choice .select2-arrow {
border-radius: 0 2px 2px 0;
border-radius: 0 2px 2px 0;
}
.form-control.select2-container {

View File

@@ -1210,7 +1210,7 @@ i.mce-i-resize
opacity: .6
filter: alpha(opacity = 60)
zoom: 1
background: white url('img/loader.gif') no-repeat center center
background: white url('#{$img-path}/loader.gif') no-repeat center center
.mce-i-none
width: 16px

View File

@@ -54,14 +54,11 @@
{/if}
{/foreach}
{/if}
{foreach from=$js_files item=js_uri}
<script type="text/javascript" src="{$js_uri}"></script>
{/foreach}
<script type="text/javascript" src="../js/admin/login.js?v={$smarty.const._PS_VERSION_|escape:'html':'UTF-8'}"></script>
{if (isset($js_def) && count($js_def) || isset($js_files) && count($js_files))}
{include file=$smarty.const._PS_ALL_THEMES_DIR_|cat:"javascript.tpl"}
{/if}
<script type="text/javascript" src="../js/admin/login.js?v={$smarty.const._PS_VERSION_|escape:'html':'UTF-8'}"></script>
</head>
<body class="ps_back-office bootstrap">
<div id="login">

View File

@@ -247,7 +247,7 @@
function afterDeleteProductImage(data)
{
data = $.parseJSON(data);
if (data)
if (data.status)
{
cover = 0;
id = data.content.id;
@@ -265,6 +265,8 @@
if (parseInt($("#countImage").html()) <= 1)
$('#caption_selection').addClass('hidden');
} else if (data.error) {
showErrorMessage(data.error);
}
}

View File

@@ -247,7 +247,7 @@
function afterDeleteProductImage(data)
{
data = $.parseJSON(data);
if (data)
if (data.status)
{
cover = 0;
id = data.content.id;
@@ -265,6 +265,8 @@
if (parseInt($("#countImage").html()) <= 1)
$('#caption_selection').addClass('hidden');
} else if (data.error) {
showErrorMessage(data.error);
}
}

View File

@@ -42,7 +42,7 @@
{if isset($use_checkbox) && $use_checkbox == true}
function checkAll($tree)
{
$tree.find(":input[type=checkbox]").each(
$tree.find(":input[type=checkbox]:not([hidden])").each(
function()
{
$(this).prop("checked", true);
@@ -53,7 +53,7 @@
function uncheckAll($tree)
{
$tree.find(":input[type=checkbox]").each(
$tree.find(":input[type=checkbox]:not([hidden])").each(
function()
{
$(this).prop("checked", false);
@@ -64,7 +64,8 @@
{/if}
{if isset($use_search) && $use_search == true}
$("#{$id|escape:'html':'UTF-8'}-search").bind("typeahead:selected", function(obj, datum) {
$("#{$id|escape:'html':'UTF-8'}").find(":input").each(
var suffix = '{if isset($use_checkbox) && $use_checkbox == true}[]{/if}';
$("#{$id|escape:'html':'UTF-8'}").find('[name="'+datum.input_name + suffix + '"]:input').each(
function()
{
if ($(this).val() == datum.value)
@@ -78,6 +79,15 @@
$(this).show();
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
{if isset($auto_select_children) && $auto_select_children == true}
if ($(this).closest('.tree-item').length == 0) {
$(this).closest('.tree-folder').find(':input[type=checkbox]').each(function(){
$(this).prop('checked', true);
$(this).parent().addClass('tree-selected');
});
}
{/if}
}
}
);
@@ -86,7 +96,7 @@
{if isset($auto_select_children) && $auto_select_children == true}
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=checkbox]').on('click', function(){
if ($(this).closest('.tree-item').length ==0) {
if ($(this).closest('.tree-item').length == 0) {
if ($(this).is(":checked")) {
$(this).closest('.tree-folder').find(':input[type=checkbox]').each(function(){
$(this).prop('checked', true);
@@ -111,9 +121,13 @@
});
{/if}
$(document).ready(function () {
var tree = $("#{$id|escape:'html':'UTF-8'}").tree('collapseAll');
function startTree() {
if (typeof $.fn.tree === 'undefined') {
setTimeout(startTree, 100);
return;
}
var tree = $("#{$id|escape:'html':'UTF-8'}").tree('collapseAll');
if ($("#{$id|escape:'html':'UTF-8'}").find(":input:checked").length > 1)
$('#expand-all-{$id|escape:'html':'UTF-8'}').hide();
@@ -127,6 +141,10 @@
$(this).prev().find('.icon-folder-close').removeClass('icon-folder-close').addClass('icon-folder-open');
});
});
}
$(document).ready(function () {
startTree();
});
{/block}
</script>

View File

@@ -22,7 +22,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-folder">
<li class="tree-folder" {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}>
<span class="tree-folder-name">
<i class="icon-folder-close"></i>
<label class="tree-toggler">{$node['name']|escape:'html':'UTF-8'}</label>

View File

@@ -22,10 +22,10 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-folder">
<li class="tree-folder" {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}>
<span class="tree-folder-name{if isset($node['disabled']) && $node['disabled'] == true} tree-folder-name-disable{/if}">
{if !isset($selectable) || $selectable}
<input type="checkbox" name="{$node['input_name']}[]" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<input type="checkbox" name="{$node['input_name']}[]" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}/>
{/if}
<i class="icon-folder-close"></i>
<label class="tree-toggler">{if isset($node['name'])}{$node['name']|escape:'html':'UTF-8'}{/if}{if isset($node['selected_childs']) && (int)$node['selected_childs'] > 0} {l s='(%s selected)' sprintf=$node['selected_childs']}{/if}</label>

View File

@@ -22,10 +22,10 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-folder">
<li class="tree-folder" {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}>
<span class="tree-folder-name{if isset($node['disabled']) && $node['disabled'] == true} tree-folder-name-disable{/if}">
{if !isset($selectable) || $selectable}
<input type="radio" name="{$node['input_name']}" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<input type="radio" name="{$node['input_name']}" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}/>
{/if}
<i class="icon-folder-close"></i>
<label class="tree-toggler">{$node['name']|escape:'html':'UTF-8'}</label>

View File

@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-item">
<li class="tree-item" {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}>
<span class="tree-item-name">
<i class="tree-dot"></i>
<label class="tree-toggler">{$node['name']}</label>

View File

@@ -22,9 +22,9 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}">
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}" {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}>
<span class="tree-item-name{if isset($node['disabled']) && $node['disabled'] == true} tree-item-name-disable{/if}">
<input type="checkbox" name="{$node['input_name']}[]" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<input type="checkbox" name="{$node['input_name']}[]" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if} />
<i class="tree-dot"></i>
<label class="tree-toggler">{$node['name']}</label>
</span>

View File

@@ -22,9 +22,9 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}">
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}" {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if}>
<span class="tree-item-name">
<input type="radio" name="{$node['input_name']}" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<input type="radio" name="{$node['input_name']}" value="{$node['value']}"{if isset($node['selected']) && $node['selected'] == true} checked="checked"{/if}{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} {if isset($node['hidden']) && $node['hidden'] == true} hidden="hidden"{/if} />
<i class="tree-dot"></i>
<label class="tree-toggler">{$node['name']}</label>
</span>

View File

@@ -565,7 +565,7 @@ class CartRuleCore extends ObjectModel
return (!$display_error) ? false : Tools::displayError('This voucher has expired');
}
if (!$alreadyInCart && $context->cart->getOrderTotal(true, Cart::BOTH) <= 0) {
return (!$display_error) ? false : Tools::displayError('You cannot add more vouchers. Please remove an existing voucher before applying a new one.');
return (!$display_error) ? false : Tools::displayError('You cannot add more vouchers since the booking amount has already reached zero. Please remove an existing voucher before adding a new one.');
}
if ($context->cart->id_customer) {

View File

@@ -1027,7 +1027,7 @@ class AdminControllerCore extends Controller
public function processListVisibility()
{
$listFieldsVisibility = Tools::getValue('list_fields_visibility', array()); // To set optional list empty in case none is selected
$controller = 'list_visibility_'.$this->context->controller->className;
$controller = 'list_visibility_'.$this->context->controller->controller_name;
$this->context->cookie->$controller = json_encode($listFieldsVisibility);
return true;

View File

@@ -726,7 +726,7 @@ class HelperListCore extends Helper
}
// get selected fields to display
$list_visibility = json_decode($this->context->cookie->{'list_visibility_'.$this->context->controller->className});
$list_visibility = json_decode($this->context->cookie->{'list_visibility_'.$this->context->controller->controller_name});
foreach ($this->fields_list as $key => $field) {
if (!(isset($field['search']) && $field['search'] === false)) {
$has_search_field = true;

View File

@@ -601,15 +601,15 @@ class AdminCartRulesControllerCore extends AdminController
$products['selected'] = HotelBranchInformation::filterDataByHotelAccess(
$products['selected'],
$this->context->employee->id_profile,
0,
1,
false,
'id',
1
);
$products['unselected'] = HotelBranchInformation::filterDataByHotelAccess(
$products['unselected'],
$this->context->employee->id_profile,
0,
1,
false,
'id',
1
);
Context::getContext()->smarty->assign('product_rule_itemlist', $products);

View File

@@ -177,7 +177,7 @@ class AdminEmployeesControllerCore extends AdminController
{
parent::initPageHeaderToolbar();
if (empty($this->display)) {
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new_employee'] = array(
'href' => self::$currentIndex.'&addemployee&token='.$this->token,
'desc' => $this->l('Add new employee', null, null, false),

View File

@@ -823,7 +823,7 @@ class AdminImagesControllerCore extends AdminController
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new_image_type'] = array(
'href' => self::$currentIndex.'&addimage_type&token='.$this->token,
'desc' => $this->l('Add new image type', null, null, false),

View File

@@ -170,7 +170,7 @@ class AdminLocalizationControllerCore extends AdminController
}
if (Tools::isSubmit('submitLocalizationPack')) {
$version = str_replace('.', '', _PS_VERSION_);
$version = str_replace('.', '', _QLOAPPS_VERSION_);
$version = substr($version, 0, 2);
if (($iso_localization_pack = Tools::getValue('iso_localization_pack')) && Validate::isFileName($iso_localization_pack)) {

View File

@@ -229,7 +229,7 @@ class AdminMetaControllerCore extends AdminController
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new_meta'] = array(
'href' => self::$currentIndex.'&addmeta&token='.$this->token,
'desc' => $this->l('Add a new page', null, null, false),

View File

@@ -1393,7 +1393,7 @@ class AdminNormalProductsControllerCore extends AdminController
}
if (in_array($this->display, array('add', 'edit'))
&& $this->tabAccess[$this->display] == '1'
&& $this->tabAccess['view'] == '1'
&& $this->loadObject(true)
) {
$this->addJqueryUI(array(
@@ -1627,6 +1627,9 @@ class AdminNormalProductsControllerCore extends AdminController
public function ajaxProcessDeleteProductImage()
{
if ($this->tabAccess['edit'] === '0') {
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
}
$this->display = 'content';
$res = true;
/* Delete product image */
@@ -3579,125 +3582,130 @@ class AdminNormalProductsControllerCore extends AdminController
public function ajaxProcessaddProductImage()
{
self::$currentIndex = 'index.php?tab=AdminNormalProducts';
$product = new Product((int)Tools::getValue('id_product'));
$legends = Tools::getValue('legend');
if (!is_array($legends)) {
$legends = (array)$legends;
}
if (!Validate::isLoadedObject($product)) {
$files = array();
$files[0]['error'] = Tools::displayError('Cannot add image because product creation failed.');
}
$files = array();
$image_uploader = new HelperImageUploader('file');
$image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
$files = $image_uploader->process();
if ($this->tabAccess['edit'] === '0') {
$files[0]['name'] = $this->l('Error');
$files[0]['error'] = Tools::displayError('You do not have the right permission.');
} else {
self::$currentIndex = 'index.php?tab=AdminNormalProducts';
$product = new Product((int)Tools::getValue('id_product'));
$legends = Tools::getValue('legend');
foreach ($files as &$file) {
$image = new Image();
$image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1;
foreach ($legends as $key => $legend) {
if (!empty($legend)) {
$image->legend[(int)$key] = $legend;
}
if (!is_array($legends)) {
$legends = (array)$legends;
}
if (!Image::getCover($image->id_product)) {
$image->cover = 1;
} else {
$image->cover = 0;
if (!Validate::isLoadedObject($product)) {
$files[0]['error'] = Tools::displayError('Cannot add image because product creation failed.');
}
if (($validate = $image->validateFieldsLang(false, true)) !== true) {
$file['error'] = Tools::displayError($validate);
}
$image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
$files = $image_uploader->process();
if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
continue;
}
foreach ($files as &$file) {
$image = new Image();
$image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1;
if (!$image->add()) {
$file['error'] = Tools::displayError('Error while creating additional image');
} else {
if (!$new_path = $image->getPathForCreation()) {
$file['error'] = Tools::displayError('An error occurred during new folder creation');
continue;
}
$error = 0;
if (!ImageManager::resize($file['save_path'], $new_path.'.'.$image->image_format, null, null, 'jpg', false, $error)) {
switch ($error) {
case ImageManager::ERROR_FILE_NOT_EXIST :
$file['error'] = Tools::displayError('An error occurred while copying image, the file does not exist anymore.');
break;
case ImageManager::ERROR_FILE_WIDTH :
$file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
break;
case ImageManager::ERROR_MEMORY_LIMIT :
$file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
break;
default:
$file['error'] = Tools::displayError('An error occurred while copying image.');
break;
foreach ($legends as $key => $legend) {
if (!empty($legend)) {
$image->legend[(int)$key] = $legend;
}
continue;
}
if (!Image::getCover($image->id_product)) {
$image->cover = 1;
} else {
$imagesTypes = ImageType::getImagesTypes('products');
$generate_hight_dpi_images = (bool)Configuration::get('PS_HIGHT_DPI');
$image->cover = 0;
}
foreach ($imagesTypes as $imageType) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format)) {
$file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
continue;
if (($validate = $image->validateFieldsLang(false, true)) !== true) {
$file['error'] = Tools::displayError($validate);
}
if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
continue;
}
if (!$image->add()) {
$file['error'] = Tools::displayError('Error while creating additional image');
} else {
if (!$new_path = $image->getPathForCreation()) {
$file['error'] = Tools::displayError('An error occurred during new folder creation');
continue;
}
$error = 0;
if (!ImageManager::resize($file['save_path'], $new_path.'.'.$image->image_format, null, null, 'jpg', false, $error)) {
switch ($error) {
case ImageManager::ERROR_FILE_NOT_EXIST :
$file['error'] = Tools::displayError('An error occurred while copying image, the file does not exist anymore.');
break;
case ImageManager::ERROR_FILE_WIDTH :
$file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
break;
case ImageManager::ERROR_MEMORY_LIMIT :
$file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
break;
default:
$file['error'] = Tools::displayError('An error occurred while copying image.');
break;
}
continue;
} else {
$imagesTypes = ImageType::getImagesTypes('products');
$generate_hight_dpi_images = (bool)Configuration::get('PS_HIGHT_DPI');
if ($generate_hight_dpi_images) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'2x.'.$image->image_format, (int)$imageType['width']*2, (int)$imageType['height']*2, $image->image_format)) {
foreach ($imagesTypes as $imageType) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format)) {
$file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
continue;
}
if ($generate_hight_dpi_images) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'2x.'.$image->image_format, (int)$imageType['width']*2, (int)$imageType['height']*2, $image->image_format)) {
$file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
continue;
}
}
}
}
unlink($file['save_path']);
//Necesary to prevent hacking
unset($file['save_path']);
Hook::exec('actionWatermark', array('id_image' => $image->id, 'id_product' => $product->id));
if (!$image->update()) {
$file['error'] = Tools::displayError('Error while updating status');
continue;
}
// Associate image to shop from context
$shops = Shop::getContextListShopID();
$image->associateTo($shops);
$json_shops = array();
foreach ($shops as $id_shop) {
$json_shops[$id_shop] = true;
}
$file['status'] = 'ok';
$file['id'] = $image->id;
$file['position'] = $image->position;
$file['cover'] = $image->cover;
$file['legend'] = $image->legend;
$file['path'] = $image->getExistingImgPath();
$file['shops'] = $json_shops;
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg');
}
unlink($file['save_path']);
//Necesary to prevent hacking
unset($file['save_path']);
Hook::exec('actionWatermark', array('id_image' => $image->id, 'id_product' => $product->id));
if (!$image->update()) {
$file['error'] = Tools::displayError('Error while updating status');
continue;
}
// Associate image to shop from context
$shops = Shop::getContextListShopID();
$image->associateTo($shops);
$json_shops = array();
foreach ($shops as $id_shop) {
$json_shops[$id_shop] = true;
}
$file['status'] = 'ok';
$file['id'] = $image->id;
$file['position'] = $image->position;
$file['cover'] = $image->cover;
$file['legend'] = $image->legend;
$file['path'] = $image->getExistingImgPath();
$file['shops'] = $json_shops;
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg');
}
}

View File

@@ -1488,7 +1488,7 @@ class AdminProductsControllerCore extends AdminController
));
if (in_array($this->display, array('add', 'edit'))
&& $this->tabAccess[$this->display] == '1'
&& $this->tabAccess['view'] == '1'
&& $this->loadObject(true)
) {
$this->addJqueryUI(array(
@@ -1622,6 +1622,9 @@ class AdminProductsControllerCore extends AdminController
public function ajaxProcessDeleteProductImage()
{
if ($this->tabAccess['edit'] === '0') {
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
}
$this->display = 'content';
$res = true;
/* Delete product image */
@@ -4388,125 +4391,130 @@ class AdminProductsControllerCore extends AdminController
public function ajaxProcessaddProductImage()
{
self::$currentIndex = 'index.php?tab=AdminProducts';
$product = new Product((int)Tools::getValue('id_product'));
$legends = Tools::getValue('legend');
if (!is_array($legends)) {
$legends = (array)$legends;
}
if (!Validate::isLoadedObject($product)) {
$files = array();
$files[0]['error'] = Tools::displayError('Cannot add image because room type creation failed.');
}
$files = array();
$image_uploader = new HelperImageUploader('file');
$image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
$files = $image_uploader->process();
if ($this->tabAccess['edit'] === '0') {
$files[0]['name'] = $this->l('Error');
$files[0]['error'] = Tools::displayError('You do not have the right permission.');
} else {
self::$currentIndex = 'index.php?tab=AdminProducts';
$product = new Product((int)Tools::getValue('id_product'));
$legends = Tools::getValue('legend');
foreach ($files as &$file) {
$image = new Image();
$image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1;
foreach ($legends as $key => $legend) {
if (!empty($legend)) {
$image->legend[(int)$key] = $legend;
}
if (!is_array($legends)) {
$legends = (array)$legends;
}
if (!Image::getCover($image->id_product)) {
$image->cover = 1;
} else {
$image->cover = 0;
if (!Validate::isLoadedObject($product)) {
$files[0]['error'] = Tools::displayError('Cannot add image because room type creation failed.');
}
if (($validate = $image->validateFieldsLang(false, true)) !== true) {
$file['error'] = Tools::displayError($validate);
}
$image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
$files = $image_uploader->process();
if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
continue;
}
foreach ($files as &$file) {
$image = new Image();
$image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1;
if (!$image->add()) {
$file['error'] = Tools::displayError('Error while creating additional image');
} else {
if (!$new_path = $image->getPathForCreation()) {
$file['error'] = Tools::displayError('An error occurred during new folder creation');
continue;
}
$error = 0;
if (!ImageManager::resize($file['save_path'], $new_path.'.'.$image->image_format, null, null, 'jpg', false, $error)) {
switch ($error) {
case ImageManager::ERROR_FILE_NOT_EXIST :
$file['error'] = Tools::displayError('An error occurred while copying image, the file does not exist anymore.');
break;
case ImageManager::ERROR_FILE_WIDTH :
$file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
break;
case ImageManager::ERROR_MEMORY_LIMIT :
$file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
break;
default:
$file['error'] = Tools::displayError('An error occurred while copying image.');
break;
foreach ($legends as $key => $legend) {
if (!empty($legend)) {
$image->legend[(int)$key] = $legend;
}
continue;
}
if (!Image::getCover($image->id_product)) {
$image->cover = 1;
} else {
$imagesTypes = ImageType::getImagesTypes('products');
$generate_hight_dpi_images = (bool)Configuration::get('PS_HIGHT_DPI');
$image->cover = 0;
}
foreach ($imagesTypes as $imageType) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format)) {
$file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
continue;
if (($validate = $image->validateFieldsLang(false, true)) !== true) {
$file['error'] = Tools::displayError($validate);
}
if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
continue;
}
if (!$image->add()) {
$file['error'] = Tools::displayError('Error while creating additional image');
} else {
if (!$new_path = $image->getPathForCreation()) {
$file['error'] = Tools::displayError('An error occurred during new folder creation');
continue;
}
$error = 0;
if (!ImageManager::resize($file['save_path'], $new_path.'.'.$image->image_format, null, null, 'jpg', false, $error)) {
switch ($error) {
case ImageManager::ERROR_FILE_NOT_EXIST :
$file['error'] = Tools::displayError('An error occurred while copying image, the file does not exist anymore.');
break;
case ImageManager::ERROR_FILE_WIDTH :
$file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
break;
case ImageManager::ERROR_MEMORY_LIMIT :
$file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
break;
default:
$file['error'] = Tools::displayError('An error occurred while copying image.');
break;
}
continue;
} else {
$imagesTypes = ImageType::getImagesTypes('products');
$generate_hight_dpi_images = (bool)Configuration::get('PS_HIGHT_DPI');
if ($generate_hight_dpi_images) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'2x.'.$image->image_format, (int)$imageType['width']*2, (int)$imageType['height']*2, $image->image_format)) {
foreach ($imagesTypes as $imageType) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format)) {
$file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
continue;
}
if ($generate_hight_dpi_images) {
if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'2x.'.$image->image_format, (int)$imageType['width']*2, (int)$imageType['height']*2, $image->image_format)) {
$file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
continue;
}
}
}
}
unlink($file['save_path']);
//Necesary to prevent hacking
unset($file['save_path']);
Hook::exec('actionWatermark', array('id_image' => $image->id, 'id_product' => $product->id));
if (!$image->update()) {
$file['error'] = Tools::displayError('Error while updating status');
continue;
}
// Associate image to shop from context
$shops = Shop::getContextListShopID();
$image->associateTo($shops);
$json_shops = array();
foreach ($shops as $id_shop) {
$json_shops[$id_shop] = true;
}
$file['status'] = 'ok';
$file['id'] = $image->id;
$file['position'] = $image->position;
$file['cover'] = $image->cover;
$file['legend'] = $image->legend;
$file['path'] = $image->getExistingImgPath();
$file['shops'] = $json_shops;
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg');
}
unlink($file['save_path']);
//Necesary to prevent hacking
unset($file['save_path']);
Hook::exec('actionWatermark', array('id_image' => $image->id, 'id_product' => $product->id));
if (!$image->update()) {
$file['error'] = Tools::displayError('Error while updating status');
continue;
}
// Associate image to shop from context
$shops = Shop::getContextListShopID();
$image->associateTo($shops);
$json_shops = array();
foreach ($shops as $id_shop) {
$json_shops[$id_shop] = true;
}
$file['status'] = 'ok';
$file['id'] = $image->id;
$file['position'] = $image->position;
$file['cover'] = $image->cover;
$file['legend'] = $image->legend;
$file['path'] = $image->getExistingImgPath();
$file['shops'] = $json_shops;
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg');
}
}

View File

@@ -310,7 +310,7 @@ class AdminRequestSqlControllerCore extends AdminController
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new_request'] = array(
'href' => self::$currentIndex.'&addrequest_sql&token='.$this->token,
'desc' => $this->l('Add new SQL query', null, null, false),

View File

@@ -242,7 +242,7 @@ class AdminSearchConfControllerCore extends AdminController
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new_alias'] = array(
'href' => self::$currentIndex.'&addalias&token='.$this->token,
'desc' => $this->l('Add new alias', null, null, false),

View File

@@ -117,7 +117,7 @@ class AdminTaxesControllerCore extends AdminController
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new_tax'] = array(
'href' => self::$currentIndex.'&addtax&token='.$this->token,
'desc' => $this->l('Add new tax', null, null, false),

View File

@@ -435,7 +435,9 @@ class AuthControllerCore extends FrontController
}
if (!Tools::getValue('is_new_customer', 1)) {
if ($idCustomer = Customer::customerExists(Tools::getValue('email'), true, false)) {
if (Validate::isEmail($email = Tools::getValue('email'))
&& $idCustomer = Customer::customerExists(Tools::getValue('email'), true, false)
) {
$customer = new Customer($idCustomer);
}
}
@@ -574,7 +576,6 @@ class AuthControllerCore extends FrontController
}
}
}
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
$this->errors[] = Tools::displayError('Invalid date of birth');
}

View File

@@ -337,27 +337,19 @@ class ProductControllerCore extends FrontController
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
// set date to according to los
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
if (!($date_to = Tools::getValue('date_to'))) {
// set date to according to los
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
if ($preparationTime
&& strtotime(date('Y-m-d', strtotime('+'. ($preparationTime) .' days'))) > strtotime($date_from)
) {
$date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
if (strtotime($date_from) >= strtotime($date_to)) {
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
}
if (!($date_to = Tools::getValue('date_to'))) {
// set date to according to los
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
$hotel_branch_obj = new HotelBranchInformation($hotel_id);

View File

@@ -181,7 +181,7 @@ class InstallModelInstall extends InstallAbstractModel
if (!$all_languages) {
$iso_codes_to_install = array($this->language->getLanguageIso());
if ($iso_country) {
$version = str_replace('.', '', _PS_VERSION_);
$version = str_replace('.', '', _QLOAPPS_VERSION_);
$version = substr($version, 0, 2);
$localization_file_content = $this->getLocalizationPackContent($version, $iso_country);
@@ -403,7 +403,7 @@ class InstallModelInstall extends InstallAbstractModel
if (is_file($path_cache_file)) {
$localization_file_content = file_get_contents($path_cache_file);
} else {
$localization_file_content = @Tools::file_get_contents('http://api.prestashop.com/localization/'.$version.'/'.$country.'.xml');
$localization_file_content = @Tools::file_get_contents('http://api.qloapps.com/localization/'.$version.'/'.$country.'.xml');
if (!@simplexml_load_string($localization_file_content)) {
$localization_file_content = false;
}
@@ -544,7 +544,7 @@ class InstallModelInstall extends InstallAbstractModel
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'country SET active = 0 WHERE id_country != '.(int)$id_country);
// Set localization configuration
$version = str_replace('.', '', _PS_VERSION_);
$version = str_replace('.', '', _QLOAPPS_VERSION_);
$version = substr($version, 0, 2);
$localization_file_content = $this->getLocalizationPackContent($version, $data['shop_country']);

View File

@@ -687,7 +687,7 @@ function doAdminAjax(data, success_func, error_func)
return success_func(data);
data = $.parseJSON(data);
if (data.confirmations.length != 0)
if (data.confirmations && data.confirmations.length != 0)
showSuccessMessage(data.confirmations);
else
showErrorMessage(data.error);

View File

@@ -275,8 +275,8 @@ class HotelBranchInformation extends ObjectModel
public static function filterDataByHotelAccess(
$dataArray,
$idProfile,
$idAsIdHotel = 0,
$idAsIdProduct = 0,
$idHotelAlias = false,
$idProductAlias = false,
$addAccessKey = 0
) {
if ($hotelAccessInfo = Db::getInstance()->executeS(
@@ -299,20 +299,20 @@ class HotelBranchInformation extends ObjectModel
unset($dataArray[$key]);
}
}
} elseif ($idAsIdHotel && isset($row['id'])) {
} elseif ($idHotelAlias && isset($row[$idHotelAlias])) {
if ($addAccessKey) {
$dataArray[$key]['htl_access'] = 0;
if (in_array($row['id'], $hotels)) {
if (in_array($row[$idHotelAlias], $hotels)) {
$dataArray[$key]['htl_access'] = 1;
}
} else {
if (!in_array($row['id'], $hotels)) {
if (!in_array($row[$idHotelAlias], $hotels)) {
unset($dataArray[$key]);
}
}
} elseif ($idAsIdProduct && isset($row['id'])) {
} elseif ($idProductAlias && isset($row[$idProductAlias])) {
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($row['id'])) {
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($row[$idProductAlias])) {
if ($addAccessKey) {
$dataArray[$key]['htl_access'] = 0;
if (in_array($roomTypeInfo['id_hotel'], $hotels)) {

View File

@@ -2678,6 +2678,12 @@ class HotelHelper
$hotels = self::getHotelsByIdCity($previousElements, $rootNodeId);
$hotelIds = array_column($hotels, 'value');
if (Validate::isLoadedObject(Context::getContext()->employee)){
if (!Context::getContext()->employee->isSuperAdmin()) {
$hotels = HotelBranchInformation::filterDataByHotelAccess($hotels, Context::getContext()->employee->id_profile, 'value', false, true);
}
}
if ($leafNode > self::NODE_HOTEL) {
$roomTypes = self::generateRoomTypeNodes(false, $leafNode, $selectedElements, $hotelIds);
}
@@ -2687,6 +2693,10 @@ class HotelHelper
$hotel['selected'] = true;
}
if (isset($hotel['htl_access']) && !$hotel['htl_access']) {
$hotel['hidden'] = true;
}
if (isset($roomTypes[$hotel['value']])) {
$hotel['children'] = $roomTypes[$hotel['value']];
}
@@ -2710,6 +2720,18 @@ class HotelHelper
$roomTypes = self::getRoomTypesByHotelsId($previousElements, $rootNodeId);
$roomTypeIds = array_column($roomTypes, 'value');
if (Validate::isLoadedObject(Context::getContext()->employee)){
if (!Context::getContext()->employee->isSuperAdmin()) {
$roomTypes = HotelBranchInformation::filterDataByHotelAccess(
$roomTypes,
Context::getContext()->employee->id_profile,
false,
'value',
true
);
}
}
if ($leafNode > self::NODE_ROOM_TYPE) {
$rooms = self::generateRoomNodes(false, $leafNode, $selectedElements, $roomTypeIds);
}
@@ -2719,6 +2741,10 @@ class HotelHelper
$roomType['selected'] = true;
}
if (isset($roomType['htl_access']) && !$roomType['htl_access']) {
$roomType['hidden'] = true;
}
if (isset($rooms[$roomType['value']])) {
$roomType['children'] = $rooms[$roomType['value']];
}
@@ -2740,12 +2766,27 @@ class HotelHelper
{
$return = array();
$rooms = self::getRoomsByRoomTypeId($previousElements, $rootNodeId);
if (Validate::isLoadedObject(Context::getContext()->employee)){
if (!Context::getContext()->employee->isSuperAdmin()) {
$rooms = HotelBranchInformation::filterDataByHotelAccess(
$rooms,
Context::getContext()->employee->id_profile,
false,
false,
true
);
}
}
foreach ($rooms as $room) {
if (isset($selectedElements['room']) && in_array($room['value'], $selectedElements['room'])) {
$room['selected'] = true;
}
if (isset($room['htl_access']) && !$room['htl_access']) {
$room['hidden'] = true;
}
if ($previousElements) {
$return[$room['id_product']][] = $room;
} else {

View File

@@ -221,7 +221,8 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
cbd.`id_product` as `room_type_id_product`, cbd.`adults`, cbd.`children`, cbd.`date_from`, cbd.`date_to`';
if (!$getTotalPrice) {
$sql .= ', pl.`name`, cbd.`id_guest`, cbd.`id_customer`, p.`auto_add_to_cart`, p.`price_addition_type`,
p.`price_calculation_method`, cbd.`id_hotel`, cbd.`id_room`, cbd.`date_from`, cbd.`date_to`, cbd.`is_refunded`';
p.`price_calculation_method`, cbd.`id_hotel`, cbd.`id_room`, cbd.`date_from`, cbd.`date_to`,
cbd.`is_refunded`, p.`allow_multiple_quantity`';
}
$sql .= ' FROM `'._DB_PREFIX_.'htl_cart_booking_data` cbd
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd
@@ -296,11 +297,44 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
if ($idProduct) {
$selectedServiceProducts[$product['htl_cart_booking_id']]['quantity'] += $product['quantity'];
} else {
$servicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
$servicePriceTE = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
$product['date_from'],
$product['date_to'],
false,
false,
$id_address
);
$servicePriceTI = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
$product['date_from'],
$product['date_to'],
true,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array(
'id_product' => $product['id_product'],
'name' => $product['name'],
'quantity' => $product['quantity'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'allow_multiple_quantity' => $product['allow_multiple_quantity'],
'price_addition_type' => $product['price_addition_type'],
'price_calculation_method' => $product['price_calculation_method'],
'unit_price_tax_excl' => ($objRoomTypeServiceProductPrice->getServicePrice(
@@ -323,9 +357,28 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
false,
$id_address
) / $numdays),
'total_price' => $servicePrice,
'total_price_tax_excl' => $servicePriceTE,
'total_price_tax_incl' => $servicePriceTI
);
}
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] += Tools::processPriceRounding($servicePrice, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] += Tools::processPriceRounding($servicePriceTE, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] += Tools::processPriceRounding($servicePriceTI, $qty);
} else {
$selectedServiceProducts[$product['htl_cart_booking_id']]['htl_cart_booking_id'] = $product['htl_cart_booking_id'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_cart'] = $product['id_cart'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['room_type_id_product'] = $product['room_type_id_product'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_guest'] = $product['id_guest'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_customer'] = $product['id_customer'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_hotel'] = $product['id_hotel'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_room'] = $product['id_room'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['date_from'] = $product['date_from'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['date_to'] = $product['date_to'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['is_refunded'] = $product['is_refunded'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['adults'] = $product['adults'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['children'] = $product['children'];
$servicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
@@ -358,28 +411,12 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] += Tools::processPriceRounding($servicePrice, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] += Tools::processPriceRounding($servicePriceTE, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] += Tools::processPriceRounding($servicePriceTI, $qty);
} else {
$selectedServiceProducts[$product['htl_cart_booking_id']]['htl_cart_booking_id'] = $product['htl_cart_booking_id'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_cart'] = $product['id_cart'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['room_type_id_product'] = $product['room_type_id_product'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_guest'] = $product['id_guest'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_customer'] = $product['id_customer'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_hotel'] = $product['id_hotel'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_room'] = $product['id_room'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['date_from'] = $product['date_from'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['date_to'] = $product['date_to'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['is_refunded'] = $product['is_refunded'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['adults'] = $product['adults'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['children'] = $product['children'];
if ($idProduct) {
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_product'] = $product['id_product'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['name'] = $product['name'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['quantity'] = $product['quantity'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['auto_add_to_cart'] = $product['auto_add_to_cart'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['allow_multiple_quantity'] = $product['allow_multiple_quantity'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['price_addition_type'] = $product['price_addition_type'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['price_calculation_method'] = $product['price_calculation_method'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['unit_price_tax_excl'] = $objRoomTypeServiceProductPrice->getServicePrice(
@@ -402,12 +439,16 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
false,
$id_address
) / $numdays;
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] = $servicePrice;
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] = $servicePriceTE;
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] = $servicePriceTI;
} else {
$selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array(
'id_product' => $product['id_product'],
'name' => $product['name'],
'quantity' => $product['quantity'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'allow_multiple_quantity' => $product['allow_multiple_quantity'],
'price_addition_type' => $product['price_addition_type'],
'price_calculation_method' => $product['price_calculation_method'],
'unit_price_tax_excl' => ($objRoomTypeServiceProductPrice->getServicePrice(
@@ -430,41 +471,13 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
false,
$id_address
) / $numdays),
'total_price' => $servicePrice,
'total_price_tax_excl' => $servicePriceTE,
'total_price_tax_incl' => $servicePriceTI
);
}
$servicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
$servicePriceTE = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
$product['date_from'],
$product['date_to'],
false,
false,
$id_address
);
$servicePriceTI = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
$product['date_from'],
$product['date_to'],
true,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] = Tools::processPriceRounding($servicePrice, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] = Tools::processPriceRounding($servicePriceTE, $qty);

View File

@@ -95,7 +95,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$objHotelBranchInformation = new HotelBranchInformation();
$hotelBranchesInfo = $objHotelBranchInformation->hotelBranchesInfo(false, 1);
// filter hotels as per accessed hotels
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 1);
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 'id');
if ($hotelBranchesInfo) {
if (Tools::getValue('date_from')) {
@@ -130,7 +130,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$htl_info = HotelBranchInformation::filterDataByHotelAccess(
$htl_info,
$this->context->employee->id_profile,
1
'id'
);
$id_hotel = reset($htl_info)['id'];
} else {
@@ -286,7 +286,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$hotel_list = HotelBranchInformation::filterDataByHotelAccess(
$hotel_list,
$this->context->employee->id_profile,
1
'id'
);
$all_room_type = $obj_rm_type->getRoomTypeByHotelId($this->id_hotel, Configuration::get('PS_LANG_DEFAULT'), 1);
@@ -317,7 +317,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$objHotelBranchInformation = new HotelBranchInformation();
$hotelBranchesInfo = $objHotelBranchInformation->hotelBranchesInfo(false, 1);
// filter hotels as per accessed hotels
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 1);
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 'id');
if ($hotelBranchesInfo) {
$this->tpl_view_vars['id_cart'] = (int) $this->context->cart->id;

View File

@@ -496,7 +496,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
$cartrule->date_from = date('Y-m-d H:i:s', $now);
// generateDiscount
if ($voucher_expiry_date) {
$cartrule->date_to = date('Y-m-d H:i:s', strtotime($voucher_expiry_date));
$cartrule->date_to = date('Y-m-d', strtotime($voucher_expiry_date)).' 23:59:59';
} else {
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
}

View File

@@ -191,6 +191,10 @@ a.deleteHtlImage {
margin: 2px 20px;
}
#room-search-form .booking_occupancy_wrapper {
min-width: 250px;
}
.htl_room_data_cont > div.row > div + div > div.row{
border-left: 1px solid #C7D6DB;
}

View File

@@ -89,7 +89,7 @@ $(document).ready(function() {
dateFormat: 'dd-mm-yy',
altFormat: 'yy-mm-dd',
altField: '#voucher_expiry_date',
minDate: 0,
minDate: +1,
});
$(document).on('change', '#generateDiscount', function() {