mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-11 18:32:32 +01:00
Clean code for generating sheet of barcode. Can choose output filename.
This commit is contained in:
@@ -105,13 +105,14 @@ class modPhpbarcode extends ModeleBarCode
|
||||
/**
|
||||
* Return an image file on the fly (no need to write on disk)
|
||||
*
|
||||
* @param string $code Value to encode
|
||||
* @param string $encoding Mode of encoding
|
||||
* @param string $readable Code can be read
|
||||
* @param integer $scale Scale
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $code Value to encode
|
||||
* @param string $encoding Mode of encoding
|
||||
* @param string $readable Code can be read
|
||||
* @param integer $scale Scale
|
||||
* @param integer $nooutputiferror No output if error
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function buildBarCode($code,$encoding,$readable='Y',$scale=1)
|
||||
function buildBarCode($code,$encoding,$readable='Y',$scale=1,$nooutputiferror=0)
|
||||
{
|
||||
global $_GET,$_SERVER;
|
||||
global $conf;
|
||||
@@ -135,7 +136,7 @@ class modPhpbarcode extends ModeleBarCode
|
||||
if (! is_array($result))
|
||||
{
|
||||
$this->error=$result;
|
||||
print $this->error;
|
||||
if (empty($nooutputiferror)) print $this->error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -145,13 +146,14 @@ class modPhpbarcode extends ModeleBarCode
|
||||
/**
|
||||
* Save an image file on disk (with no output)
|
||||
*
|
||||
* @param string $code Value to encode
|
||||
* @param string $encoding Mode of encoding
|
||||
* @param string $readable Code can be read
|
||||
* @param integer $scale Scale
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $code Value to encode
|
||||
* @param string $encoding Mode of encoding
|
||||
* @param string $readable Code can be read
|
||||
* @param integer $scale Scale
|
||||
* @param integer $nooutputiferror No output if error
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function writeBarCode($code,$encoding,$readable='Y',$scale=1)
|
||||
function writeBarCode($code,$encoding,$readable='Y',$scale=1,$nooutputiferror=0)
|
||||
{
|
||||
global $conf,$filebarcode;
|
||||
|
||||
@@ -161,7 +163,7 @@ class modPhpbarcode extends ModeleBarCode
|
||||
|
||||
$filebarcode=$file; // global var to be used in barcode_outimage called by barcode_print in buildBarCode
|
||||
|
||||
$result=$this->buildBarCode($code,$encoding,$readable,$scale);
|
||||
$result=$this->buildBarCode($code,$encoding,$readable,$scale,$nooutputiferror);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user