Merge pull request #10434 from frederic34/patch-17

The variable $i does not seem to be defined for all execution paths
This commit is contained in:
Laurent Destailleur 2019-01-30 16:49:16 +01:00 committed by GitHub
commit 1b8a873987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
*
* 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
@ -104,12 +104,10 @@ class box_task extends ModeleBoxes
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{
$i = 0;
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
while ($i < $num) {
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][] = array(
'td' => '',
@ -131,11 +129,11 @@ class box_task extends ModeleBoxes
$i++;
}
}
else dol_print_error($this->db);
} else {
dol_print_error($this->db);
}
}
// Add the sum at the bottom of the boxes
$this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
$this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));