mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-16 04:50:09 -04:00
Add try catch to barcode generation (so errors are displayed in case of
config problems)
This commit is contained in:
@@ -39,19 +39,27 @@ class Barcode_lib
|
||||
|
||||
function generate_barcode($barcode_content, $barcode_config)
|
||||
{
|
||||
if ($barcode_config['barcode_type'] == '1')
|
||||
try
|
||||
{
|
||||
$barcode = new emberlabs\Barcode\Code39();
|
||||
}
|
||||
else
|
||||
if ($barcode_config['barcode_type'] == '1')
|
||||
{
|
||||
$barcode = new emberlabs\Barcode\Code39();
|
||||
}
|
||||
else
|
||||
{
|
||||
$barcode = new emberlabs\Barcode\Code128();
|
||||
}
|
||||
$barcode->setData($barcode_content);
|
||||
$barcode->setQuality($barcode_config['barcode_quality']);
|
||||
$barcode->setDimensions($barcode_config['barcode_width'], $barcode_config['barcode_height']);
|
||||
$barcode->draw();
|
||||
return $barcode->base64();
|
||||
return "";
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$barcode = new emberlabs\Barcode\Code128();
|
||||
echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
}
|
||||
$barcode->setData($barcode_content);
|
||||
$barcode->setQuality($barcode_config['barcode_quality']);
|
||||
$barcode->setDimensions($barcode_config['barcode_width'], $barcode_config['barcode_height']);
|
||||
$barcode->draw();
|
||||
return $barcode->base64();
|
||||
}
|
||||
|
||||
function create_display_barcode($item, $barcode_config)
|
||||
|
||||
Reference in New Issue
Block a user