26 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/modules_barcode.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/barcode.lib.php';
39 public $version =
'dolibarr';
67 $key =
'BarcodeInternalEngine';
68 $trans = $langs->trans(
'BarcodeInternalEngine');
70 return ($trans != $key) ? $trans :
'Internal engine';
95 global $genbarcode_loc;
99 if ($encoding ==
'EAN13') $supported = 1;
100 if ($encoding ==
'ISBN') $supported = 1;
103 if (file_exists($genbarcode_loc) && empty(
$_SERVER[
"WINDIR"])) {
104 if ($encoding ==
'EAN8') $supported = 1;
105 if ($encoding ==
'UPC') $supported = 1;
106 if ($encoding ==
'C39') $supported = 1;
107 if ($encoding ==
'C128') $supported = 1;
122 public function buildBarCode($code, $encoding, $readable =
'Y', $scale = 1, $nooutputiferror = 0)
126 global $genbarcode_loc, $bar_color, $bg_color, $text_color, $font_loc;
130 if ($encoding ==
'EAN8' || $encoding ==
'EAN13') $encoding =
'EAN';
131 if ($encoding ==
'C39' || $encoding ==
'C128') $encoding = substr($encoding, 1);
135 $_GET[
"code"] = $code;
136 $_GET[
"encoding"] = $encoding;
137 $_GET[
"scale"] = $scale;
138 $_GET[
"mode"] = $mode;
140 dol_syslog(get_class($this).
"::buildBarCode $code,$encoding,$scale,$mode");
141 if ($code) $result =
barcode_print($code, $encoding, $scale, $mode);
143 if (!is_array($result))
145 $this->error = $result;
146 if (empty($nooutputiferror))
print $this->error;
163 public function writeBarCode($code, $encoding, $readable =
'Y', $scale = 1, $nooutputiferror = 0)
165 global $conf, $filebarcode;
169 $file = $conf->barcode->dir_temp.
'/barcode_'.$code.
'_'.$encoding.
'.png';
171 $filebarcode = $file;
173 $result = $this->
buildBarCode($code, $encoding, $readable, $scale, $nooutputiferror);
Class to generate barcode images using php barcode generator.
writeBarCode($code, $encoding, $readable= 'Y', $scale=1, $nooutputiferror=0)
Save an image file on disk (with no output)
barcode_print($code, $encoding="ANY", $scale=2, $mode="png")
Print barcode.
buildBarCode($code, $encoding, $readable= 'Y', $scale=1, $nooutputiferror=0)
Return an image file on the fly (no need to write on disk)
encodingIsSupported($encoding)
Return true if encoding is supported.
isEnabled()
Return if a module can be used or not.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
info()
Return description.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
Parent class for barcode document models.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)