Fix With pagination it is possible that the searched product does not appear if there are many open supplier orders

This commit is contained in:
Juanjo Menent 2019-10-24 10:58:29 +02:00
parent 9cd2406d50
commit 7e9d6dc153

View File

@ -2,6 +2,7 @@
/* /*
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -152,7 +153,9 @@ if (GETPOST('statut', 'int')) {
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut'; $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit+1, $offset); if (! $sproduct) {
$sql .= $db->plimit($limit+1, $offset);
}
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -268,7 +271,7 @@ if ($resql)
$userstatic = new User($db); $userstatic = new User($db);
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$sproduct?$num:$conf->liste_limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);