mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 11:43:47 -08:00
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:
commit
0184d25a95
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue