Merge branch 'develop' into gli-2609
This commit is contained in:
@@ -59,6 +59,13 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
protected $id_current_category;
|
||||
|
||||
protected $objLocationsCategory;
|
||||
|
||||
protected $servicesCategory;
|
||||
|
||||
protected $product_exists_in_shop;
|
||||
|
||||
protected $product_name;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -850,7 +857,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
protected function processBulkDelete()
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1') {
|
||||
if ($this->tabAccess['delete'] === 1) {
|
||||
if (is_array($this->boxes) && !empty($this->boxes)) {
|
||||
$object = new $this->className();
|
||||
|
||||
@@ -970,7 +977,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
// Change existing one
|
||||
if (($id_product_attribute = (int)Tools::getValue('id_product_attribute')) || ($id_product_attribute = $product->productAttributeExists(Tools::getValue('attribute_combination_list'), false, null, true, true))) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
if ($this->isProductFieldUpdated('available_date_attribute') && (Tools::getValue('available_date_attribute') != '' &&!Validate::isDateFormat(Tools::getValue('available_date_attribute')))) {
|
||||
$this->errors[] = Tools::displayError('Invalid date format.');
|
||||
} else {
|
||||
@@ -997,7 +1004,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
// Add new
|
||||
else {
|
||||
if ($this->tabAccess['add'] === '1') {
|
||||
if ($this->tabAccess['add'] === 1) {
|
||||
if ($product->productAttributeExists(Tools::getValue('attribute_combination_list'))) {
|
||||
$this->errors[] = Tools::displayError('This combination already exists.');
|
||||
} else {
|
||||
@@ -1254,7 +1261,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessDeleteSpecificPrice()
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1') {
|
||||
if ($this->tabAccess['delete'] === 1) {
|
||||
$id_specific_price = (int)Tools::getValue('id_specific_price');
|
||||
if (!$id_specific_price || !Validate::isUnsignedId($id_specific_price)) {
|
||||
$error = Tools::displayError('The specific price ID is invalid.');
|
||||
@@ -1367,7 +1374,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
// Product duplication
|
||||
elseif (Tools::getIsset('duplicate'.$this->table)) {
|
||||
if ($this->tabAccess['add'] === '1') {
|
||||
if ($this->tabAccess['add'] === 1) {
|
||||
$this->action = 'duplicate';
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add this.');
|
||||
@@ -1375,7 +1382,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
// Product images management
|
||||
elseif (Tools::getValue('id_image') && Tools::getValue('ajax')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$this->action = 'image';
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
@@ -1383,7 +1390,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
// Product attributes management
|
||||
elseif (Tools::isSubmit('submitProductAttribute')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$this->action = 'productAttribute';
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
@@ -1391,7 +1398,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
// Product features management
|
||||
// elseif (Tools::isSubmit('submitFeatures') || Tools::isSubmit('submitFeaturesAndStay')) {
|
||||
// if ($this->tabAccess['edit'] === '1') {
|
||||
// if ($this->tabAccess['edit'] === 1) {
|
||||
// $this->action = 'features';
|
||||
// } else {
|
||||
// $this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
@@ -1399,19 +1406,19 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
// }
|
||||
// Product specific prices management NEVER USED
|
||||
elseif (Tools::isSubmit('submitPricesModification')) {
|
||||
if ($this->tabAccess['add'] === '1') {
|
||||
if ($this->tabAccess['add'] === 1) {
|
||||
$this->action = 'pricesModification';
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add this.');
|
||||
}
|
||||
} elseif (Tools::isSubmit('deleteSpecificPrice')) {
|
||||
if ($this->tabAccess['delete'] === '1') {
|
||||
if ($this->tabAccess['delete'] === 1) {
|
||||
$this->action = 'deleteSpecificPrice';
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to delete this.');
|
||||
}
|
||||
} elseif (Tools::isSubmit('submitSpecificPricePriorities')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$this->action = 'specificPricePriorities';
|
||||
$this->tab_display = 'prices';
|
||||
} else {
|
||||
@@ -1420,7 +1427,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
// Customization management
|
||||
elseif (Tools::isSubmit('submitCustomizationConfiguration')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$this->action = 'customizationConfiguration';
|
||||
$this->tab_display = 'customization';
|
||||
$this->display = 'edit';
|
||||
@@ -1428,7 +1435,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
}
|
||||
} elseif (Tools::isSubmit('submitProductCustomization')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$this->action = 'productCustomization';
|
||||
$this->tab_display = 'customization';
|
||||
$this->display = 'edit';
|
||||
@@ -1481,7 +1488,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (in_array($this->display, array('add', 'edit'))
|
||||
&& $this->tabAccess['view'] == '1'
|
||||
&& $this->tabAccess['view'] === 1
|
||||
&& $this->loadObject(true)
|
||||
) {
|
||||
$this->addJqueryUI(array(
|
||||
@@ -1526,7 +1533,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->tabAccess['delete'] === '1') {
|
||||
if ($this->tabAccess['delete'] === 1) {
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
|
||||
@@ -1578,7 +1585,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessDefaultProductAttribute()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
if (!Combination::isFeatureActive()) {
|
||||
return;
|
||||
}
|
||||
@@ -1603,7 +1610,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessEditProductAttribute()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product((int)$id_product))) {
|
||||
@@ -2978,7 +2985,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
$allAssociations = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id);
|
||||
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product->selling_preference_type) {
|
||||
$associatedRoomTypes = $allAssociations['room_type'];
|
||||
$selectedRoomTypes = Tools::getValue('room_type_box');
|
||||
$selectedRoomTypes = Tools::getValue('room_type_box', array());
|
||||
|
||||
// Generate list of new associations
|
||||
$newRoomTypes = array();
|
||||
@@ -3019,7 +3026,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
);
|
||||
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product->selling_preference_type) {
|
||||
$associatedHotels = $allAssociations['hotel'];
|
||||
$selectedHotel = Tools::getValue('hotel_box');
|
||||
$selectedHotel = Tools::getValue('hotel_box', array());
|
||||
// Generate list of new associations
|
||||
$newHotels = array();
|
||||
foreach ($selectedHotel as $selectedRoomType) {
|
||||
@@ -3060,7 +3067,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product->selling_preference_type) {
|
||||
// Add room types linking
|
||||
$associatedRoomTypes = $allAssociations['room_type'];
|
||||
$selectedRoomTypes = Tools::getValue('room_type_box');
|
||||
$selectedRoomTypes = Tools::getValue('room_type_box', array());
|
||||
// Generate list of new associations
|
||||
$newRoomTypes = array();
|
||||
foreach ($selectedRoomTypes as $selectedRoomType) {
|
||||
@@ -3097,7 +3104,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
// Add hotels linking
|
||||
$associatedHotels = $allAssociations['hotel'];
|
||||
$selectedHotel = Tools::getValue('hotel_box');
|
||||
$selectedHotel = Tools::getValue('hotel_box', array());
|
||||
// Generate list of new associations
|
||||
$newHotels = array();
|
||||
foreach ($selectedHotel as $selectedRoomType) {
|
||||
@@ -3421,6 +3428,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
// Get all id_product_attribute
|
||||
$attributes = $obj->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes)) {
|
||||
$attributes = array();
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
@@ -3829,7 +3837,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
// prices
|
||||
array_push($product_props,
|
||||
'price', 'wholesale_price', 'id_tax_rules_group', 'unit_price_ratio', 'on_sale',
|
||||
'unity', 'minimum_quantity', 'additional_shipping_cost',
|
||||
'unity', 'minimal_quantity', 'additional_shipping_cost',
|
||||
'available_now', 'available_later', 'available_date'
|
||||
);
|
||||
|
||||
@@ -4481,7 +4489,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessCheckProductName()
|
||||
{
|
||||
if ($this->tabAccess['view'] === '1') {
|
||||
if ($this->tabAccess['view'] === 1) {
|
||||
$search = Tools::getValue('q');
|
||||
$id_lang = Tools::getValue('id_lang');
|
||||
$limit = Tools::getValue('limit');
|
||||
@@ -4504,7 +4512,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessUpdatePositions()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$way = (int)(Tools::getValue('way'));
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$id_category = (int)Tools::getValue('id_category');
|
||||
@@ -4544,7 +4552,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessPublishProduct()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
if ($id_product = (int)Tools::getValue('id_product')) {
|
||||
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminNormalProducts&id_product='.$id_product.'&updateproduct&token='.$this->token;
|
||||
|
||||
@@ -4598,7 +4606,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function displayPreviewLink($token = null, $id, $name = null)
|
||||
public function displayPreviewLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('helpers/list/list_action_preview.tpl');
|
||||
if (!array_key_exists('Bad SQL query', self::$cache_lang)) {
|
||||
@@ -4619,7 +4627,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
$response = array();
|
||||
$response['hasError'] = true;
|
||||
$response['error'] = $this->l('Some error occurred while deleting product option. Please try again.');
|
||||
if ($this->tabAccess['edit'] == 1) {
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$idProductOption = Tools::getValue('id_product_option');
|
||||
if (Validate::isLoadedObject($objProductOption = new ServiceProductOption((int)$idProductOption))) {
|
||||
if ($objProductOption->delete()) {
|
||||
|
||||
Reference in New Issue
Block a user