This commit is contained in:
Laurent Destailleur
2018-12-14 10:31:09 +01:00
parent e5b8b649aa
commit c1ce902f91
3 changed files with 33 additions and 11 deletions

View File

@@ -641,7 +641,6 @@ if ($num > 0)
$object->id = $line->id; $object->id = $line->id;
$object->piece_num = $line->piece_num; $object->piece_num = $line->piece_num;
print $object->getNomUrl(1,'',0,'',1); print $object->getNomUrl(1,'',0,'',1);
//print '<a href="./card.php?piece_num=' . $line->piece_num . '&save_lastsearch_values=1">' . $line->piece_num . '</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@@ -321,13 +321,18 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
} }
} }
} }
if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage // If there is saved contextpage, page or limit
{ if ($paramname == 'contextpage' && ! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring]))
if ($paramname == 'contextpage')
{ {
$out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
//var_dump($paramname.' '.$out);
} }
elseif ($paramname == 'page' && ! empty($_SESSION['lastsearch_page_'.$relativepathstring]))
{
$out = $_SESSION['lastsearch_page_'.$relativepathstring];
}
elseif ($paramname == 'limit' && ! empty($_SESSION['lastsearch_limit_'.$relativepathstring]))
{
$out = $_SESSION['lastsearch_limit_'.$relativepathstring];
} }
} }
// Else, retreive default values if we are not doing a sort // Else, retreive default values if we are not doing a sort

View File

@@ -732,18 +732,27 @@ 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 // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. 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];
unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
} }
// We also save contextpage
if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]))
{ {
$_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
} }
if (! empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1)
{
$_SESSION['lastsearch_page_'.$relativepathstring]=$_SESSION['lastsearch_page_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
}
if (! empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit)
{
$_SESSION['lastsearch_limit_'.$relativepathstring]=$_SESSION['lastsearch_limit_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
}
} }
$action = ''; $action = '';
@@ -1967,7 +1976,8 @@ if (! function_exists("llxFooter"))
function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0) function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0)
{ {
global $conf, $langs, $user, $object; global $conf, $langs, $user, $object;
global $delayedhtmlcontent, $contextpage; global $delayedhtmlcontent;
global $contextpage, $page, $limit;
$ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
@@ -2002,8 +2012,16 @@ if (! function_exists("llxFooter"))
if (preg_match('/list\.php$/', $relativepathstring)) if (preg_match('/list\.php$/', $relativepathstring))
{ {
unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage;
if (! empty($page) && $page > 1) $_SESSION['lastsearch_page_tmp_'.$relativepathstring]=$page;
if (! empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]=$limit;
unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
unset($_SESSION['lastsearch_page_'.$relativepathstring]);
unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
} }
// Core error message // Core error message