Skip to content

Commit

Permalink
Fix: Add a limit into list to avoid browser to hang when database is too
Browse files Browse the repository at this point in the history
large.
  • Loading branch information
eldy committed Jan 9, 2014
1 parent d4db591 commit 2b4f0bd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Expand Up @@ -4,7 +4,8 @@ English Dolibarr ChangeLog


***** ChangeLog for 3.4.3 compared to 3.4.2 *****
Fix: Bad get of localtaxes into contracts add lines
Fix: Bad get of localtaxes into contracts add lines.
Fix: Add a limit into list to avoid browser to hang when database is too large.

***** ChangeLog for 3.4.2 compared to 3.4.1 *****
Fix: field's problem into company's page (RIB).
Expand Down
13 changes: 10 additions & 3 deletions htdocs/comm/index.php
Expand Up @@ -473,8 +473,10 @@
$var=true;

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").'</td></tr>';
while ($i < $num)
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal.php?viewstatut=1">('.$num.')</td></tr>';

$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?1000:$conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop)
{
$obj = $db->fetch_object($result);
$var=!$var;
Expand Down Expand Up @@ -511,7 +513,12 @@
$i++;
$total += $obj->total_ttc;
}
if ($total>0) {
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
}
else if ($total>0)
{
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
}
print "</table><br>";
Expand Down
13 changes: 10 additions & 3 deletions htdocs/comm/propal/index.php
Expand Up @@ -301,7 +301,7 @@
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY p.rowid DESC";

$result=$db->query($sql);
if ($result)
{
Expand All @@ -314,7 +314,9 @@

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal.php?viewstatut=1">('.$num.')</a></td></tr>';
while ($i < $num)

$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?1000:$conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop)
{
$obj = $db->fetch_object($result);
$var=!$var;
Expand Down Expand Up @@ -356,7 +358,12 @@
$i++;
$total += $obj->total_ttc;
}
if ($total>0) {
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
}
else if ($total>0)
{
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
}
print "</table><br>";
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/main.lang
Expand Up @@ -659,6 +659,7 @@ from=from
toward=toward
Access=Access
SetDemandReason=Set source
XMoreLines=%s line(s) hidden

# Week day
Monday=Monday
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/fr_FR/main.lang
Expand Up @@ -657,6 +657,7 @@ from=de
toward=vers
Access=Accès
SetDemandReason=Définir l'origine
XMoreLines=%s ligne(s) non affichée(s)

# Week day
Monday=Lundi
Expand Down

0 comments on commit 2b4f0bd

Please sign in to comment.