This commit is contained in:
Laurent Destailleur 2009-03-25 20:05:14 +00:00
parent 6cc4ccecd0
commit 0029cae441

View File

@ -35,7 +35,7 @@ class modPhpbarcode extends ModeleBarCode
{ {
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $error=''; var $error='';
/** \brief Return if a module can be used or not /** \brief Return if a module can be used or not
* \return boolean true if module can be used * \return boolean true if module can be used
*/ */
@ -80,7 +80,7 @@ class modPhpbarcode extends ModeleBarCode
if ($encoding == 'C128') $supported=1; if ($encoding == 'C128') $supported=1;
return $supported; return $supported;
} }
/** /**
* \brief Return an image file on output * \brief Return an image file on output
* \param $code Valeur numérique a coder * \param $code Valeur numérique a coder
@ -88,13 +88,13 @@ class modPhpbarcode extends ModeleBarCode
* \param $readable Code lisible * \param $readable Code lisible
*/ */
function buildBarCode($code,$encoding,$readable='Y') function buildBarCode($code,$encoding,$readable='Y')
{ {
global $_GET,$_ENV,$_SERVER; global $_GET,$_ENV,$_SERVER;
global $conf; global $conf;
global $genbarcode_loc, $bar_color, $bg_color, $text_color, $font_loc; global $genbarcode_loc, $bar_color, $bg_color, $text_color, $font_loc;
if (! $this->encodingIsSupported($encoding)) return -1; if (! $this->encodingIsSupported($encoding)) return -1;
if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN'; if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN';
if ($encoding == 'C39' || $encoding == 'C128') $encoding = substr($encoding,1); if ($encoding == 'C39' || $encoding == 'C128') $encoding = substr($encoding,1);
@ -118,19 +118,20 @@ class modPhpbarcode extends ModeleBarCode
* \param $readable Code lisible * \param $readable Code lisible
*/ */
function writeBarCode($code,$encoding,$readable='Y') function writeBarCode($code,$encoding,$readable='Y')
{ {
global $conf,$filebarcode; global $conf,$filebarcode;
create_exdir($conf->barcode->dir_temp); create_exdir($conf->barcode->dir_temp);
$file=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; $file=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$filebarcode=$file; // global var to be used in buildBarCode $filebarcode=$file; // global var to be used in barcode_outimage called by barcode_print in buildBarCode
$result=$this->buildBarCode($code,$encoding,$readable);
$result=$this->buildBarCode($code,$encoding,$readable);
return $result; return $result;
} }
} }
?> ?>