FIX: Fiche inter graph by status on ficheinter Index page

This commit is contained in:
Florian HENRY 2022-06-22 13:43:07 +02:00
parent 8b06d68cc0
commit abdfc90eae

View File

@ -89,7 +89,6 @@ $sql .= " GROUP BY f.fk_statut";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0;
$total = 0; $total = 0;
$totalinprocess = 0; $totalinprocess = 0;
@ -97,38 +96,30 @@ if ($resql) {
$vals = array(); $vals = array();
$bool = false; $bool = false;
// -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not)
while ($i < $num) { if ($num>0) {
$row = $db->fetch_row($resql); while ($row = $db->fetch_row($resql)) {
if ($row) { var_dump($row);
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) $bool = (!empty($row[2]) ? true : false);
{
$bool = (!empty($row[2]) ?true:false); if (!isset($vals[$row[1] . $bool])) {
if (!isset($vals[$row[1].$bool])) { $vals[$row[1] . $bool] = 0;
$vals[$row[1].$bool] = 0;
}
$vals[$row[1].$bool] += $row[0];
$totalinprocess += $row[0];
} }
$vals[$row[1] . $bool] += $row[0];
$totalinprocess += $row[0];
$total += $row[0]; $total += $row[0];
} }
$i++;
} }
$db->free($resql); $db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'</th></tr>'."\n"; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'</th></tr>'."\n";
$listofstatus = array(0, 1, 3); $listofstatus = array(Fichinter::STATUS_DRAFT, Fichinter::STATUS_VALIDATED, Fichinter::STATUS_BILLED, Fichinter::STATUS_CLOSED);
$bool = false;
foreach ($listofstatus as $status) { foreach ($listofstatus as $status) {
$dataseries[] = array($fichinterstatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool]) ? (int) $vals[$status.$bool] : 0)); $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == 3 && !$bool) {
$bool = true;
} else {
$bool = false;
}
if ($status == Fichinter::STATUS_DRAFT) { if ($status == Fichinter::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0; $colorseries[$status] = '-'.$badgeStatus0;
@ -143,6 +134,7 @@ if ($resql) {
$colorseries[$status] = $badgeStatus6; $colorseries[$status] = $badgeStatus6;
} }
} }
var_dump($dataseries);
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print '<tr class="impair"><td class="center" colspan="2">'; print '<tr class="impair"><td class="center" colspan="2">';