Merge pull request #13681 from marcusmoore/bug/sc-23778

Fixed uncaught type error when attempting to render barcodes with invalid characters
This commit is contained in:
snipe 2023-09-29 01:50:07 +01:00 committed by GitHub
commit 0184d25a95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -31,7 +31,7 @@ class LabelsController extends Controller
$exampleAsset->id = 999999;
$exampleAsset->name = 'JEN-867-5309';
$exampleAsset->asset_tag = 'TCA-00001';
$exampleAsset->asset_tag = '100001';
$exampleAsset->serial = 'SN9876543210';
$exampleAsset->company = new Company();

View file

@ -7,6 +7,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use TCPDF;
use TCPDF_STATIC;
use TypeError;
/**
* Model for Labels.
@ -372,7 +373,7 @@ abstract class Label
if (empty($value)) return;
try {
$pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
} catch (\Exception $e) {
} catch (\Exception|TypeError $e) {
\Log::error('The 1D barcode ' . $value . ' is not compliant with the barcode type '. $type);
}
}