[-] BO: Fix #PSCFV-8683 order_way collusion on listing between 2 tabs

This commit is contained in:
Rémi Gaillard
2013-04-08 14:58:29 +02:00
parent f310ec5346
commit 419ed00e58
+11 -10
View File
@@ -443,7 +443,8 @@ class AdminControllerCore extends Controller
if (isset($_GET) && !empty($_GET) && isset($this->table)) if (isset($_GET) && !empty($_GET) && isset($this->table))
foreach ($_GET as $key => $value) foreach ($_GET as $key => $value)
if (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0) if (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
$this->context->cookie->$key = $value; $this->context->cookie->{$prefix.$key} = $value;
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_'); $filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
foreach ($filters as $key => $value) foreach ($filters as $key => $value)
{ {
@@ -885,11 +886,11 @@ class AdminControllerCore extends Controller
if (isset($this->context->cookie->{'submitFilter'.$this->table})) if (isset($this->context->cookie->{'submitFilter'.$this->table}))
unset($this->context->cookie->{'submitFilter'.$this->table}); unset($this->context->cookie->{'submitFilter'.$this->table});
if (isset($this->context->cookie->{$this->table.'Orderby'})) if (isset($this->context->cookie->{$prefix.$this->table.'Orderby'}))
unset($this->context->cookie->{$this->table.'Orderby'}); unset($this->context->cookie->{$prefix.$this->table.'Orderby'});
if (isset($this->context->cookie->{$this->table.'Orderway'})) if (isset($this->context->cookie->{$prefix.$this->table.'Orderway'}))
unset($this->context->cookie->{$this->table.'Orderway'}); unset($this->context->cookie->{$prefix.$this->table.'Orderway'});
unset($_POST); unset($_POST);
$this->_filter = false; $this->_filter = false;
@@ -2045,11 +2046,11 @@ class AdminControllerCore extends Controller
if (!Validate::isTableOrIdentifier($this->table)) if (!Validate::isTableOrIdentifier($this->table))
throw new PrestaShopException(sprintf('Table name %s is invalid:', $this->table)); throw new PrestaShopException(sprintf('Table name %s is invalid:', $this->table));
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
if (empty($order_by)) if (empty($order_by))
{ {
if ($this->context->cookie->{$this->table.'Orderby'}) if ($this->context->cookie->{$prefix.$this->table.'Orderby'})
$order_by = $this->context->cookie->{$this->table.'Orderby'}; $order_by = $this->context->cookie->{$prefix.$this->table.'Orderby'};
elseif ($this->_orderBy) elseif ($this->_orderBy)
$order_by = $this->_orderBy; $order_by = $this->_orderBy;
else else
@@ -2058,8 +2059,8 @@ class AdminControllerCore extends Controller
if (empty($order_way)) if (empty($order_way))
{ {
if ($this->context->cookie->{$this->table.'Orderway'}) if ($this->context->cookie->{$prefix.$this->table.'Orderway'})
$order_way = $this->context->cookie->{$this->table.'Orderway'}; $order_way = $this->context->cookie->{$prefix.$this->table.'Orderway'};
elseif ($this->_orderWay) elseif ($this->_orderWay)
$order_way = $this->_orderWay; $order_way = $this->_orderWay;
else else