2
0
forked from Wavyzz/dolibarr

Fix: Better error management

This commit is contained in:
Laurent Destailleur
2010-06-27 20:44:23 +00:00
parent 6963bfadcb
commit 65678132d5
2 changed files with 16 additions and 3 deletions

View File

@@ -444,7 +444,13 @@ function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png" ){
dol_syslog("php-barcode.php:barcode_print $code $encoding $scale $mode");
$bars=barcode_encode($code,$encoding);
if (!$bars) return;
if (!$bars)
{
// DOLCHANGE LDR Return error message instead of array
$error='Bad Value '.$code.' for encoding '.$encoding;
dol_syslog('php-barcode.php:barcode_print '.$error, LOG_ERR);
return $error;
}
if (!$mode) $mode="png";
if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']);
elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0);