diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 5c2360624a4..0100c98bc91 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -66,6 +66,8 @@ if ($user->socid > 0) { } restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); +$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); + /* * Actions @@ -129,14 +131,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { if ($resql) { $total = 0; $num = $db->num_rows($resql); - $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); + $nbofloop = min($num, $maxofloop); startSimpleTable("ProposalsDraft", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num); if ($num > 0) { $i = 0; $othernb = 0; - while ($i < $num && $i < $conf->liste_limit) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); if ($i >= $max) { @@ -181,7 +183,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { if ($othernb) { print ''; print ''; - print ''.$langs->trans("More").'... ('.$othernb.')'; + print ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; print ''; print "\n"; } @@ -226,14 +228,14 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa if ($resql) { $total = 0; $num = $db->num_rows($resql); - $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); + $nbofloop = min($num, $maxofloop); startSimpleTable("SupplierProposalsDraft", "supplier_proposal/list.php", "search_status=".SupplierProposal::STATUS_DRAFT, 2, $num); if ($num > 0) { $i = 0; $othernb = 0; - while ($i < $num && $i < $conf->liste_limit) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); if ($i >= $max) { @@ -277,7 +279,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa if ($othernb) { print ''; print ''; - print ''.$langs->trans("More").'... ('.$othernb.')'; + print ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; print ''; print "\n"; } @@ -315,21 +317,21 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $resql = $db->query($sql); if ($resql) { $total = 0; $num = $db->num_rows($resql); - $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); + $nbofloop = min($num, $maxofloop); startSimpleTable("DraftOrders", "commande/list.php", "search_status=".Commande::STATUS_DRAFT, 2, $num); if ($num > 0) { $i = 0; $othernb = 0; - while ($i < $num && $i < $conf->liste_limit) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); if ($i >= $max) { @@ -374,7 +376,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if ($othernb) { print ''; print ''; - print ''.$langs->trans("More").'... ('.$othernb.')'; + print ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; print ''; print "\n"; } @@ -419,14 +421,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU if ($resql) { $total = 0; $num = $db->num_rows($resql); - $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); + $nbofloop = min($num, $maxofloop); startSimpleTable("DraftSuppliersOrders", "fourn/commande/list.php", "search_status=".CommandeFournisseur::STATUS_DRAFT, 2, $num); if ($num > 0) { $i = 0; $othernb = 0; - while ($i < $num && $i < $conf->liste_limit) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); if ($i >= $max) { @@ -471,7 +473,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU if ($othernb) { print ''; print ''; - print ''.$langs->trans("More").'... ('.$othernb.')'; + print ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; print ''; print "\n"; } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index aeaf1598e99..cbe9f7e0a42 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -75,6 +75,9 @@ $maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->globa $hookmanager->initHooks(array('invoiceindex')); +$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); + + /* * Actions */ diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index b3a9ed7b453..4d2286c21ac 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -465,6 +465,8 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) { global $conf, $db, $langs, $user, $hookmanager; + $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); + $result = ''; $tmpinvoice = new Facture($db); @@ -488,7 +490,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) } if ($socid) { - $sql .= " AND f.fk_soc = $socid"; + $sql .= " AND f.fk_soc = ".((int) $socid); } // Add where from hooks $parameters = array(); @@ -511,6 +513,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) if ($resql) { $num = $db->num_rows($resql); + $nbofloop = min($num, $maxofloop); $result .= '
'; $result .= ''; @@ -530,7 +533,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) $i = 0; $othernb = 0; $tot_ttc = 0; - while ($i < $num) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); if ($i >= $maxCount) { @@ -577,7 +580,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) if ($othernb) { $result .= ''; $result .= ''; $result .= "\n"; } @@ -608,6 +611,8 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) { global $conf, $db, $langs, $user, $hookmanager; + $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); + $result = ''; $facturesupplierstatic = new FactureFournisseur($db); @@ -637,6 +642,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) if ($resql) { $num = $db->num_rows($resql); + $nbofloop = min($num, $maxofloop); $result .= '
'; $result .= '
'; - $result .= ''.$langs->trans("More").'... ('.$othernb.')'; + $result .= ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; $result .= '
'; @@ -656,7 +662,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $i = 0; $othernb = 0; $tot_ttc = 0; - while ($i < $num) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); if ($i >= $maxCount) { @@ -702,7 +708,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) if ($othernb) { $result .= ''; $result .= ''; $result .= "\n"; }
'; - $result .= ''.$langs->trans("More").'... ('.$othernb.')'; + $result .= ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; $result .= '