Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: admin-dev/themes/default/template/controllers/customer_threads/message.tpl admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl admin-dev/themes/default/template/controllers/modules/favorites.tpl admin-dev/themes/default/template/controllers/modules/list.tpl admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl admin-dev/themes/default/template/controllers/orders/form.tpl admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl admin-dev/themes/default/template/controllers/products/associations.tpl admin-dev/themes/default/template/controllers/products/combinations.tpl admin-dev/themes/default/template/controllers/products/images.tpl admin-dev/themes/default/template/controllers/products/informations.tpl admin-dev/themes/default/template/controllers/products/prices.tpl admin-dev/themes/default/template/controllers/referrers/helpers/view/view.tpl admin-dev/themes/default/template/header.tpl admin-dev/themes/default/template/helpers/form/form.tpl admin-dev/themes/default/template/helpers/list/list_header.tpl classes/ProductSale.php classes/helper/HelperList.php controllers/admin/AdminCmsController.php controllers/admin/AdminCustomersController.php controllers/admin/AdminMetaController.php controllers/admin/AdminModulesController.php controllers/admin/AdminPerformanceController.php controllers/admin/AdminProductsController.php controllers/front/ParentOrderController.php install-dev/theme/views/welcome.phtml modules/blocknewproducts/blocknewproducts.php modules/blocktopmenu/blocktopmenu.php modules/importerosc/importerosc.php modules/mailalerts/mailalerts.php modules/shopimporter/shopimporter.php modules/statsstock/statsstock.php themes/default/css/product_list.css
This commit is contained in:
@@ -1500,7 +1500,7 @@ abstract class AdminTabCore
|
||||
case 'bool':
|
||||
echo '
|
||||
<select name="'.$this->table.'Filter_'.$key.'">
|
||||
<option value="">--</option>
|
||||
<option value="">-</option>
|
||||
<option value="1"'.($value == 1 ? ' selected="selected"' : '').'>'.$this->l('Yes').'</option>
|
||||
<option value="0"'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option>
|
||||
</select>';
|
||||
@@ -1524,7 +1524,7 @@ abstract class AdminTabCore
|
||||
if (isset($params['filter_key']))
|
||||
{
|
||||
echo '<select onchange="$(\'#submitFilter'.$this->table.'\').focus();$(\'#submitFilter'.$this->table.'\').click();" name="'.$this->table.'Filter_'.$params['filter_key'].'" '.(isset($params['width']) ? 'style="width: '.$params['width'].'px"' : '').'>
|
||||
<option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>--</option>';
|
||||
<option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>-</option>';
|
||||
if (isset($params['select']) && is_array($params['select']))
|
||||
foreach ($params['select'] as $optionValue => $optionDisplay)
|
||||
{
|
||||
|
||||
@@ -124,5 +124,21 @@ class AliasCore extends ObjectModel
|
||||
{
|
||||
return Configuration::get('PS_ALIAS_FEATURE_ACTIVE');
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is allow to know if a alias exist for AdminImportController
|
||||
* @since 1.5.6.0
|
||||
* @return bool
|
||||
*/
|
||||
public static function aliasExists($id_alias)
|
||||
{
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT `id_alias`
|
||||
FROM '._DB_PREFIX_.'alias a
|
||||
WHERE a.`id_alias` = '.(int)$id_alias
|
||||
);
|
||||
|
||||
return isset($row['id_alias']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -49,6 +49,8 @@ class Autoload
|
||||
*/
|
||||
public $index = array();
|
||||
|
||||
public $_include_override_path = true;
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$this->root_dir = _PS_ROOT_DIR_.'/';
|
||||
@@ -120,10 +122,16 @@ class Autoload
|
||||
{
|
||||
$classes = array_merge(
|
||||
$this->getClassesFromDir('classes/'),
|
||||
$this->getClassesFromDir('override/classes/'),
|
||||
$this->getClassesFromDir('controllers/'),
|
||||
$this->getClassesFromDir('override/controllers/')
|
||||
$this->getClassesFromDir('controllers/')
|
||||
);
|
||||
|
||||
if ($this->_include_override_path)
|
||||
$classes = array_merge(
|
||||
$classes,
|
||||
$this->getClassesFromDir('override/classes/'),
|
||||
$this->getClassesFromDir('override/controllers/')
|
||||
);
|
||||
|
||||
ksort($classes);
|
||||
$content = '<?php return '.var_export($classes, true).'; ?>';
|
||||
|
||||
@@ -189,4 +197,4 @@ class Autoload
|
||||
{
|
||||
return isset($this->index[$classname]) ? $this->index[$classname] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class CMSCore extends ObjectModel
|
||||
public $link_rewrite;
|
||||
public $id_cms_category;
|
||||
public $position;
|
||||
public $indexation;
|
||||
public $active;
|
||||
|
||||
/**
|
||||
@@ -46,6 +47,7 @@ class CMSCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'id_cms_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'position' => array('type' => self::TYPE_INT),
|
||||
'indexation' => array('type' => self::TYPE_BOOL),
|
||||
'active' => array('type' => self::TYPE_BOOL),
|
||||
|
||||
// Lang fields
|
||||
|
||||
+1
-1
@@ -3219,7 +3219,7 @@ class CartCore extends ObjectModel
|
||||
public function getWsCartRows()
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT id_product, id_product_attribute, quantity
|
||||
SELECT id_product, id_product_attribute, quantity, id_address_delivery
|
||||
FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id
|
||||
);
|
||||
|
||||
@@ -255,6 +255,16 @@ class CartRuleCore extends ObjectModel
|
||||
else
|
||||
$cart_rule['quantity_for_user'] = 0;
|
||||
|
||||
foreach ($result as $cart_rule)
|
||||
if ($cart_rule['shop_restriction'])
|
||||
{
|
||||
$cartRuleShops = Db::getInstance()->executeS('SELECT id_shop FROM '._DB_PREFIX_.'cart_rule_shop WHERE id_cart_rule = '.(int)$cart_rule['id_cart_rule']);
|
||||
foreach ($cartRuleShops as $cartRuleShop)
|
||||
if (Shop::isFeatureActive() && ($cartRuleShop['id_shop'] == Context::getContext()->shop->id))
|
||||
continue 2;
|
||||
unset($result[$key]);
|
||||
}
|
||||
|
||||
// Retrocompatibility with 1.4 discounts
|
||||
foreach ($result as &$cart_rule)
|
||||
{
|
||||
|
||||
+13
-4
@@ -73,7 +73,7 @@ class CurrencyCore extends ObjectModel
|
||||
'sign' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 8),
|
||||
'format' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'decimals' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
||||
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true, 'shop' => true),
|
||||
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat', 'required' => true, 'shop' => true),
|
||||
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
),
|
||||
@@ -107,14 +107,23 @@ class CurrencyCore extends ObjectModel
|
||||
$this->suffix = $this->format % 2 == 0 ? ' '.$this->sign : '';
|
||||
}
|
||||
/**
|
||||
* Overriding check if currency with the same iso code already exists.
|
||||
* If it's true, currency is doesn't added.
|
||||
* Overriding check if currency rate is not empty and if currency with the same iso code already exists.
|
||||
* If it's true, currency is not added.
|
||||
*
|
||||
* @see ObjectModelCore::add()
|
||||
*/
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
return Currency::exists($this->iso_code, $this->iso_code_num) ? false : parent::add();
|
||||
if ((float)$this->conversion_rate <= 0)
|
||||
return false;
|
||||
return Currency::exists($this->iso_code, $this->iso_code_num) ? false : parent::add($autodate, $nullValues);
|
||||
}
|
||||
|
||||
public function update($autodate = true, $nullValues = false)
|
||||
{
|
||||
if ((float)$this->conversion_rate <= 0)
|
||||
return false;
|
||||
return parent::update($autodate, $nullValues);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -589,9 +589,11 @@ class CustomerCore extends ObjectModel
|
||||
*/
|
||||
public function updateGroup($list)
|
||||
{
|
||||
$this->cleanGroups();
|
||||
if ($list && !empty($list))
|
||||
{
|
||||
$this->cleanGroups();
|
||||
$this->addGroups($list);
|
||||
}
|
||||
else
|
||||
$this->addGroups(array($this->id_default_group));
|
||||
}
|
||||
@@ -606,7 +608,7 @@ class CustomerCore extends ObjectModel
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
$row = array('id_customer' => (int)$this->id, 'id_group' => (int)$group);
|
||||
Db::getInstance()->insert('customer_group', $row);
|
||||
Db::getInstance()->insert('customer_group', $row, false, true, Db::INSERT_IGNORE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class CustomerMessageCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_customer_thread' => array('type' => self::TYPE_INT),
|
||||
'ip_address' => array('type' => self::TYPE_INT, 'validate' => 'isIp2Long'),
|
||||
'ip_address' => array('type' => self::TYPE_STRING, 'validate' => 'isIp2Long', 'size' => 15),
|
||||
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000),
|
||||
'file_name' => array('type' => self::TYPE_STRING),
|
||||
'user_agent' => array('type' => self::TYPE_STRING),
|
||||
|
||||
@@ -369,7 +369,7 @@ class DispatcherCore
|
||||
|
||||
// If there are several languages, get language from uri
|
||||
if ($this->use_routes && Language::isMultiLanguageActivated())
|
||||
if (preg_match('#^/([a-z]{2})/?#', $this->request_uri, $m))
|
||||
if (preg_match('#^/([a-z]{2})(?:/.*)?$#', $this->request_uri, $m))
|
||||
{
|
||||
$_GET['isolang'] = $m[1];
|
||||
$this->request_uri = substr($this->request_uri, 3);
|
||||
|
||||
+31
-10
@@ -312,16 +312,37 @@ class FeatureCore extends ObjectModel
|
||||
*/
|
||||
public static function cleanPositions()
|
||||
{
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'feature` f
|
||||
LEFT JOIN (
|
||||
SELECT @i := @i +1 AS rank, id_feature, position
|
||||
FROM `'._DB_PREFIX_.'feature`
|
||||
JOIN (SELECT @i :=1) dummy
|
||||
ORDER by position
|
||||
) AS f2
|
||||
USING (id_feature)
|
||||
SET f.position = f2.rank - 1');
|
||||
//Reordering positions to remove "holes" in them (after delete for instance)
|
||||
$sql = "SELECT id_feature, position FROM "._DB_PREFIX_."feature ORDER BY id_feature";
|
||||
$db = Db::getInstance();
|
||||
$r = $db->executeS($sql, false);
|
||||
$shiftTable = array(); //List of update queries (one query is necessary for each "hole" in the table)
|
||||
$currentDelta = 0;
|
||||
$minId = 0;
|
||||
$maxId = 0;
|
||||
$futurePosition = 1;
|
||||
while ($line = $db->nextRow($r)) {
|
||||
$delta = $futurePosition - $line['position']; //Difference between current position and future position
|
||||
if ($delta != $currentDelta) {
|
||||
$shiftTable[] = array('minId' => $minId, 'maxId' => $maxId, 'delta' => $currentDelta);
|
||||
$currentDelta = $delta;
|
||||
$minId = $line['id_feature'];
|
||||
}
|
||||
$maxId = $line['id_feature'];
|
||||
$futurePosition++;
|
||||
}
|
||||
$shiftTable[] = array('minId' => $minId, 'maxId' => $maxId, 'delta' => $currentDelta);
|
||||
|
||||
//Executing generated queries
|
||||
foreach ($shiftTable as $line) {
|
||||
$delta = $line['delta'];
|
||||
if ($delta == 0) continue;
|
||||
$delta = $delta > 0 ? '+' . (int)$delta : (int)$delta;
|
||||
$minId = (int)$line['minId'];
|
||||
$maxId = (int)$line['maxId'];
|
||||
$sql = "UPDATE "._DB_PREFIX_."feature SET position = position $delta WHERE id_feature >= $minId AND id_feature <= $maxId";
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,30 +128,36 @@ class FeatureValueCore extends ObjectModel
|
||||
return $tab['value'];
|
||||
}
|
||||
|
||||
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null)
|
||||
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null, $custom = false)
|
||||
{
|
||||
$id_feature_value = false;
|
||||
if (!is_null($id_product) && $id_product)
|
||||
{
|
||||
$id_feature_value = Db::getInstance()->getValue('
|
||||
SELECT `id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_product
|
||||
WHERE `id_feature` = '.(int)$id_feature.'
|
||||
AND `id_product` = '.(int)$id_product);
|
||||
SELECT fp.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_product fp
|
||||
INNER JOIN '._DB_PREFIX_.'feature_value fv USING (`id_feature_value`)
|
||||
WHERE fp.`id_feature` = '.(int)$id_feature.'
|
||||
AND fv.`custom` = '.(int)$custom.'
|
||||
AND fp.`id_product` = '.(int)$id_product);
|
||||
|
||||
if ($id_feature_value && !is_null($id_lang) && $id_lang)
|
||||
if ($custom && $id_feature_value && !is_null($id_lang) && $id_lang)
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'feature_value_lang
|
||||
SET `value` = \''.pSQL($value).'\'
|
||||
WHERE `id_feature_value` = '.(int)$id_feature_value.'
|
||||
AND `value` != \''.pSQL($value).'\'
|
||||
AND `id_lang` = '.(int)$id_lang);
|
||||
}
|
||||
else
|
||||
|
||||
if (!$custom)
|
||||
$id_feature_value = Db::getInstance()->getValue('
|
||||
SELECT fv.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value` AND fvl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE `value` = \''.pSQL($value).'\'
|
||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||
AND fv.`custom` = 0
|
||||
GROUP BY fv.`id_feature_value`');
|
||||
|
||||
if ($id_feature_value)
|
||||
@@ -160,7 +166,7 @@ class FeatureValueCore extends ObjectModel
|
||||
// Feature doesn't exist, create it
|
||||
$feature_value = new FeatureValue();
|
||||
$feature_value->id_feature = (int)$id_feature;
|
||||
$feature_value->custom = 0;
|
||||
$feature_value->custom = (bool)$custom;
|
||||
foreach (Language::getLanguages() as $language)
|
||||
$feature_value->value[$language['id_lang']] = $value;
|
||||
$feature_value->add();
|
||||
|
||||
@@ -102,6 +102,11 @@ class QqUploadedFileForm
|
||||
$image = new Image();
|
||||
$image->id_product = (int)$product->id;
|
||||
$image->position = Image::getHighestPosition($product->id) + 1;
|
||||
$legends = Tools::getValue('legend');
|
||||
if (is_array($legends))
|
||||
foreach ($legends as $key => $legend)
|
||||
if (!empty($legend))
|
||||
$image->legend[(int)$key] = $legend;
|
||||
if (!Image::getCover($image->id_product))
|
||||
$image->cover = 1;
|
||||
else
|
||||
@@ -136,7 +141,7 @@ class QqUploadedFileForm
|
||||
|
||||
if (!$image->update())
|
||||
return array('error' => Tools::displayError('Error while updating status'));
|
||||
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName());
|
||||
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName(), 'legend' => $image->legend);
|
||||
return array('success' => $img);
|
||||
}
|
||||
|
||||
@@ -184,6 +189,11 @@ class QqUploadedFileXhr
|
||||
$image = new Image();
|
||||
$image->id_product = (int)($product->id);
|
||||
$image->position = Image::getHighestPosition($product->id) + 1;
|
||||
$legends = Tools::getValue('legend');
|
||||
if (is_array($legends))
|
||||
foreach ($legends as $key => $legend)
|
||||
if (!empty($legend))
|
||||
$image->legend[(int)$key] = $legend;
|
||||
if (!Image::getCover($image->id_product))
|
||||
$image->cover = 1;
|
||||
else
|
||||
@@ -223,7 +233,7 @@ class QqUploadedFileXhr
|
||||
|
||||
if (!$image->update())
|
||||
return array('error' => Tools::displayError('Error while updating status'));
|
||||
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName());
|
||||
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName(), 'legend' => $image->legend);
|
||||
return array('success' => $img);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -325,7 +325,7 @@ class GroupCore extends ObjectModel
|
||||
* @param boolean $unrestricted allows search without lang and includes first group and exact match
|
||||
* @return array Corresponding groupes
|
||||
*/
|
||||
public static function searchByName($id_lang, $query)
|
||||
public static function searchByName($query)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT g.*, gl.*
|
||||
|
||||
+10
-1
@@ -56,6 +56,8 @@ class HookCore extends ObjectModel
|
||||
*/
|
||||
public static $executed_hooks = array();
|
||||
|
||||
public static $native_module;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -416,12 +418,19 @@ class HookCore extends ObjectModel
|
||||
// Look on modules list
|
||||
$altern = 0;
|
||||
$output = '';
|
||||
|
||||
|
||||
if (!isset(Hook::$native_module))
|
||||
Hook::$native_module = Module::getNativeModuleList();
|
||||
|
||||
foreach ($module_list as $array)
|
||||
{
|
||||
// Check errors
|
||||
if ($id_module && $id_module != $array['id_module'])
|
||||
continue;
|
||||
|
||||
if ((bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE') && !in_array($array['module'], self::$native_module))
|
||||
continue;
|
||||
|
||||
if (!($moduleInstance = Module::getInstanceByName($array['module'])))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ class ImageCore extends ObjectModel
|
||||
/** @var boolean Image is cover */
|
||||
public $cover;
|
||||
|
||||
/** @var string Legend */
|
||||
public $legend;
|
||||
|
||||
/** @var string image extension */
|
||||
public $image_format = 'jpg';
|
||||
|
||||
@@ -66,6 +69,7 @@ class ImageCore extends ObjectModel
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true),
|
||||
'legend' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -127,16 +127,20 @@ class ImageTypeCore extends ObjectModel
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
*/
|
||||
public static function getByNameNType($name, $type = null)
|
||||
public static function getByNameNType($name, $type = null, $order = null)
|
||||
{
|
||||
if (!isset(self::$images_types_name_cache[$name.'_'.$type]))
|
||||
if (!isset(self::$images_types_name_cache[$name.'_'.$type.'_'.$order]))
|
||||
{
|
||||
self::$images_types_name_cache[$name.'_'.$type] = Db::getInstance()->getRow('
|
||||
self::$images_types_name_cache[$name.'_'.$type.'_'.$order] = Db::getInstance()->getRow('
|
||||
SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`
|
||||
FROM `'._DB_PREFIX_.'image_type`
|
||||
WHERE `name` = \''.pSQL($name).'\' '.(!is_null($type) ? 'AND `'.pSQL($type).'` = 1' : ''));
|
||||
WHERE
|
||||
`name` LIKE \''.pSQL($name).'\''
|
||||
.(!is_null($type) ? ' AND `'.pSQL($type).'` = 1' : '')
|
||||
.(!is_null($order) ? ' ORDER BY `'.bqSQL($order).'` ASC' : '')
|
||||
);
|
||||
}
|
||||
return self::$images_types_name_cache[$name.'_'.$type];
|
||||
return self::$images_types_name_cache[$name.'_'.$type.'_'.$order];
|
||||
}
|
||||
|
||||
public static function getFormatedName($name)
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class LoggerCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'error_code' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true),
|
||||
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'object_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
|
||||
|
||||
+2
-2
@@ -85,11 +85,11 @@ class MetaCore extends ObjectModel
|
||||
// Add modules controllers to list (this function is cool !)
|
||||
foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file)
|
||||
{
|
||||
$filename = basename($file, '.php');
|
||||
$filename = Tools::strtolower(basename($file, '.php'));
|
||||
if ($filename == 'index')
|
||||
continue;
|
||||
|
||||
$module = basename(dirname(dirname(dirname($file))));
|
||||
$module = Tools::strtolower(basename(dirname(dirname(dirname($file)))));
|
||||
$selected_pages[$module.' - '.$filename] = 'module-'.$module.'-'.$filename;
|
||||
}
|
||||
|
||||
|
||||
@@ -1139,7 +1139,7 @@ abstract class ObjectModelCore
|
||||
{
|
||||
$vars = get_class_vars($class_name);
|
||||
foreach ($vars['shopIDs'] as $id_shop)
|
||||
$or[] = ' main.id_shop = '.(int)$id_shop.' ';
|
||||
$or[] = '(main.id_shop = '.(int)$id_shop.(isset($this->def['fields']['id_shop_group']) ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').')';
|
||||
|
||||
$prepend = '';
|
||||
if (count($or))
|
||||
@@ -1658,4 +1658,4 @@ abstract class ObjectModelCore
|
||||
{
|
||||
$this->update_fields = $fields;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,6 +545,13 @@ abstract class PaymentModuleCore extends Module
|
||||
if ($order_status->logable)
|
||||
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
|
||||
|
||||
// Set the order state
|
||||
$new_history = new OrderHistory();
|
||||
$new_history->id_order = (int)$order->id;
|
||||
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
|
||||
$new_history->addWithemail(true, $extra_vars);
|
||||
|
||||
// Switch to back order if needed
|
||||
if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState())
|
||||
{
|
||||
$history = new OrderHistory();
|
||||
@@ -553,13 +560,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$history->addWithemail();
|
||||
}
|
||||
|
||||
// Set order state in order history ONLY even if the "out of stock" status has not been yet reached
|
||||
// So you migth have two order states
|
||||
$new_history = new OrderHistory();
|
||||
$new_history->id_order = (int)$order->id;
|
||||
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
|
||||
$new_history->addWithemail(true, $extra_vars);
|
||||
|
||||
unset($order_detail);
|
||||
|
||||
// Order is reloaded because the status just changed
|
||||
|
||||
@@ -3623,6 +3623,7 @@ class ProductCore extends ObjectModel
|
||||
if ($result3)
|
||||
{
|
||||
$result3['id_feature_value'] = $new_id_feature_value;
|
||||
$result3['value'] = pSQL($result3['value']);
|
||||
$return &= Db::getInstance()->insert('feature_value_lang', $result3);
|
||||
}
|
||||
}
|
||||
|
||||
+33
-21
@@ -74,11 +74,22 @@ class ProductSaleCore
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
|
||||
|
||||
//Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage
|
||||
$sql = 'SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups;
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$ids = array();
|
||||
foreach ($products as $product)
|
||||
$ids[$product['id_product']] = 1;
|
||||
$ids = array_keys($ids);
|
||||
sort($ids);
|
||||
$ids = count($ids) > 0 ? implode(',', $ids) : 'NULL';
|
||||
|
||||
$prefix = '';
|
||||
//Main query
|
||||
if ($order_by == 'date_add')
|
||||
$prefix = 'p.';
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
@@ -103,13 +114,8 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND product_shop.`visibility` != \'none\'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND p.`visibility` != \'none\'
|
||||
AND p.`id_product` IN ('.$ids.')
|
||||
GROUP BY product_shop.id_product
|
||||
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
@@ -141,16 +147,27 @@ class ProductSaleCore
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
//Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage
|
||||
$sql = 'SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.' AND cp.`id_product` IS NOT NULL';
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$ids = array();
|
||||
foreach ($products as $product)
|
||||
$ids[$product['id_product']] = 1;
|
||||
$ids = array_keys($ids);
|
||||
sort($ids);
|
||||
$ids = count($ids) > 0 ? implode(',', $ids) : 'NULL';
|
||||
|
||||
//Main query
|
||||
$sql = 'SELECT p.id_product, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`,
|
||||
ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, IFNULL(stock.quantity, 0) as quantity, p.customizable,
|
||||
IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, stock.out_of_stock
|
||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
||||
ON (p.`id_product` = pa.`id_product`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').'
|
||||
'.Product::sqlStock('p', 'product_attribute_shop', false, $context->shop).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (ps.`id_product` = pa.`id_product` AND pa.default_on = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
@@ -161,13 +178,8 @@ class ProductSaleCore
|
||||
ON cl.`id_category` = product_shop.`id_category_default`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND product_shop.`visibility` != \'none\'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND p.`visibility` != \'none\'
|
||||
AND p.`id_product` IN ('.$ids.')
|
||||
GROUP BY product_shop.id_product
|
||||
ORDER BY sales DESC
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
|
||||
+24
-13
@@ -94,7 +94,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (parent::add($autodate, $nullValues))
|
||||
{
|
||||
// Flush cache when we adding a new specific price
|
||||
self::$_specificPriceCache = array();
|
||||
SpecificPrice::$_specificPriceCache = array();
|
||||
Product::flushPriceCache();
|
||||
// Set cache of feature detachable to true
|
||||
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1');
|
||||
@@ -108,7 +108,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (parent::update($null_values))
|
||||
{
|
||||
// Flush cache when we updating a new specific price
|
||||
self::$_specificPriceCache = array();
|
||||
SpecificPrice::$_specificPriceCache = array();
|
||||
Product::flushPriceCache();
|
||||
return true;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (parent::delete())
|
||||
{
|
||||
// Flush cache when we deletind a new specific price
|
||||
self::$_specificPriceCache = array();
|
||||
SpecificPrice::$_specificPriceCache = array();
|
||||
Product::flushPriceCache();
|
||||
// Refresh cache of feature detachable
|
||||
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
|
||||
@@ -180,9 +180,9 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (!SpecificPrice::isFeatureActive())
|
||||
return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'));
|
||||
|
||||
if (!isset(self::$_cache_priorities[(int)$id_product]))
|
||||
if (!isset(SpecificPrice::$_cache_priorities[(int)$id_product]))
|
||||
{
|
||||
self::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SpecificPrice::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `priority`, `id_specific_price_priority`
|
||||
FROM `'._DB_PREFIX_.'specific_price_priority`
|
||||
WHERE `id_product` = '.(int)$id_product.'
|
||||
@@ -190,7 +190,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
');
|
||||
}
|
||||
|
||||
$priority = self::$_cache_priorities[(int)$id_product];
|
||||
$priority = SpecificPrice::$_cache_priorities[(int)$id_product];
|
||||
|
||||
if (!$priority)
|
||||
$priority = Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES');
|
||||
@@ -209,11 +209,11 @@ class SpecificPriceCore extends ObjectModel
|
||||
*/
|
||||
|
||||
$key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$id_customer.'-'.(int)$real_quantity);
|
||||
if (!array_key_exists($key, self::$_specificPriceCache))
|
||||
if (!array_key_exists($key, SpecificPrice::$_specificPriceCache))
|
||||
{
|
||||
$now = date('Y-m-d H:i:s');
|
||||
self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
|
||||
$query = '
|
||||
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
WHERE `id_product` IN (0, '.(int)$id_product.')
|
||||
AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.')
|
||||
@@ -228,11 +228,22 @@ class SpecificPriceCore extends ObjectModel
|
||||
AND
|
||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
|
||||
)
|
||||
AND id_cart IN (0, '.(int)$id_cart.')'.
|
||||
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.max(1, (int)$real_quantity)).'
|
||||
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC');
|
||||
AND id_cart IN (0, '.(int)$id_cart.') ';
|
||||
|
||||
if ($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION'))
|
||||
$query .= ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')';
|
||||
else
|
||||
{
|
||||
$qty_to_use = $id_cart ? (int)$quantity : (int)$real_quantity;
|
||||
$query .= 'AND `from_quantity` <= '.max(1, $qty_to_use);
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC';
|
||||
|
||||
SpecificPrice::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
|
||||
|
||||
}
|
||||
return self::$_specificPriceCache[$key];
|
||||
return SpecificPrice::$_specificPriceCache[$key];
|
||||
}
|
||||
|
||||
public static function setPriorities($priorities)
|
||||
|
||||
+91
-54
@@ -357,13 +357,11 @@ class ToolsCore
|
||||
if (Validate::isLanguageIsoCode($string))
|
||||
{
|
||||
$lang = new Language(Language::getIdByIso($string));
|
||||
if (Validate::isLoadedObject($lang) && $lang->active)
|
||||
{
|
||||
$language = new Language((int)$lang->id);
|
||||
if (Validate::isLoadedObject($language))
|
||||
Context::getContext()->language = $language;
|
||||
if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop())
|
||||
{
|
||||
Context::getContext()->language = $lang;
|
||||
$cookie->id_lang = (int)$lang->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,14 +672,20 @@ class ToolsCore
|
||||
public static function htmlentitiesUTF8($string, $type = ENT_QUOTES)
|
||||
{
|
||||
if (is_array($string))
|
||||
return array_map(array('Tools', 'htmlentitiesUTF8'), $string);
|
||||
{
|
||||
$string = array_map(array('Tools', 'htmlentitiesUTF8'), $string);
|
||||
return (string)array_shift($string);
|
||||
}
|
||||
return htmlentities((string)$string, $type, 'utf-8');
|
||||
}
|
||||
|
||||
public static function htmlentitiesDecodeUTF8($string)
|
||||
{
|
||||
if (is_array($string))
|
||||
return array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string);
|
||||
{
|
||||
$string = array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string);
|
||||
return (string)array_shift($string);
|
||||
}
|
||||
return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8');
|
||||
}
|
||||
|
||||
@@ -1107,63 +1111,94 @@ class ToolsCore
|
||||
/* One source among others:
|
||||
http://www.tachyonsoft.com/uc0000.htm
|
||||
http://www.tachyonsoft.com/uc0001.htm
|
||||
http://www.tachyonsoft.com/uc0004.htm
|
||||
*/
|
||||
$patterns = array(
|
||||
|
||||
/* Lowercase */
|
||||
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}]/u',
|
||||
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}]/u',
|
||||
/* d */ '/[\x{010F}\x{0111}]/u',
|
||||
/* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}]/u',
|
||||
/* g */ '/[\x{011F}\x{0121}\x{0123}]/u',
|
||||
/* h */ '/[\x{0125}\x{0127}]/u',
|
||||
/* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}]/u',
|
||||
/* j */ '/[\x{0135}]/u',
|
||||
/* k */ '/[\x{0137}\x{0138}]/u',
|
||||
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}]/u',
|
||||
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}]/u',
|
||||
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}]/u',
|
||||
/* r */ '/[\x{0155}\x{0157}\x{0159}]/u',
|
||||
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}]/u',
|
||||
/* ss*/ '/[\x{00DF}]/u',
|
||||
/* t */ '/[\x{0163}\x{0165}\x{0167}]/u',
|
||||
/* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}]/u',
|
||||
/* w */ '/[\x{0175}]/u',
|
||||
/* y */ '/[\x{00FF}\x{0177}\x{00FD}]/u',
|
||||
/* z */ '/[\x{017A}\x{017C}\x{017E}]/u',
|
||||
/* ae*/ '/[\x{00E6}]/u',
|
||||
/* oe*/ '/[\x{0153}]/u',
|
||||
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}\x{0430}]/u',
|
||||
/* b */ '/[\x{0431}]/u',
|
||||
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}\x{0446}]/u',
|
||||
/* d */ '/[\x{010F}\x{0111}\x{0434}]/u',
|
||||
/* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}\x{0435}\x{044D}]/u',
|
||||
/* f */ '/[\x{0444}]/u',
|
||||
/* g */ '/[\x{011F}\x{0121}\x{0123}\x{0433}\x{0491}]/u',
|
||||
/* h */ '/[\x{0125}\x{0127}]/u',
|
||||
/* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}\x{0438}\x{0456}]/u',
|
||||
/* j */ '/[\x{0135}\x{0439}]/u',
|
||||
/* k */ '/[\x{0137}\x{0138}\x{043A}]/u',
|
||||
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}\x{043B}]/u',
|
||||
/* m */ '/[\x{043C}]/u',
|
||||
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}\x{043D}]/u',
|
||||
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}\x{043E}]/u',
|
||||
/* p */ '/[\x{043F}]/u',
|
||||
/* r */ '/[\x{0155}\x{0157}\x{0159}\x{0440}]/u',
|
||||
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}\x{0441}]/u',
|
||||
/* ss */ '/[\x{00DF}]/u',
|
||||
/* t */ '/[\x{0163}\x{0165}\x{0167}\x{0442}]/u',
|
||||
/* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}\x{0443}]/u',
|
||||
/* v */ '/[\x{0432}]/u',
|
||||
/* w */ '/[\x{0175}]/u',
|
||||
/* y */ '/[\x{00FF}\x{0177}\x{00FD}\x{044B}]/u',
|
||||
/* z */ '/[\x{017A}\x{017C}\x{017E}\x{0437}]/u',
|
||||
/* ae */ '/[\x{00E6}]/u',
|
||||
/* ch */ '/[\x{0447}]/u',
|
||||
/* kh */ '/[\x{0445}]/u',
|
||||
/* oe */ '/[\x{0153}]/u',
|
||||
/* sh */ '/[\x{0448}]/u',
|
||||
/* shh*/ '/[\x{0449}]/u',
|
||||
/* ya */ '/[\x{044F}]/u',
|
||||
/* ye */ '/[\x{0454}]/u',
|
||||
/* yi */ '/[\x{0457}]/u',
|
||||
/* yo */ '/[\x{0451}]/u',
|
||||
/* yu */ '/[\x{044E}]/u',
|
||||
/* zh */ '/[\x{0436}]/u',
|
||||
|
||||
/* Uppercase */
|
||||
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u',
|
||||
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}]/u',
|
||||
/* D */ '/[\x{010E}\x{0110}]/u',
|
||||
/* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}]/u',
|
||||
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}]/u',
|
||||
/* H */ '/[\x{0124}\x{0126}]/u',
|
||||
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}]/u',
|
||||
/* J */ '/[\x{0134}]/u',
|
||||
/* K */ '/[\x{0136}]/u',
|
||||
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}]/u',
|
||||
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}]/u',
|
||||
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}]/u',
|
||||
/* R */ '/[\x{0154}\x{0156}\x{0158}]/u',
|
||||
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}]/u',
|
||||
/* T */ '/[\x{0162}\x{0164}\x{0166}]/u',
|
||||
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}]/u',
|
||||
/* W */ '/[\x{0174}]/u',
|
||||
/* Y */ '/[\x{0176}]/u',
|
||||
/* Z */ '/[\x{0179}\x{017B}\x{017D}]/u',
|
||||
/* AE*/ '/[\x{00C6}]/u',
|
||||
/* OE*/ '/[\x{0152}]/u');
|
||||
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}\x{0410}]/u',
|
||||
/* B */ '/[\x{0411}]]/u',
|
||||
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}\x{0426}]/u',
|
||||
/* D */ '/[\x{010E}\x{0110}\x{0414}]/u',
|
||||
/* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}\x{0415}\x{042D}]/u',
|
||||
/* F */ '/[\x{0424}]/u',
|
||||
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}\x{0413}\x{0490}]/u',
|
||||
/* H */ '/[\x{0124}\x{0126}]/u',
|
||||
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}\x{0418}\x{0406}]/u',
|
||||
/* J */ '/[\x{0134}\x{0419}]/u',
|
||||
/* K */ '/[\x{0136}\x{041A}]/u',
|
||||
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}\x{041B}]/u',
|
||||
/* M */ '/[\x{041C}]/u',
|
||||
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}\x{041D}]/u',
|
||||
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}\x{041E}]/u',
|
||||
/* P */ '/[\x{041F}]/u',
|
||||
/* R */ '/[\x{0154}\x{0156}\x{0158}\x{0420}]/u',
|
||||
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}\x{0421}]/u',
|
||||
/* T */ '/[\x{0162}\x{0164}\x{0166}\x{0422}]/u',
|
||||
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}\x{0423}]/u',
|
||||
/* V */ '/[\x{0412}]/u',
|
||||
/* W */ '/[\x{0174}]/u',
|
||||
/* Y */ '/[\x{0176}\x{042B}]/u',
|
||||
/* Z */ '/[\x{0179}\x{017B}\x{017D}\x{0417}]/u',
|
||||
/* AE */ '/[\x{00C6}]/u',
|
||||
/* CH */ '/[\x{0427}]/u',
|
||||
/* KH */ '/[\x{0425}]/u',
|
||||
/* OE */ '/[\x{0152}]/u',
|
||||
/* SH */ '/[\x{0428}]/u',
|
||||
/* SHH*/ '/[\x{0429}]/u',
|
||||
/* YA */ '/[\x{042F}]/u',
|
||||
/* YE */ '/[\x{0404}]/u',
|
||||
/* YI */ '/[\x{0407}]/u',
|
||||
/* YO */ '/[\x{0401}]/u',
|
||||
/* YU */ '/[\x{042E}]/u',
|
||||
/* ZH */ '/[\x{0416}]/u');
|
||||
|
||||
// ö to oe
|
||||
// å to aa
|
||||
// ä to ae
|
||||
|
||||
$replacements = array(
|
||||
'a', 'c', 'd', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'w', 'z', 'ae', 'oe',
|
||||
'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 'ss', 't', 'u', 'v', 'w', 'y', 'z', 'ae', 'ch', 'kh', 'oe', 'sh', 'shh', 'ya', 'ye', 'yi', 'yo', 'yu', 'zh',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'Y', 'Z', 'AE', 'CH', 'KH', 'OE', 'SH', 'SHH', 'YA', 'YE', 'YI', 'YO', 'YU', 'ZH'
|
||||
);
|
||||
|
||||
return preg_replace($patterns, $replacements, $str);
|
||||
@@ -1697,13 +1732,15 @@ class ToolsCore
|
||||
fwrite($write_fd, "AddType application/x-font-woff .woff\n");
|
||||
|
||||
if ($disable_modsec)
|
||||
fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n");
|
||||
fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n\n");
|
||||
|
||||
// RewriteEngine
|
||||
fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
|
||||
|
||||
// Ensure HTTP_MOD_REWRITE variable is set in environment
|
||||
fwrite($write_fd, "<IfModule mod_env.c>\n");
|
||||
fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n");
|
||||
fwrite($write_fd, "</IfModule>\n\n");
|
||||
|
||||
// Disable multiviews ?
|
||||
if ($disable_multiviews)
|
||||
|
||||
@@ -2120,7 +2120,10 @@ class AdminControllerCore extends Controller
|
||||
$this->context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
elseif ($this->context->shop->id != $shop_id)
|
||||
$this->context->shop = new Shop($shop_id);
|
||||
|
||||
|
||||
// Replace current default country
|
||||
$this->context->country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
|
||||
$this->initBreadcrumbs();
|
||||
}
|
||||
|
||||
@@ -2379,8 +2382,10 @@ class AdminControllerCore extends Controller
|
||||
if (preg_match('/[.!]/', $order_by))
|
||||
{
|
||||
$order_by_split = preg_split('/[.!]/', $order_by);
|
||||
$order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`';
|
||||
$order_by = bqSQL($order_by_split[0]).'.`'.bqSQL($order_by_split[1]).'`';
|
||||
}
|
||||
elseif ($order_by)
|
||||
$order_by = '`'.bqSQL($order_by).'`';
|
||||
|
||||
$this->_orderWay = Tools::strtoupper($order_way);
|
||||
|
||||
@@ -2474,7 +2479,7 @@ class AdminControllerCore extends Controller
|
||||
(isset($this->_filter) ? $this->_filter : '').$where_shop.'
|
||||
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
||||
'.$having_clause.'
|
||||
ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way).
|
||||
ORDER BY '.((str_replace('`', '', $order_by) == $this->identifier) ? 'a.' : '').$order_by.' '.pSQL($order_way).
|
||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').
|
||||
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||
|
||||
@@ -2526,22 +2531,20 @@ class AdminControllerCore extends Controller
|
||||
public function getLanguages()
|
||||
{
|
||||
$cookie = $this->context->cookie;
|
||||
$this->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->allow_employee_form_lang = (int)Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG');
|
||||
if ($this->allow_employee_form_lang && !$cookie->employee_form_lang)
|
||||
$cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$use_lang_from_cookie = false;
|
||||
$cookie->employee_form_lang = (int)$this->context->language->id;
|
||||
|
||||
$lang_exists = false;
|
||||
$this->_languages = Language::getLanguages(false);
|
||||
if ($this->allow_employee_form_lang)
|
||||
foreach ($this->_languages as $lang)
|
||||
if ($cookie->employee_form_lang == $lang['id_lang'])
|
||||
$use_lang_from_cookie = true;
|
||||
if (!$use_lang_from_cookie)
|
||||
$this->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
else
|
||||
$this->default_form_language = (int)$cookie->employee_form_lang;
|
||||
foreach ($this->_languages as $lang)
|
||||
if (isset($cookie->employee_form_lang) && $cookie->employee_form_lang == $lang['id_lang'])
|
||||
$lang_exists = true;
|
||||
|
||||
$this->default_form_language = $lang_exists ? (int)$cookie->employee_form_lang : (int)$this->context->language->id;
|
||||
|
||||
foreach ($this->_languages as $k => $language)
|
||||
$this->_languages[$k]['is_default'] = (int)($language['id_lang'] == $this->default_form_language);
|
||||
$this->_languages[$k]['is_default'] = ((int)($language['id_lang'] == $this->default_form_language));
|
||||
|
||||
return $this->_languages;
|
||||
}
|
||||
@@ -3269,4 +3272,4 @@ class AdminControllerCore extends Controller
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,20 +214,18 @@ class HelperCore
|
||||
|
||||
$html = '
|
||||
<script type="text/javascript">
|
||||
var inputName = "'.$input_name.'";
|
||||
';
|
||||
var inputName = \''.addcslashes($input_name, '\'').'\';'."\n";
|
||||
if (count($selected_cat) > 0)
|
||||
{
|
||||
if (isset($selected_cat[0]))
|
||||
$html .= 'var selectedCat = "'.implode(',', $selected_cat).'";';
|
||||
$html .= ' var selectedCat = '.(int)implode(',', $selected_cat).';'."\n";
|
||||
else
|
||||
$html .= 'var selectedCat = "'.implode(',', array_keys($selected_cat)).'";';
|
||||
$html .= ' var selectedCat = '.(int)implode(',', array_keys($selected_cat)).';'."\n";
|
||||
}
|
||||
else
|
||||
$html .= 'var selectedCat = "";';
|
||||
$html .= '
|
||||
var selectedLabel = \''.$translations['selected'].'\';
|
||||
var home = \''.$root['name'].'\';
|
||||
$html .= ' var selectedCat = \'\';'."\n";
|
||||
$html .= ' var selectedLabel = \''.$translations['selected'].'\';
|
||||
var home = \''.addcslashes($root['name'], '\'').'\';
|
||||
var use_radio = '.(int)$use_radio.';';
|
||||
if (!$use_in_popup)
|
||||
$html .= '
|
||||
|
||||
@@ -455,13 +455,13 @@ class HelperListCore extends Helper
|
||||
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
|
||||
|
||||
if (!array_key_exists('DeleteItem', self::$cache_lang))
|
||||
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', false, false);
|
||||
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', true, false);
|
||||
|
||||
if (!array_key_exists('Name', self::$cache_lang))
|
||||
self::$cache_lang['Name'] = $this->l('Name:', 'Helper', false, false);
|
||||
self::$cache_lang['Name'] = $this->l('Name:', 'Helper', true, false);
|
||||
|
||||
if (!is_null($name))
|
||||
$name = '\n\n'.self::$cache_lang['Name'].' '.$name;
|
||||
$name = addcslashes('\n\n'.self::$cache_lang['Name'].' '.$name, '\'');
|
||||
|
||||
$data = array(
|
||||
$this->identifier => $id,
|
||||
@@ -470,7 +470,8 @@ class HelperListCore extends Helper
|
||||
);
|
||||
|
||||
if ($this->specificConfirmDelete !== false)
|
||||
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\''));
|
||||
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(self::$cache_lang['DeleteItem'].$name);
|
||||
|
||||
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
|
||||
|
||||
return $tpl->fetch();
|
||||
@@ -523,7 +524,7 @@ class HelperListCore extends Helper
|
||||
if (Tools::getIsset($this->table.'Orderby'))
|
||||
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
|
||||
|
||||
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table;
|
||||
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->table;
|
||||
|
||||
/* Determine current page number */
|
||||
$page = (int)Tools::getValue('submitFilter'.$this->list_id);
|
||||
|
||||
@@ -1247,11 +1247,7 @@ abstract class ModuleCore
|
||||
$module->interest = 0;
|
||||
}
|
||||
|
||||
usort($module_list, create_function('$a,$b', '
|
||||
if ($a->displayName == $b->displayName)
|
||||
return 0;
|
||||
return ($a->displayName < $b->displayName) ? -1 : 1;
|
||||
'));
|
||||
usort($module_list, create_function('$a,$b', 'return strnatcasecmp($a->displayName, $b->displayName);'));
|
||||
|
||||
if ($errors)
|
||||
{
|
||||
@@ -1310,6 +1306,23 @@ abstract class ModuleCore
|
||||
return $db->executeS('SELECT * FROM `'._DB_PREFIX_.'module` m WHERE `name` NOT IN ('.implode(',', $arr_native_modules).') ');
|
||||
}
|
||||
|
||||
public static function getNativeModuleList()
|
||||
{
|
||||
$module_list_xml = _PS_ROOT_DIR_.self::CACHE_FILE_MODULES_LIST;
|
||||
$native_modules = simplexml_load_file($module_list_xml);
|
||||
$native_modules = $native_modules->modules;
|
||||
$modules = array();
|
||||
|
||||
foreach ($native_modules as $native_modules_type)
|
||||
if (in_array($native_modules_type['type'], array('native', 'partner')))
|
||||
{
|
||||
foreach ($native_modules_type->module as $module)
|
||||
$modules[] = $module['name'];
|
||||
}
|
||||
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return installed modules
|
||||
*
|
||||
@@ -1593,6 +1606,18 @@ abstract class ModuleCore
|
||||
return Cache::retrieve('Module::isInstalled'.$module_name);
|
||||
}
|
||||
|
||||
public function isEnabledForShopContext()
|
||||
{
|
||||
$shop_list = Shop::getContextListShopID();
|
||||
return (bool)Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) n
|
||||
FROM `'._DB_PREFIX_.'module_shop`
|
||||
WHERE id_module='.(int)$this->id.' AND id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).')
|
||||
GROUP BY id_module
|
||||
HAVING n='.(int)count(Shop::getContextListShopID())
|
||||
);
|
||||
}
|
||||
|
||||
public static function isEnabled($module_name)
|
||||
{
|
||||
if (!Cache::isStored('Module::isEnabled'.$module_name))
|
||||
@@ -1771,6 +1796,7 @@ abstract class ModuleCore
|
||||
@unlink($file);
|
||||
@file_put_contents($file, $xml);
|
||||
}
|
||||
@chmod($file, 0664);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ class OrderReturnCore extends ObjectModel
|
||||
$data[$k]['type'] = 'Return';
|
||||
$data[$k]['tracking_number'] = $or['id_order_return'];
|
||||
$data[$k]['can_edit'] = false;
|
||||
$data[$k]['reference'] = Order::getUniqReferenceOf($or['id_order']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ class ShopCore extends ObjectModel
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$list = ($share) ? Shop::getSharedShops(Shop::getContextShopID(), $share) : array(Shop::getContextShopID());
|
||||
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
elseif (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$list = Shop::getShops(true, Shop::getContextShopGroupID(), true);
|
||||
else
|
||||
$list = Shop::getShops(true, null, true);
|
||||
|
||||
@@ -236,7 +236,10 @@ class StockMvtCore extends ObjectModel
|
||||
$query->innerJoin('stock', 's', 's.id_stock = sm.id_stock');
|
||||
$query->innerJoin('warehouse', 'w', 'w.id_warehouse = s.id_warehouse');
|
||||
$query->where('sm.sign = 1');
|
||||
$query->where('s.id_product = '.(int)$id_product.' OR s.id_product_attribute = '.(int)$id_product_attribute);
|
||||
if ($id_product_attribute)
|
||||
$query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute);
|
||||
else
|
||||
$query->where('s.id_product = '.(int)$id_product);
|
||||
$query->orderBy('date_add DESC');
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
Reference in New Issue
Block a user