From 0d2d2302d5b520a799209f48338657a5bcaaea98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Mar 2020 03:18:49 +0100 Subject: [PATCH] Removed not relevant graph on stats on project --- htdocs/core/class/stats.class.php | 3 +- htdocs/core/customreports.php | 2 + htdocs/projet/class/projectstats.class.php | 1 - htdocs/projet/stats/index.php | 50 +++++++++++----------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 819fac052e0..26de63f10cc 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -198,7 +198,7 @@ abstract class Stats // $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...) for ($i = 0; $i < 12; $i++) { - $data[$i][] = $datay[$endyear][($i + $sm) % 12][0]; // set label + $data[$i][] = $datay[$endyear][($i + $sm) % 12]['label']; // set label $year = $startyear; while ($year <= $endyear) { @@ -479,7 +479,6 @@ abstract class Stats // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** - * Renvoie le montant totalise par mois pour une annee donnee * Return the amount per month for a given year * * @param int $year Year diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index a3bef37ebdc..9a93f886ef4 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -693,6 +693,8 @@ if ($mode == 'graph') { $mesg = $px1->isGraphKo(); if (!$mesg) { + /*var_dump($legend); + var_dump($data);*/ $px1->SetData($data); unset($data); diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 6f551d7ae2b..d7e5c86ffa6 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -76,7 +76,6 @@ class ProjectStats extends Stats $sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label"; $result = array (); - $res = array (); dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 38fa476fcab..09fcab7fedb 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -77,11 +77,12 @@ if (!empty($userid) && $userid != -1) $stats_project->userid = $userid; if (!empty($socid) && $socid != -1) $stats_project->socid = $socid; if (!empty($year)) $stats_project->year = $year; - - +/* if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + // Current stats of project amount per status $data1 = $stats_project->getAllProjectByStatus(); + if (!is_array($data1) && $data1 < 0) { setEventMessages($stats_project->error, null, 'errors'); } @@ -100,43 +101,42 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $i = 0; $tot = count($data1); $legend = array(); while ($i <= $tot) { - $data1[$i][0] = $data1[$i][0]; // Required to avoid error "Could not draw pie with labels contained inside canvas" $legend[] = $data1[$i][0]; $i++; } + $px->SetData($data1); unset($data1); if ($nocolor) - $px->SetDataColor(array( + $px->SetDataColor(array( array( 220, 220, 220 ) )); - $px->SetLegend($legend); - $px->setShowLegend(0); - $px->setShowPointValue($showpointvalue); - $px->setShowPercent(1); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetCssPrefix("cssboxes"); - $px->SetType(array( - 'pie' - )); - $px->SetTitle($langs->trans('OpportunitiesStatusForProjects')); - $result = $px->draw($filenamenb, $fileurlnb); + + $px->SetLegend($legend); + $px->setShowLegend(0); + $px->setShowPointValue($showpointvalue); + $px->setShowPercent(1); + $px->SetMaxValue($px->GetCeilMaxValue()); + $px->SetWidth($WIDTH); + $px->SetHeight($HEIGHT); + $px->SetShading(3); + $px->SetHorizTickIncrement(1); + $px->SetCssPrefix("cssboxes"); + $px->SetType(array('pie')); + $px->SetTitle($langs->trans('OpportunitiesStatusForProjects')); + $result = $px->draw($filenamenb, $fileurlnb); if ($result < 0) { setEventMessages($px->error, null, 'errors'); } } else { - setEventMessages(null, $mesgs, 'errors'); + setEventMessages(null, $mesg, 'errors'); } -} +}*/ // Build graphic number of object @@ -186,13 +186,14 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $mesg = $px2->isGraphKo(); if (!$mesg) { - $px2->SetData($data); $i = $startyear; $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; } + + $px2->SetData($data); $px2->SetLegend($legend); $px2->SetMaxValue($px2->GetCeilMaxValue()); $px2->SetMinValue(min(0, $px2->GetFloorMinValue())); @@ -201,6 +202,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $px2->SetYLabel($langs->trans("ProjectOppAmountOfProjectsByMonth")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); + $px2->SetType(array('bars', 'bars')); $px2->mode = 'depth'; $px2->SetTitle($langs->trans("ProjectOppAmountOfProjectsByMonth")); @@ -353,8 +355,8 @@ else { $stringtoshow .= "
\n"; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - $stringtoshow .= $px->show(); - $stringtoshow .= "
\n"; + //$stringtoshow .= $px->show(); + //$stringtoshow .= "
\n"; $stringtoshow .= $px2->show(); $stringtoshow .= "
\n"; $stringtoshow .= $px3->show();