A free open source IT asset/license management system
Switched from abstract to public class on Label to cut out stubs
sniped83b950b1b9f
diff --git a/app/Models/Labels/DefaultLabel.php b/app/Models/Labels/DefaultLabel.phpindex 37b6a497ff..732bf0a340 100644--- a/app/Models/Labels/DefaultLabel.php+++ b/app/Models/Labels/DefaultLabel.php@@ -193,8 +193,6 @@ class DefaultLabel extends RectangleSheetreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){diff --git a/app/Models/Labels/Label.php b/app/Models/Labels/Label.phpindex 11a1533656..64af1018bf 100644--- a/app/Models/Labels/Label.php+++ b/app/Models/Labels/Label.php@@ -123,10 +123,14 @@ abstract class Label/*** Make changes to the PDF properties here. OPTIONAL.+ * No-op default so subclasses that don't need to customize PDF+ * properties don't have to declare an empty stub. The subclasses+ * that DO customize (Continuous_53mm_A, Continuous_Landscape_0_59in_A,+ * Tape_53mm_A, Z_Ultimate) override this method with real behavior.** @param TCPDF $pdf The TCPDF instance*/- abstract public function preparePDF(TCPDF $pdf);+ public function preparePDF(TCPDF $pdf): void {}/*** Write single data record as content here.diff --git a/app/Models/Labels/Sheets/Avery/L4736_A.php b/app/Models/Labels/Sheets/Avery/L4736_A.phpindex 13ccabf71e..833a7cdb1c 100644--- a/app/Models/Labels/Sheets/Avery/L4736_A.php+++ b/app/Models/Labels/Sheets/Avery/L4736_A.php@@ -77,8 +77,6 @@ class L4736_A extends L4736return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/L6009_A.php b/app/Models/Labels/Sheets/Avery/L6009_A.phpindex b7643c4268..c31afdc7ab 100644--- a/app/Models/Labels/Sheets/Avery/L6009_A.php+++ b/app/Models/Labels/Sheets/Avery/L6009_A.php@@ -77,8 +77,6 @@ class L6009_A extends L6009return false;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/L7162_A.php b/app/Models/Labels/Sheets/Avery/L7162_A.phpindex de7dad4b9d..9e56ba17f9 100644--- a/app/Models/Labels/Sheets/Avery/L7162_A.php+++ b/app/Models/Labels/Sheets/Avery/L7162_A.php@@ -75,8 +75,6 @@ class L7162_A extends L7162return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/L7162_B.php b/app/Models/Labels/Sheets/Avery/L7162_B.phpindex e51c7f806f..d56a2a6556 100644--- a/app/Models/Labels/Sheets/Avery/L7162_B.php+++ b/app/Models/Labels/Sheets/Avery/L7162_B.php@@ -81,8 +81,6 @@ class L7162_B extends L7162return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/L7163_A.php b/app/Models/Labels/Sheets/Avery/L7163_A.phpindex 5e3cd5eea3..9b026c84a5 100644--- a/app/Models/Labels/Sheets/Avery/L7163_A.php+++ b/app/Models/Labels/Sheets/Avery/L7163_A.php@@ -77,8 +77,6 @@ class L7163_A extends L7163return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/_3490_A.php b/app/Models/Labels/Sheets/Avery/_3490_A.phpindex 9ac77f87da..25b82d9e2c 100644--- a/app/Models/Labels/Sheets/Avery/_3490_A.php+++ b/app/Models/Labels/Sheets/Avery/_3490_A.php@@ -75,8 +75,6 @@ class _3490_A extends _3490return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/_5267_A.php b/app/Models/Labels/Sheets/Avery/_5267_A.phpindex d1742a486f..4022697e67 100644--- a/app/Models/Labels/Sheets/Avery/_5267_A.php+++ b/app/Models/Labels/Sheets/Avery/_5267_A.php@@ -71,8 +71,6 @@ class _5267_A extends _5267return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/_5520_A.php b/app/Models/Labels/Sheets/Avery/_5520_A.phpindex e58566b681..87368ca384 100644--- a/app/Models/Labels/Sheets/Avery/_5520_A.php+++ b/app/Models/Labels/Sheets/Avery/_5520_A.php@@ -75,8 +75,6 @@ class _5520_A extends _5520return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Avery/_5520_B.php b/app/Models/Labels/Sheets/Avery/_5520_B.phpindex ea35a9e750..6dd06d298f 100644--- a/app/Models/Labels/Sheets/Avery/_5520_B.php+++ b/app/Models/Labels/Sheets/Avery/_5520_B.php@@ -77,8 +77,6 @@ class _5520_B extends _5520return true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getLabelPrintableArea();diff --git a/app/Models/Labels/Sheets/Hema/_14130046.php b/app/Models/Labels/Sheets/Hema/_14130046.phpindex 2d50e121e1..04db2055f4 100644--- a/app/Models/Labels/Sheets/Hema/_14130046.php+++ b/app/Models/Labels/Sheets/Hema/_14130046.php@@ -168,8 +168,6 @@ class _14130046 extends RectangleSheetreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){// The QR code is a square occupying (nearly) the full label height,diff --git a/app/Models/Labels/Sheets/Hema/_38310012.php b/app/Models/Labels/Sheets/Hema/_38310012.phpindex 4bee64b24f..162193c030 100644--- a/app/Models/Labels/Sheets/Hema/_38310012.php+++ b/app/Models/Labels/Sheets/Hema/_38310012.php@@ -1,9 +1,9 @@<?php-+namespace App\Models\Labels\Sheets\Hema;-+use App\Models\Labels\RectangleSheet;-+/*** HEMA 38310012 — A4 sheet of 21 labels (3 columns x 7 rows), each 63.5 x 38.1 mm.*@@ -20,156 +20,154 @@ class _38310012 extends RectangleSheet{/* Sheet geometry (mm) */private const PAGE_WIDTH = 210.0;-+private const PAGE_HEIGHT = 297.0;-+private const PAGE_MARGIN_TOP = 13.0;-+private const PAGE_MARGIN_LEFT = 6.0;-+private const LABEL_WIDTH = 63.5;-+private const LABEL_HEIGHT = 38.1;-+private const COLUMN_SPACING = 3.0;-+private const ROW_SPACING = 0.0;-+/* Content layout (mm) */private const CONTENT_MARGIN = 2.0;-+private const QR_GUTTER = 3.0;-+private const TITLE_SIZE = 3.6;-+private const TITLE_MARGIN = 1.0;-+private const FIELD_SIZE = 3.0;-+private const FIELD_MARGIN = 0.8;-+public function getUnit(){return 'mm';}-+public function getPageWidth(){return self::PAGE_WIDTH;}-+public function getPageHeight(){return self::PAGE_HEIGHT;}-+public function getPageMarginTop(){return self::PAGE_MARGIN_TOP;}-+public function getPageMarginBottom(){return self::PAGE_MARGIN_TOP;}-+public function getPageMarginLeft(){return self::PAGE_MARGIN_LEFT;}-+public function getPageMarginRight(){return self::PAGE_MARGIN_LEFT;}-+public function getColumns(){return 3;}-+public function getRows(){return 7;}-+public function getLabelColumnSpacing(){return self::COLUMN_SPACING;}-+public function getLabelRowSpacing(){return self::ROW_SPACING;}-+public function getLabelWidth(){return self::LABEL_WIDTH;}-+public function getLabelHeight(){return self::LABEL_HEIGHT;}-+public function getLabelBorder(){return 0;}-+public function getLabelMarginTop(){return 0;}-+public function getLabelMarginBottom(){return 0;}-+public function getLabelMarginLeft(){return 0;}-+public function getLabelMarginRight(){return 0;}-+public function getSupportAssetTag(){return false;}-+public function getSupport1DBarcode(){return false;}-+public function getSupport2DBarcode(){return true;}-+public function getSupportFields(){return 5;}-+public function getSupportLogo(){return false;}-+public function getSupportTitle(){return true;}-- public function preparePDF($pdf) {}-+public function write($pdf, $record){// The QR code is a square occupying (nearly) the full label height,@@ -177,19 +175,19 @@ class _38310012 extends RectangleSheet$qrSize = $this->getLabelHeight() - (2 * self::CONTENT_MARGIN);$qrX = self::CONTENT_MARGIN;$qrY = self::CONTENT_MARGIN;-+if ($record->get('barcode2d')) {static::write2DBarcode($pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,$qrX, $qrY, $qrSize, $qrSize);}-+// Fields sit to the right of the QR code.$textX = $qrX + $qrSize + self::QR_GUTTER;$textW = $this->getLabelWidth() - self::CONTENT_MARGIN - $textX;$textY = self::CONTENT_MARGIN;-+if ($record->get('title')) {static::writeText($pdf, $record->get('title'),@@ -199,7 +197,7 @@ class _38310012 extends RectangleSheet);$textY += self::TITLE_SIZE + self::TITLE_MARGIN;}-+foreach ($record->get('fields') as $field) {static::writeText($pdf, (($field['label']) ? $field['label'].' ' : '').$field['value'],diff --git a/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php b/app/Models/Labels/Tapes/Brother/TZe_12mm_A.phpindex e8459cf824..601790c570 100644--- a/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php+++ b/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php@@ -50,8 +50,6 @@ class TZe_12mm_A extends TZe_12mmreturn false;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_18mm_A.php b/app/Models/Labels/Tapes/Brother/TZe_18mm_A.phpindex a2ef750a4d..cd113ca952 100644--- a/app/Models/Labels/Tapes/Brother/TZe_18mm_A.php+++ b/app/Models/Labels/Tapes/Brother/TZe_18mm_A.php@@ -50,8 +50,6 @@ class TZe_18mm_A extends TZe_18mmreturn false;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_241.php b/app/Models/Labels/Tapes/Brother/TZe_241.phpindex df8e606ad7..f9f8ee2331 100644--- a/app/Models/Labels/Tapes/Brother/TZe_241.php+++ b/app/Models/Labels/Tapes/Brother/TZe_241.php@@ -54,8 +54,6 @@ class TZe_241 extends TZe_18mmreturn false;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_24mm_A.php b/app/Models/Labels/Tapes/Brother/TZe_24mm_A.phpindex 9ae0279a8d..0cdeb79e70 100644--- a/app/Models/Labels/Tapes/Brother/TZe_24mm_A.php+++ b/app/Models/Labels/Tapes/Brother/TZe_24mm_A.php@@ -60,8 +60,6 @@ class TZe_24mm_A extends TZe_24mmreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_24mm_B.php b/app/Models/Labels/Tapes/Brother/TZe_24mm_B.phpindex e3089ee77c..0119d5ba41 100644--- a/app/Models/Labels/Tapes/Brother/TZe_24mm_B.php+++ b/app/Models/Labels/Tapes/Brother/TZe_24mm_B.php@@ -64,8 +64,6 @@ class TZe_24mm_B extends TZe_24mmreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_24mm_C.php b/app/Models/Labels/Tapes/Brother/TZe_24mm_C.phpindex fbd541036e..ffc2e9cb6e 100644--- a/app/Models/Labels/Tapes/Brother/TZe_24mm_C.php+++ b/app/Models/Labels/Tapes/Brother/TZe_24mm_C.php@@ -64,8 +64,6 @@ class TZe_24mm_C extends TZe_24mmreturn false;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_24mm_D.php b/app/Models/Labels/Tapes/Brother/TZe_24mm_D.phpindex efc172d195..af754e3210 100644--- a/app/Models/Labels/Tapes/Brother/TZe_24mm_D.php+++ b/app/Models/Labels/Tapes/Brother/TZe_24mm_D.php@@ -62,8 +62,6 @@ class TZe_24mm_D extends TZe_24mmreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_24mm_E.php b/app/Models/Labels/Tapes/Brother/TZe_24mm_E.phpindex 5dafbb094a..914617f63a 100644--- a/app/Models/Labels/Tapes/Brother/TZe_24mm_E.php+++ b/app/Models/Labels/Tapes/Brother/TZe_24mm_E.php@@ -69,8 +69,6 @@ class TZe_24mm_E extends TZe_24mmreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Brother/TZe_62mm_Landscape_A.php b/app/Models/Labels/Tapes/Brother/TZe_62mm_Landscape_A.phpindex 9e8c5c9970..92c6ff632c 100644--- a/app/Models/Labels/Tapes/Brother/TZe_62mm_Landscape_A.php+++ b/app/Models/Labels/Tapes/Brother/TZe_62mm_Landscape_A.php@@ -70,8 +70,6 @@ class TZe_62mm_Landscape_A extends TZe_62mm_Landscapeprivate const FIELD_MARGIN = 0.10;- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.phpindex a01706095b..45ab314f9c 100644--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php@@ -69,8 +69,6 @@ class LabelWriter_11354 extends LabelWriterreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.phpindex fc84f73699..19ef97bac7 100644--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php@@ -67,8 +67,6 @@ class LabelWriter_1933081 extends LabelWriterreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.phpindex 86eca86780..fff526923c 100644--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php@@ -67,8 +67,6 @@ class LabelWriter_2112283 extends LabelWriterreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112284.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112284.phpindex 1964f033b2..5e96588d25 100644--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112284.php+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112284.php@@ -21,6 +21,7 @@ class LabelWriter_2112284 extends LabelWriterprivate const FIELD_SIZE = 2.40;private const FIELD_MARGIN = 0.10;+private const RIGHT_SAFE_OFFSET = 4.0;public function getUnit()@@ -68,10 +69,6 @@ class LabelWriter_2112284 extends LabelWriterreturn true;}- public function preparePDF($pdf)- {- }-public function write($pdf, $record){$pa = $this->getPrintableArea();@@ -145,9 +142,9 @@ class LabelWriter_2112284 extends LabelWriterforeach ($fields as $field) {$rawLabel = $field['label'] ?? null;- $value = (string)($field['value'] ?? '');+ $value = (string) ($field['value'] ?? '');- if (!is_string($rawLabel) || trim($rawLabel) === '') {+ if (! is_string($rawLabel) || trim($rawLabel) === '') {static::writeText($pdf, $value,$currentX, $currentY,@@ -160,7 +157,7 @@ class LabelWriter_2112284 extends LabelWritercontinue;}- $labelText = rtrim($rawLabel, ':') . ':';+ $labelText = rtrim($rawLabel, ':').':';static::writeText($pdf, $labelText,@@ -191,4 +188,4 @@ class LabelWriter_2112284 extends LabelWriter);}}-}\ No newline at end of file+}diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.phpindex fa5823c663..9e3641ded1 100644--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php@@ -60,8 +60,6 @@ class LabelWriter_30252 extends LabelWriterreturn true;}- public function preparePDF($pdf) {}-public function write($pdf, $record){$pa = $this->getPrintableArea();diff --git a/app/Models/Labels/Tapes/Generic/Continuous_53mm_A.php b/app/Models/Labels/Tapes/Generic/Continuous_53mm_A.phpindex 9926df1268..6a57b393bf 100644--- a/app/Models/Labels/Tapes/Generic/Continuous_53mm_A.php+++ b/app/Models/Labels/Tapes/Generic/Continuous_53mm_A.php@@ -2,6 +2,8 @@namespace App\Models\Labels\Tapes\Generic;+use TCPDF;+class Continuous_53mm_A extends Continuous_53mm{public function getUnit()@@ -39,7 +41,7 @@ class Continuous_53mm_A extends Continuous_53mmreturn true;}- public function preparePDF($pdf)+ public function preparePDF(TCPDF $pdf): void{$pdf->SetAutoPageBreak(false);}diff --git a/app/Models/Labels/Tapes/Generic/Continuous_Landscape_0_59in_A.php b/app/Models/Labels/Tapes/Generic/Continuous_Landscape_0_59in_A.phpindex 7c09590594..24e3d26600 100644--- a/app/Models/Labels/Tapes/Generic/Continuous_Landscape_0_59in_A.php+++ b/app/Models/Labels/Tapes/Generic/Continuous_Landscape_0_59in_A.php@@ -2,6 +2,8 @@namespace App\Models\Labels\Tapes\Generic;+use TCPDF;+class Continuous_Landscape_0_59in_A extends Continuous_Landscape_0_59in{public function getUnit()@@ -39,7 +41,7 @@ class Continuous_Landscape_0_59in_A extends Continuous_Landscape_0_59inreturn false;}- public function preparePDF($pdf)+ public function preparePDF(TCPDF $pdf): void{$pdf->SetAutoPageBreak(false);}diff --git a/app/Models/Labels/Tapes/Generic/Tape_53mm_A.php b/app/Models/Labels/Tapes/Generic/Tape_53mm_A.phpindex 9064d4cb5d..277fa522b7 100644--- a/app/Models/Labels/Tapes/Generic/Tape_53mm_A.php+++ b/app/Models/Labels/Tapes/Generic/Tape_53mm_A.php@@ -2,6 +2,8 @@namespace App\Models\Labels\Tapes\Generic;+use TCPDF;+class Tape_53mm_A extends Tape_53mm{public function __construct()@@ -44,7 +46,7 @@ class Tape_53mm_A extends Tape_53mmreturn true;}- public function preparePDF($pdf)+ public function preparePDF(TCPDF $pdf): void{$pdf->SetAutoPageBreak(false);}diff --git a/app/Models/Labels/Tapes/Zebra/Z_Ultimate.php b/app/Models/Labels/Tapes/Zebra/Z_Ultimate.phpindex 4f8b673434..1ee9be31cd 100644--- a/app/Models/Labels/Tapes/Zebra/Z_Ultimate.php+++ b/app/Models/Labels/Tapes/Zebra/Z_Ultimate.php@@ -10,6 +10,7 @@ use TCPDF;abstract class Z_Ultimate extends Label{private const LABEL_GAP = 3.00;+private const MARGIN_SIDES = 1.50;private const MARGIN_ENDS = 1.50;@@ -59,7 +60,7 @@ abstract class Z_Ultimate extends Label);}- public function preparePDF(TCPDF $pdf)+ public function preparePDF(TCPDF $pdf): void{$pdf->SetMargins(0, 0, 0);$pdf->SetAutoPageBreak(false, 0);@@ -77,4 +78,4 @@ abstract class Z_Ultimate extends Label$this->write($pdf, $record);});}-}\ No newline at end of file+}