diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php
index f9f2fe51b5f..c7ada869ecf 100644
--- a/htdocs/product/stats/card.php
+++ b/htdocs/product/stats/card.php
@@ -244,7 +244,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
$px = new DolGraph();
- if (! $error)
+ if (! $error && count($graphfiles)>0)
{
$mesg = $px->isGraphKo();
if (! $mesg)
@@ -301,64 +301,67 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
// Show graphs
$i=0;
- foreach($graphfiles as $key => $val)
+ if ( count($graphfiles)>0)
{
- if (! $graphfiles[$key]['file']) continue;
-
- if ($graphfiles == 'propal' && ! $user->rights->propale->lire) continue;
- if ($graphfiles == 'order' && ! $user->rights->commande->lire) continue;
- if ($graphfiles == 'invoices' && ! $user->rights->facture->lire) continue;
- if ($graphfiles == 'proposals_suppliers' && ! $user->rights->supplier_proposal->lire) continue;
- if ($graphfiles == 'invoices_suppliers' && ! $user->rights->fournisseur->facture->lire) continue;
- if ($graphfiles == 'orders_suppliers' && ! $user->rights->fournisseur->commande->lire) continue;
-
-
- if ($i % 2 == 0)
+ foreach($graphfiles as $key => $val)
{
- print "\n".'
'."\n";
+ if (! $graphfiles[$key]['file']) continue;
+
+ if ($graphfiles == 'propal' && ! $user->rights->propale->lire) continue;
+ if ($graphfiles == 'order' && ! $user->rights->commande->lire) continue;
+ if ($graphfiles == 'invoices' && ! $user->rights->facture->lire) continue;
+ if ($graphfiles == 'proposals_suppliers' && ! $user->rights->supplier_proposal->lire) continue;
+ if ($graphfiles == 'invoices_suppliers' && ! $user->rights->fournisseur->facture->lire) continue;
+ if ($graphfiles == 'orders_suppliers' && ! $user->rights->fournisseur->commande->lire) continue;
+
+
+ if ($i % 2 == 0)
+ {
+ print "\n".'
'."\n";
+ }
+ else
+ {
+ print "\n".'
'."\n";
+ }
+
+ // Show graph
+
+ print '
';
+ // Label
+ print '| ';
+ print $graphfiles[$key]['label'];
+ print ' |
';
+ // Image
+ print '| ';
+ print $graphfiles[$key]['output'];
+ print ' |
';
+ // Date generation
+ print '';
+ if ($graphfiles[$key]['output'] && ! $px->isGraphKo())
+ {
+ if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print '| '.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).' | ';
+ else print ''.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).' | ';
+ }
+ else
+ {
+ print ''.($mesg?''.$mesg.'':$langs->trans("ChartNotGenerated")).' | ';
+ }
+ print 'id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').' | ';
+ print '
';
+ print '
';
+
+ if ($i % 2 == 0)
+ {
+ print "\n".'
'."\n";
+ }
+ else
+ {
+ print "\n".'
';
+ print '
'."\n";
+ }
+
+ $i++;
}
- else
- {
- print "\n".'
'."\n";
- }
-
- // Show graph
-
- print '
';
- // Label
- print '| ';
- print $graphfiles[$key]['label'];
- print ' |
';
- // Image
- print '| ';
- print $graphfiles[$key]['output'];
- print ' |
';
- // Date generation
- print '';
- if ($graphfiles[$key]['output'] && ! $px->isGraphKo())
- {
- if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print '| '.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).' | ';
- else print ''.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).' | ';
- }
- else
- {
- print ''.($mesg?''.$mesg.'':$langs->trans("ChartNotGenerated")).' | ';
- }
- print 'id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').' | ';
- print '
';
- print '
';
-
- if ($i % 2 == 0)
- {
- print "\n".'
'."\n";
- }
- else
- {
- print "\n".'
';
- print ''."\n";
- }
-
- $i++;
}
// div not closed
if ($i % 2 == 1)