--- /tmp/dsg/dolibarr/htdocs/reception/stats/github_index.php +++ /tmp/dsg/dolibarr/htdocs/reception/stats/client_index.php @@ -37,8 +37,8 @@ // Security check if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; + $action = ''; + $socid = $user->socid; } $nowyear = strftime("%Y", dol_now()); @@ -76,34 +76,36 @@ if (!$user->rights->societe->client->voir || $user->socid) { - $filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png'; -} else { - $filenamenb = $dir.'/receptionsnbinyear-'.$year.'.png'; + $filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filenamenb = $dir.'/receptionsnbinyear-'.$year.'.png'; } $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); if (!$mesg) { - $px1->SetData($data); - $i = $startyear; $legend = array(); - while ($i <= $endyear) - { - $legend[] = $i; - $i++; - } - $px1->SetLegend($legend); - $px1->SetMaxValue($px1->GetCeilMaxValue()); - $px1->SetMinValue(min(0, $px1->GetFloorMinValue())); - $px1->SetWidth($WIDTH); - $px1->SetHeight($HEIGHT); - $px1->SetYLabel($langs->trans("NbOfReceptions")); - $px1->SetShading(3); - $px1->SetHorizTickIncrement(1); - $px1->mode = 'depth'; - $px1->SetTitle($langs->trans("NumberOfReceptionsByMonth")); - - $px1->draw($filenamenb, $fileurlnb); + $px1->SetData($data); + $i = $startyear; $legend = array(); + while ($i <= $endyear) + { + $legend[] = $i; + $i++; + } + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue(min(0, $px1->GetFloorMinValue())); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NbOfReceptions")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->mode = 'depth'; + $px1->SetTitle($langs->trans("NumberOfReceptionsByMonth")); + + $px1->draw($filenamenb, $fileurlnb); } // Build graphic amount of object @@ -207,7 +209,7 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type); -print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); +dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); print '
'; @@ -288,10 +290,11 @@ // Show graphs print '
'; -if ($mesg) { print $mesg; } else { - print $px1->show(); - print "
\n"; - /*print $px2->show(); +if ($mesg) { print $mesg; } +else { + print $px1->show(); + print "
\n"; + /*print $px2->show(); print "
\n"; print $px3->show();*/ } @@ -301,7 +304,7 @@ print ''; print '
'; -print dol_get_fiche_end(); +dol_fiche_end(); --- /tmp/dsg/dolibarr/htdocs/reception/stats/github_month.php +++ /tmp/dsg/dolibarr/htdocs/reception/stats/client_month.php @@ -27,8 +27,6 @@ require_once DOL_DOCUMENT_ROOT.'/reception/class/receptionstats.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; -$year = GETPOST("year", 'int'); - /* * View @@ -41,10 +39,10 @@ $mesg = ''; -print load_fiche_titre($langs->trans("StatisticsOfReceptions").' '.GETPOST("year", 'int'), $mesg); +print load_fiche_titre($langs->trans("StatisticsOfReceptions").' '.$_GET["year"], $mesg); $stats = new ReceptionStats($db); -$data = $stats->getNbReceptionByMonth(GETPOST("year", 'int')); +$data = $stats->getNbReceptionByMonth($_GET["year"]); dol_mkdir($conf->reception->dir_temp); @@ -55,14 +53,14 @@ $mesg = $px->isGraphKo(); if (!$mesg) { - $px->SetData($data); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NbOfOrders")); - $px->SetShading(3); + $px->SetData($data); + $px->SetMaxValue($px->GetCeilMaxValue()); + $px->SetWidth($WIDTH); + $px->SetHeight($HEIGHT); + $px->SetYLabel($langs->trans("NbOfOrders")); + $px->SetShading(3); $px->SetHorizTickIncrement(1); - $px->draw($filename, $fileurl); + $px->draw($filename, $fileurl); } print '';