FIX When clearing filter, we must not save tmp criterias in session

This commit is contained in:
Laurent Destailleur 2018-04-08 12:40:19 +02:00
parent 8cca3dabd6
commit 560c84be0d

View File

@ -696,6 +696,7 @@ if (! defined('NOLOGIN'))
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
//var_dump($relativepathstring); //var_dump($relativepathstring);
// We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp
if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring]))
{ {
$_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring];
@ -1882,8 +1883,8 @@ if (! function_exists("llxFooter"))
// Clean data // Clean data
foreach($user->lastsearch_values_tmp as $key => $val) foreach($user->lastsearch_values_tmp as $key => $val)
{ {
unset($_SESSION['lastsearch_values_tmp_'.$key]); unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean arry to rebuild it just after
if (count($val)) if (count($val) && empty($_POST['button_removefilter'])) // If there is search criteria to save and we did not click on 'Clear filter' button
{ {
if (empty($val['sortfield'])) unset($val['sortfield']); if (empty($val['sortfield'])) unset($val['sortfield']);
if (empty($val['sortorder'])) unset($val['sortorder']); if (empty($val['sortorder'])) unset($val['sortorder']);