From 41eccaeae04b7e5fff2b97f1aa95e094e04549b7 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 28 Sep 2023 17:31:45 -0700 Subject: [PATCH 1/2] Set dummy asset tag to value that is valid for EAN13 --- app/Http/Controllers/LabelsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/LabelsController.php b/app/Http/Controllers/LabelsController.php index 3e29323cb5..ddff771961 100755 --- a/app/Http/Controllers/LabelsController.php +++ b/app/Http/Controllers/LabelsController.php @@ -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(); From bed1055c4ef125946e3702dceec55ef7dfc0c71b Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 28 Sep 2023 17:32:16 -0700 Subject: [PATCH 2/2] Catch TypeError when rendering 1d barcode --- app/Models/Labels/Label.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/Labels/Label.php b/app/Models/Labels/Label.php index 9b48a7e730..69f67f6760 100644 --- a/app/Models/Labels/Label.php +++ b/app/Models/Labels/Label.php @@ -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); } }