Fix: Error message if required module missing

This commit is contained in:
Laurent Destailleur 2010-01-15 00:17:59 +00:00
parent 96a5f5be19
commit 81b0fd7f8f
2 changed files with 10 additions and 6 deletions

View File

@ -142,13 +142,13 @@ for ($m = 1 ; $m < 13 ; $m++ )
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
if ($coll_listbuy == -1)
if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{
$langs->load("errors");
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
break;
}
if ($coll_listbuy == -2)
if (! is_array($coll_listbuy) && $coll_listbuy == -2)
{
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
break;

View File

@ -270,7 +270,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
if ($sql && $sql=='TODO') return -2;
if ($sql && $sql!='TODO')
{
dol_syslog("Tax.lib.php::vat_by_quarter sql=".$sql);
dol_syslog("Tax.lib.php::vat_by_date sql=".$sql);
$resql = $db->query($sql);
if ($resql)
@ -399,11 +399,15 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
}
}
if (! $sql) return -1;
if ($sql && $sql=='TODO') return -2;
if (! $sql)
{
dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR);
return -1; // -1 = Not accountancy module enabled
}
if ($sql && $sql=='TODO') return -2; // -2 = Feature not yet available
if ($sql && $sql!='TODO')
{
dol_syslog("Tax.lib.php::vat_by_quarter sql=".$sql);
dol_syslog("Tax.lib.php::vat_by_date sql=".$sql);
$resql = $db->query($sql);
if ($resql)
{