diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 34da3336bcc..66dd6338c9d 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -193,6 +193,7 @@ else
}
print "\n";
+print '';
print '
';
@@ -221,6 +222,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
+ if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
+ {
+ $page = 0;
+ $offset = 0;
+ }
}
$sql.= $db->plimit($limit+1, $offset);
@@ -236,11 +242,12 @@ if ($resql)
if($socid) $param .= '&socid='.urlencode($socid);
if($option) $param .= "&option=".urlencode($option);
- if(! empty($page) && $num <= $nbtotalofrecords) $page = 0;
-
print '