[-] BO : AdminImport, fix Group searchByName
This commit is contained in:
+8
-19
@@ -325,25 +325,14 @@ 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, $unrestricted = false)
|
||||
public static function searchByName($id_lang, $query)
|
||||
{
|
||||
if ($unrestricted === true)
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT g.*, gl.*
|
||||
FROM `'._DB_PREFIX_.'group` g
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` gl
|
||||
ON (g.`id_group` = gl.`id_group`)
|
||||
WHERE `name` LIKE \''.pSQL($query).'\'
|
||||
');
|
||||
else
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT g.*, gl.*
|
||||
FROM `'._DB_PREFIX_.'group` g
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` gl
|
||||
ON (g.`id_group` = gl.`id_group`
|
||||
AND `id_lang` = '.(int)$id_lang.')
|
||||
WHERE `name` LIKE \'%'.pSQL($query).'%\'
|
||||
AND g.`id_group` != '.(int)Configuration::get('PS_HOME_CATEGORY')
|
||||
);
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT g.*, gl.*
|
||||
FROM `'._DB_PREFIX_.'group` g
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` gl
|
||||
ON (g.`id_group` = gl.`id_group`)
|
||||
WHERE `name` LIKE \''.pSQL($query).'\'
|
||||
');
|
||||
}
|
||||
}
|
||||
@@ -942,7 +942,7 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
elseif (isset($category->parent) && is_string($category->parent))
|
||||
{
|
||||
$category_parent = Category::searchByName($default_language_id, $category->parent, true);
|
||||
$category_parent = Category::searchByName($default_language_id, $category->parent);
|
||||
if ($category_parent['id_category'])
|
||||
{
|
||||
$category->id_parent = (int)$category_parent['id_category'];
|
||||
|
||||
Reference in New Issue
Block a user