FIX When clearing filter, we must not save tmp criterias in session
This commit is contained in:
parent
8cca3dabd6
commit
560c84be0d
@ -682,32 +682,33 @@ if (! defined('NOLOGIN'))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('main'));
|
$hookmanager->initHooks(array('main'));
|
||||||
|
|
||||||
// Code for search criteria persistence.
|
// Code for search criteria persistence.
|
||||||
if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here
|
if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here
|
||||||
{
|
{
|
||||||
$relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]);
|
$relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]);
|
||||||
$relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server
|
$relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server
|
||||||
// Clean $relativepathstring
|
// Clean $relativepathstring
|
||||||
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
||||||
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||||
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||||
//var_dump($relativepathstring);
|
//var_dump($relativepathstring);
|
||||||
|
|
||||||
if (! empty($_SESSION['lastsearch_values_tmp_'.$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]))
|
||||||
$_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring];
|
{
|
||||||
unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
|
$_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring];
|
||||||
}
|
unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action);
|
$reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action);
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user