Merge pull request #8122 from frederic34/patch-6
display search result from page 0 even we are page 350
This commit is contained in:
commit
7ac9de6d0a
@ -253,17 +253,31 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
// if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
if (($page * $limit) > $nbtotalofrecords)
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if (! $resql)
|
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
$page = 0;
|
||||||
exit;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
|
// if total resultset is smaller the limit, no need to do paging.
|
||||||
|
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||||
|
{
|
||||||
|
$resql = $result;
|
||||||
|
$num = $nbtotalofrecords;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$resql=$db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
}
|
||||||
|
|
||||||
// Direct jump if only one record found
|
// Direct jump if only one record found
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user