Merge pull request #5508 from defrance/patch-14
fix : warning error if no graphfiles
This commit is contained in:
commit
366769e97c
@ -244,7 +244,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
|||||||
|
|
||||||
$px = new DolGraph();
|
$px = new DolGraph();
|
||||||
|
|
||||||
if (! $error)
|
if (! $error && count($graphfiles)>0)
|
||||||
{
|
{
|
||||||
$mesg = $px->isGraphKo();
|
$mesg = $px->isGraphKo();
|
||||||
if (! $mesg)
|
if (! $mesg)
|
||||||
@ -301,64 +301,67 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
|||||||
|
|
||||||
// Show graphs
|
// Show graphs
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($graphfiles as $key => $val)
|
if ( count($graphfiles)>0)
|
||||||
{
|
{
|
||||||
if (! $graphfiles[$key]['file']) continue;
|
foreach($graphfiles as $key => $val)
|
||||||
|
|
||||||
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".'<div class="fichecenter"><div class="fichehalfleft">'."\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".'<div class="fichecenter"><div class="fichehalfleft">'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "\n".'<div class="fichehalfright"><div class="ficheaddleft">'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show graph
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
// Label
|
||||||
|
print '<tr class="liste_titre"><td colspan="2">';
|
||||||
|
print $graphfiles[$key]['label'];
|
||||||
|
print '</td></tr>';
|
||||||
|
// Image
|
||||||
|
print '<tr class="impair"><td colspan="2" class="nohover" align="center">';
|
||||||
|
print $graphfiles[$key]['output'];
|
||||||
|
print '</td></tr>';
|
||||||
|
// Date generation
|
||||||
|
print '<tr>';
|
||||||
|
if ($graphfiles[$key]['output'] && ! $px->isGraphKo())
|
||||||
|
{
|
||||||
|
if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print '<td>'.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).'</td>';
|
||||||
|
else print '<td>'.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).'</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td>'.($mesg?'<font class="error">'.$mesg.'</font>':$langs->trans("ChartNotGenerated")).'</td>';
|
||||||
|
}
|
||||||
|
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'</a></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
if ($i % 2 == 0)
|
||||||
|
{
|
||||||
|
print "\n".'</div>'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "\n".'</div></div></div>';
|
||||||
|
print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print "\n".'<div class="fichehalfright"><div class="ficheaddleft">'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show graph
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
// Label
|
|
||||||
print '<tr class="liste_titre"><td colspan="2">';
|
|
||||||
print $graphfiles[$key]['label'];
|
|
||||||
print '</td></tr>';
|
|
||||||
// Image
|
|
||||||
print '<tr class="impair"><td colspan="2" class="nohover" align="center">';
|
|
||||||
print $graphfiles[$key]['output'];
|
|
||||||
print '</td></tr>';
|
|
||||||
// Date generation
|
|
||||||
print '<tr>';
|
|
||||||
if ($graphfiles[$key]['output'] && ! $px->isGraphKo())
|
|
||||||
{
|
|
||||||
if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print '<td>'.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).'</td>';
|
|
||||||
else print '<td>'.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).'</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td>'.($mesg?'<font class="error">'.$mesg.'</font>':$langs->trans("ChartNotGenerated")).'</td>';
|
|
||||||
}
|
|
||||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'</a></td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
if ($i % 2 == 0)
|
|
||||||
{
|
|
||||||
print "\n".'</div>'."\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "\n".'</div></div></div>';
|
|
||||||
print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
// div not closed
|
// div not closed
|
||||||
if ($i % 2 == 1)
|
if ($i % 2 == 1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user