// Fix #PSCFV-4512

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17751 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-10-04 13:05:43 +00:00
parent f90f8011b8
commit 55a1ad4b5e
3 changed files with 120 additions and 56 deletions
+28 -28
View File
@@ -417,6 +417,33 @@ class AdminControllerCore extends Controller
*/
public function processFilter()
{
// Filter memorization
if (isset($_POST) && !empty($_POST) && isset($this->table))
foreach ($_POST as $key => $value)
{
if (is_array($this->table))
{
foreach ($this->table as $table)
if (stripos($key, $table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
}
elseif (stripos($key, $this->table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
}
if (isset($_GET) && !empty($_GET) && isset($this->table))
foreach ($_GET as $key => $value)
{
if (is_array($this->table))
{
foreach ($this->table as $table)
if (stripos($key, $table.'OrderBy') === 0 || stripos($key, $table.'Orderway') === 0)
$this->context->cookie->$key = $value;
}
elseif (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
$this->context->cookie->$key = $value;
}
$filters = $this->context->cookie->getFamily($this->table.'Filter_');
foreach ($filters as $key => $value)
@@ -808,7 +835,6 @@ class AdminControllerCore extends Controller
public function processResetFilters()
{
$filters = $this->context->cookie->getFamily($this->table.'Filter_');
foreach ($filters as $cookie_key => $filter)
if (strncmp($cookie_key, $this->table.'Filter_', 7 + Tools::strlen($this->table)) == 0)
{
@@ -817,7 +843,7 @@ class AdminControllerCore extends Controller
$tmp_tab = explode('!', $key);
$key = (count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0]);
if (array_key_exists($key, $this->fields_list))
if (is_array($this->fields_list) && array_key_exists($key, $this->fields_list))
unset($this->context->cookie->$cookie_key);
}
@@ -1763,32 +1789,6 @@ class AdminControllerCore extends Controller
*/
public function initProcess()
{
// Filter memorization
if (isset($_POST) && !empty($_POST) && isset($this->table))
foreach ($_POST as $key => $value)
{
if (is_array($this->table))
{
foreach ($this->table as $table)
if (stripos($key, $table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
}
elseif (stripos($key, $this->table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
}
if (isset($_GET) && !empty($_GET) && isset($this->table))
foreach ($_GET as $key => $value)
{
if (is_array($this->table))
{
foreach ($this->table as $table)
if (stripos($key, $table.'OrderBy') === 0 || stripos($key, $table.'Orderway') === 0)
$this->context->cookie->$key = $value;
}
elseif (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
$this->context->cookie->$key = $value;
}
// Manage list filtering
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
$this->filter = true;
+7 -7
View File
@@ -161,7 +161,7 @@ class HelperListCore extends Helper
* @param int $id_product
* @return string
*/
protected function displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null)
public function displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null)
{
$tpl_enable = $this->createTemplate('list_action_enable.tpl');
$tpl_enable->assign(array(
@@ -332,7 +332,7 @@ class HelperListCore extends Helper
/**
* Display duplicate action link
*/
protected function displayDuplicateLink($token = null, $id, $name = null)
public function displayDuplicateLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_duplicate.tpl');
if (!array_key_exists('Bad SQL query', self::$cache_lang))
@@ -374,7 +374,7 @@ class HelperListCore extends Helper
* fields_display: // attribute $fields_list of the admin controller
* }
*/
protected function displayDetailsLink($token = null, $id, $name = null)
public function displayDetailsLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_details.tpl');
if (!array_key_exists('Details', self::$cache_lang))
@@ -398,7 +398,7 @@ class HelperListCore extends Helper
/**
* Display view action link
*/
protected function displayViewLink($token = null, $id, $name = null)
public function displayViewLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_view.tpl');
if (!array_key_exists('View', self::$cache_lang))
@@ -416,7 +416,7 @@ class HelperListCore extends Helper
/**
* Display edit action link
*/
protected function displayEditLink($token = null, $id, $name = null)
public function displayEditLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_edit.tpl');
if (!array_key_exists('Edit', self::$cache_lang))
@@ -434,7 +434,7 @@ class HelperListCore extends Helper
/**
* Display delete action link
*/
protected function displayDeleteLink($token = null, $id, $name = null)
public function displayDeleteLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_delete.tpl');
@@ -467,7 +467,7 @@ class HelperListCore extends Helper
/**
* Display delete action link
*/
protected function displayDefaultLink($token = null, $id, $name = null)
public function displayDefaultLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_default.tpl');
if (!array_key_exists('Default', self::$cache_lang))