diff --git a/admin/themes/default/img/loader.gif b/admin/themes/default/img/loader.gif
new file mode 100644
index 000000000..424c17c32
Binary files /dev/null and b/admin/themes/default/img/loader.gif differ
diff --git a/admin/themes/default/sass/partials/_chosen.sass b/admin/themes/default/sass/partials/_chosen.sass
index b56215a15..0e76a91d6 100644
--- a/admin/themes/default/sass/partials/_chosen.sass
+++ b/admin/themes/default/sass/partials/_chosen.sass
@@ -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%
diff --git a/admin/themes/default/sass/partials/_select2.scss b/admin/themes/default/sass/partials/_select2.scss
index 13013a28c..1a1bfeec4 100644
--- a/admin/themes/default/sass/partials/_select2.scss
+++ b/admin/themes/default/sass/partials/_select2.scss
@@ -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 {
diff --git a/admin/themes/default/sass/partials/_tinymce.sass b/admin/themes/default/sass/partials/_tinymce.sass
index de7e99302..7a5f7f448 100644
--- a/admin/themes/default/sass/partials/_tinymce.sass
+++ b/admin/themes/default/sass/partials/_tinymce.sass
@@ -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
diff --git a/admin/themes/default/template/controllers/login/header.tpl b/admin/themes/default/template/controllers/login/header.tpl
index d1d17ce21..161910564 100644
--- a/admin/themes/default/template/controllers/login/header.tpl
+++ b/admin/themes/default/template/controllers/login/header.tpl
@@ -54,14 +54,11 @@
{/if}
{/foreach}
{/if}
- {foreach from=$js_files item=js_uri}
-
- {/foreach}
-
-
{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}
+
+
diff --git a/admin/themes/default/template/controllers/normal_products/images.tpl b/admin/themes/default/template/controllers/normal_products/images.tpl
index 29e0f97e6..bae4675da 100644
--- a/admin/themes/default/template/controllers/normal_products/images.tpl
+++ b/admin/themes/default/template/controllers/normal_products/images.tpl
@@ -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);
}
}
diff --git a/admin/themes/default/template/controllers/products/images.tpl b/admin/themes/default/template/controllers/products/images.tpl
index 9648130ab..cc86ce61f 100644
--- a/admin/themes/default/template/controllers/products/images.tpl
+++ b/admin/themes/default/template/controllers/products/images.tpl
@@ -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);
}
}
diff --git a/admin/themes/default/template/helpers/tree/tree.tpl b/admin/themes/default/template/helpers/tree/tree.tpl
index 1eab06591..f9be10f4c 100644
--- a/admin/themes/default/template/helpers/tree/tree.tpl
+++ b/admin/themes/default/template/helpers/tree/tree.tpl
@@ -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}
\ No newline at end of file
diff --git a/admin/themes/default/template/helpers/tree/tree_node_folder.tpl b/admin/themes/default/template/helpers/tree/tree_node_folder.tpl
index 19191b8cc..ff0af7779 100644
--- a/admin/themes/default/template/helpers/tree/tree_node_folder.tpl
+++ b/admin/themes/default/template/helpers/tree/tree_node_folder.tpl
@@ -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
*}
-
+
diff --git a/admin/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl b/admin/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl
index 6358d19ea..7a7e159e6 100644
--- a/admin/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl
+++ b/admin/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl
@@ -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
*}
-
+
{if !isset($selectable) || $selectable}
-
+
{/if}
diff --git a/admin/themes/default/template/helpers/tree/tree_node_folder_radio.tpl b/admin/themes/default/template/helpers/tree/tree_node_folder_radio.tpl
index 0d14987f0..e5b4d8034 100644
--- a/admin/themes/default/template/helpers/tree/tree_node_folder_radio.tpl
+++ b/admin/themes/default/template/helpers/tree/tree_node_folder_radio.tpl
@@ -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
*}
-
+
{if !isset($selectable) || $selectable}
-
+
{/if}
diff --git a/admin/themes/default/template/helpers/tree/tree_node_item.tpl b/admin/themes/default/template/helpers/tree/tree_node_item.tpl
index b7553043a..a0f495e2f 100644
--- a/admin/themes/default/template/helpers/tree/tree_node_item.tpl
+++ b/admin/themes/default/template/helpers/tree/tree_node_item.tpl
@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
-
+
diff --git a/admin/themes/default/template/helpers/tree/tree_node_item_checkbox.tpl b/admin/themes/default/template/helpers/tree/tree_node_item_checkbox.tpl
index b0b7f42f5..fa52f7759 100644
--- a/admin/themes/default/template/helpers/tree/tree_node_item_checkbox.tpl
+++ b/admin/themes/default/template/helpers/tree/tree_node_item_checkbox.tpl
@@ -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
*}
-
+
-
+
diff --git a/admin/themes/default/template/helpers/tree/tree_node_item_radio.tpl b/admin/themes/default/template/helpers/tree/tree_node_item_radio.tpl
index 9053a3cea..f9a9f2215 100644
--- a/admin/themes/default/template/helpers/tree/tree_node_item_radio.tpl
+++ b/admin/themes/default/template/helpers/tree/tree_node_item_radio.tpl
@@ -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
*}
-
+
-
+
diff --git a/classes/CartRule.php b/classes/CartRule.php
index 17c6bd8ca..d8a340c6e 100644
--- a/classes/CartRule.php
+++ b/classes/CartRule.php
@@ -565,7 +565,7 @@ public function checkValidity(Context $context, $alreadyInCart = false, $display
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) {
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index 9b451be6f..f3cf93d01 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -1027,7 +1027,7 @@ public function processFilter()
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;
diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php
index 55219ea1e..03a38764d 100644
--- a/classes/helper/HelperList.php
+++ b/classes/helper/HelperList.php
@@ -726,7 +726,7 @@ public function displayListHeader()
}
// 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;
diff --git a/controllers/admin/AdminCartRulesController.php b/controllers/admin/AdminCartRulesController.php
index a09ffc12b..5a9614206 100644
--- a/controllers/admin/AdminCartRulesController.php
+++ b/controllers/admin/AdminCartRulesController.php
@@ -601,15 +601,15 @@ public function getProductRuleDisplay($product_rule_group_id, $product_rule_id,
$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);
diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php
index c736e1865..a6e770a54 100644
--- a/controllers/admin/AdminEmployeesController.php
+++ b/controllers/admin/AdminEmployeesController.php
@@ -177,7 +177,7 @@ public function initPageHeaderToolbar()
{
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),
diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php
index 914802c9d..fd13096c9 100644
--- a/controllers/admin/AdminImagesController.php
+++ b/controllers/admin/AdminImagesController.php
@@ -823,7 +823,7 @@ public function initMoveImages()
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),
diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php
index aaba53ffa..484f14282 100644
--- a/controllers/admin/AdminLocalizationController.php
+++ b/controllers/admin/AdminLocalizationController.php
@@ -170,7 +170,7 @@ public function postProcess()
}
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)) {
diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php
index 676bd7a64..49e2cd99c 100644
--- a/controllers/admin/AdminMetaController.php
+++ b/controllers/admin/AdminMetaController.php
@@ -229,7 +229,7 @@ public function __construct()
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),
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php
index c584a46b6..b3f3b4c1a 100644
--- a/controllers/admin/AdminNormalProductsController.php
+++ b/controllers/admin/AdminNormalProductsController.php
@@ -1393,7 +1393,7 @@ public function postProcess()
}
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 @@ public function ajaxProcessUpdateCover()
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 @@ protected function addCarriers($product = null)
public function ajaxProcessaddProductImage()
{
- self::$currentIndex = 'index.php?tab=AdminNormalProducts';
- $product = new Product((int)Tools::getValue('id_product'));
- $legends = Tools::getValue('legend');
+ $files = array();
+ $image_uploader = new HelperImageUploader('file');
+ 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');
- if (!is_array($legends)) {
- $legends = (array)$legends;
- }
+ 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.');
- }
+ if (!Validate::isLoadedObject($product)) {
+ $files[0]['error'] = Tools::displayError('Cannot add image because product creation failed.');
+ }
- $image_uploader = new HelperImageUploader('file');
- $image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
- $files = $image_uploader->process();
+ $image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
+ $files = $image_uploader->process();
- foreach ($files as &$file) {
- $image = new Image();
- $image->id_product = (int)($product->id);
- $image->position = Image::getHighestPosition($product->id) + 1;
+ 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;
+ foreach ($legends as $key => $legend) {
+ if (!empty($legend)) {
+ $image->legend[(int)$key] = $legend;
+ }
}
- }
-
- if (!Image::getCover($image->id_product)) {
- $image->cover = 1;
- } else {
- $image->cover = 0;
- }
- if (($validate = $image->validateFieldsLang(false, true)) !== true) {
- $file['error'] = Tools::displayError($validate);
- }
+ if (!Image::getCover($image->id_product)) {
+ $image->cover = 1;
+ } else {
+ $image->cover = 0;
+ }
- if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
- continue;
- }
+ if (($validate = $image->validateFieldsLang(false, true)) !== true) {
+ $file['error'] = Tools::displayError($validate);
+ }
- 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');
+ if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
continue;
}
- $error = 0;
+ 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;
+ }
- 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;
+ $error = 0;
- case ImageManager::ERROR_FILE_WIDTH :
- $file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
- break;
+ 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_MEMORY_LIMIT :
- $file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
- break;
+ case ImageManager::ERROR_FILE_WIDTH :
+ $file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
+ 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');
+ case ImageManager::ERROR_MEMORY_LIMIT :
+ $file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
+ break;
- 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;
+ 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));
+ 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;
- }
+ 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();
+ // 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;
- }
+ 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;
+ $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(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg');
+ @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg');
+ }
}
}
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index cf55c7d7f..5c17dead9 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -1488,7 +1488,7 @@ public function postProcess()
));
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 @@ public function ajaxProcessUpdateCover()
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 @@ public function initFormInformations($product)
public function ajaxProcessaddProductImage()
{
- self::$currentIndex = 'index.php?tab=AdminProducts';
- $product = new Product((int)Tools::getValue('id_product'));
- $legends = Tools::getValue('legend');
+ $files = array();
+ $image_uploader = new HelperImageUploader('file');
+ 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');
- if (!is_array($legends)) {
- $legends = (array)$legends;
- }
+ 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.');
- }
+ if (!Validate::isLoadedObject($product)) {
+ $files[0]['error'] = Tools::displayError('Cannot add image because room type creation failed.');
+ }
- $image_uploader = new HelperImageUploader('file');
- $image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
- $files = $image_uploader->process();
+ $image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
+ $files = $image_uploader->process();
- foreach ($files as &$file) {
- $image = new Image();
- $image->id_product = (int)($product->id);
- $image->position = Image::getHighestPosition($product->id) + 1;
+ 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;
+ foreach ($legends as $key => $legend) {
+ if (!empty($legend)) {
+ $image->legend[(int)$key] = $legend;
+ }
}
- }
-
- if (!Image::getCover($image->id_product)) {
- $image->cover = 1;
- } else {
- $image->cover = 0;
- }
- if (($validate = $image->validateFieldsLang(false, true)) !== true) {
- $file['error'] = Tools::displayError($validate);
- }
+ if (!Image::getCover($image->id_product)) {
+ $image->cover = 1;
+ } else {
+ $image->cover = 0;
+ }
- if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
- continue;
- }
+ if (($validate = $image->validateFieldsLang(false, true)) !== true) {
+ $file['error'] = Tools::displayError($validate);
+ }
- 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');
+ if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) {
continue;
}
- $error = 0;
+ 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;
+ }
- 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;
+ $error = 0;
- case ImageManager::ERROR_FILE_WIDTH :
- $file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
- break;
+ 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_MEMORY_LIMIT :
- $file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
- break;
+ case ImageManager::ERROR_FILE_WIDTH :
+ $file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.');
+ 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');
+ case ImageManager::ERROR_MEMORY_LIMIT :
+ $file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.');
+ break;
- 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;
+ 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));
+ 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;
- }
+ 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();
+ // 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;
- }
+ 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;
+ $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(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg');
+ @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg');
+ }
}
}
diff --git a/controllers/admin/AdminRequestSqlController.php b/controllers/admin/AdminRequestSqlController.php
index 068face35..e8c431aa1 100644
--- a/controllers/admin/AdminRequestSqlController.php
+++ b/controllers/admin/AdminRequestSqlController.php
@@ -310,7 +310,7 @@ public function initContent()
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),
diff --git a/controllers/admin/AdminSearchConfController.php b/controllers/admin/AdminSearchConfController.php
index 91efb9430..e07881d2c 100644
--- a/controllers/admin/AdminSearchConfController.php
+++ b/controllers/admin/AdminSearchConfController.php
@@ -242,7 +242,7 @@ public function __construct()
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),
diff --git a/controllers/admin/AdminTaxesController.php b/controllers/admin/AdminTaxesController.php
index 8a1640a19..65bf9275a 100644
--- a/controllers/admin/AdminTaxesController.php
+++ b/controllers/admin/AdminTaxesController.php
@@ -117,7 +117,7 @@ public function __construct()
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),
diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php
index 68ccb858d..a6e43a108 100644
--- a/controllers/front/AuthController.php
+++ b/controllers/front/AuthController.php
@@ -435,7 +435,9 @@ protected function processSubmitAccount()
}
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 @@ protected function processSubmitAccount()
}
}
}
-
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');
}
diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php
index e33644402..d9222203d 100644
--- a/controllers/front/ProductController.php
+++ b/controllers/front/ProductController.php
@@ -337,27 +337,19 @@ public function initContent()
$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);
diff --git a/install/models/install.php b/install/models/install.php
index 83a356c55..5acdb9312 100644
--- a/install/models/install.php
+++ b/install/models/install.php
@@ -181,7 +181,7 @@ public function installDefaultData($shop_name, $iso_country = false, $all_langua
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 @@ public function getLocalizationPackContent($version, $country)
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 @@ public function configureShop(array $data = array())
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']);
diff --git a/js/admin.js b/js/admin.js
index ca5044a06..4afd690dd 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -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);
diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
index e91aa93be..91176e98d 100644
--- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php
+++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
@@ -275,8 +275,8 @@ public function getHotelAccess($idHotel)
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 @@ public static function filterDataByHotelAccess(
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)) {
diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php
index b9fe7aea9..4680baed2 100644
--- a/modules/hotelreservationsystem/classes/HotelHelper.php
+++ b/modules/hotelreservationsystem/classes/HotelHelper.php
@@ -2685,6 +2685,12 @@ protected static function generateHotelNodes($rootNodeId, $leafNode, $selectedEl
$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);
}
@@ -2694,6 +2700,10 @@ protected static function generateHotelNodes($rootNodeId, $leafNode, $selectedEl
$hotel['selected'] = true;
}
+ if (isset($hotel['htl_access']) && !$hotel['htl_access']) {
+ $hotel['hidden'] = true;
+ }
+
if (isset($roomTypes[$hotel['value']])) {
$hotel['children'] = $roomTypes[$hotel['value']];
}
@@ -2717,6 +2727,18 @@ protected static function generateRoomTypeNodes($rootNodeId, $leafNode, $selecte
$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);
}
@@ -2726,6 +2748,10 @@ protected static function generateRoomTypeNodes($rootNodeId, $leafNode, $selecte
$roomType['selected'] = true;
}
+ if (isset($roomType['htl_access']) && !$roomType['htl_access']) {
+ $roomType['hidden'] = true;
+ }
+
if (isset($rooms[$roomType['value']])) {
$roomType['children'] = $rooms[$roomType['value']];
}
@@ -2747,12 +2773,27 @@ protected static function generateRoomNodes($rootNodeId, $leafNode, $selectedEle
{
$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 {
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
index cb4f1b7dc..fec2fed2c 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
@@ -221,7 +221,8 @@ public function getServiceProductsInCart(
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 @@ public function getServiceProductsInCart(
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 @@ public function getServiceProductsInCart(
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 @@ public function getServiceProductsInCart(
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 @@ public function getServiceProductsInCart(
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 @@ public function getServiceProductsInCart(
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);
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
index 921b59f3a..1d5ed19b8 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
@@ -95,7 +95,7 @@ public function postProcess()
$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 @@ public function postProcess()
$htl_info = HotelBranchInformation::filterDataByHotelAccess(
$htl_info,
$this->context->employee->id_profile,
- 1
+ 'id'
);
$id_hotel = reset($htl_info)['id'];
} else {
@@ -286,7 +286,7 @@ public function initSearchFormData()
$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 @@ public function renderView()
$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;
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
index d9664b18e..4c889b751 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
@@ -496,7 +496,7 @@ public function postProcess()
$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 */
}
diff --git a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css
index 91dd1825b..147403354 100644
--- a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css
+++ b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css
@@ -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;
}
diff --git a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js
index c6b039f7c..1976cd7cd 100644
--- a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js
+++ b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js
@@ -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() {