--- /tmp/dsg/dolibarr/htdocs/expedition/stats/github_index.php +++ /tmp/dsg/dolibarr/htdocs/expedition/stats/client_index.php @@ -36,8 +36,8 @@ // Security check if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; + $action = ''; + $socid = $user->socid; } $nowyear = strftime("%Y", dol_now()); @@ -73,34 +73,36 @@ if (!$user->rights->societe->client->voir || $user->socid) { - $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; -} else { - $filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png'; + $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filenamenb = $dir.'/shipmentsnbinyear-'.$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("NbOfSendings")); - $px1->SetShading(3); - $px1->SetHorizTickIncrement(1); - $px1->mode = 'depth'; - $px1->SetTitle($langs->trans("NumberOfShipmentsByMonth")); - - $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("NbOfSendings")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->mode = 'depth'; + $px1->SetTitle($langs->trans("NumberOfShipmentsByMonth")); + + $px1->draw($filenamenb, $fileurlnb); } // Build graphic amount of object @@ -204,7 +206,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 '<div class="fichecenter"><div class="fichethirdleft">'; @@ -269,12 +271,8 @@ print '<tr class="oddeven" height="24">'; print '<td class="center">'; - if ($year) { - print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a>'; - } else { - // Technical error that should not happen - print 'Error: validation date of shipment is not defined. This looks strange because shipment is validated. Try to run /install/repair.php?standard=confirmed'; - } + if ($year) print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a>'; + else print $langs->trans("ValidationDateNotDefinedEvenIfShipmentValidated"); print '</td>'; print '<td class="right">'.$val['nb'].'</td>'; /*print '<td class="right">'.price(price2num($val['total'],'MT'),1).'</td>'; @@ -292,10 +290,11 @@ // Show graphs print '<table class="border centpercent"><tr class="pair nohover"><td class="center">'; -if ($mesg) { print $mesg; } else { - print $px1->show(); - print "<br>\n"; - /*print $px2->show(); +if ($mesg) { print $mesg; } +else { + print $px1->show(); + print "<br>\n"; + /*print $px2->show(); print "<br>\n"; print $px3->show();*/ } @@ -305,7 +304,7 @@ print '</div></div></div>'; print '<div style="clear:both"></div>'; -print dol_get_fiche_end(); +dol_fiche_end(); --- /tmp/dsg/dolibarr/htdocs/expedition/stats/github_month.php +++ /tmp/dsg/dolibarr/htdocs/expedition/stats/client_month.php @@ -54,14 +54,14 @@ $px = new DolGraph(); $mesg = $px->isGraphKo(); if (!$mesg) { - $px->SetData($data); - $px->SetMaxValue($px->GetCeilMaxValue()); - $px->SetWidth($WIDTH); - $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NbOfSendings")); - $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->draw($filename, $fileurl); + $px->SetData($data); + $px->SetMaxValue($px->GetCeilMaxValue()); + $px->SetWidth($WIDTH); + $px->SetHeight($HEIGHT); + $px->SetYLabel($langs->trans("NbOfSendings")); + $px->SetShading(3); + $px->SetHorizTickIncrement(1); + $px->draw($filename, $fileurl); } print '<table class="border centpercent">';