cleans up dead code

This commit is contained in:
Godfrey M 2024-02-22 12:26:57 -08:00
parent 4fbea9512f
commit e2dcee1959

View file

@ -38,7 +38,8 @@ class DefaultLabel extends RectangleSheet
private int $rows; private int $rows;
public function __construct() { public function __construct()
{
$settings = Setting::getSettings(); $settings = Setting::getSettings();
$this->textSize = Helper::convertUnit($settings->labels_fontsize, 'pt', 'in'); $this->textSize = Helper::convertUnit($settings->labels_fontsize, 'pt', 'in');
@ -74,41 +75,132 @@ class DefaultLabel extends RectangleSheet
} }
public function getUnit() { return 'in'; } public function getUnit()
{
return 'in';
}
public function getPageWidth() { return $this->pageWidth; } public function getPageWidth()
public function getPageHeight() { return $this->pageHeight; } {
return $this->pageWidth;
}
public function getPageMarginTop() { return $this->pageMarginTop; } public function getPageHeight()
public function getPageMarginBottom() { return $this->pageMarginBottom; } {
public function getPageMarginLeft() { return $this->pageMarginLeft; } return $this->pageHeight;
public function getPageMarginRight() { return $this->pageMarginRight; } }
public function getColumns() { return $this->columns; } public function getPageMarginTop()
public function getRows() { return $this->rows; } {
public function getLabelBorder() { return 0; } return $this->pageMarginTop;
}
public function getLabelWidth() { return $this->labelWidth; } public function getPageMarginBottom()
public function getLabelHeight() { return $this->labelHeight; } {
return $this->pageMarginBottom;
}
public function getLabelMarginTop() { return 0; } public function getPageMarginLeft()
public function getLabelMarginBottom() { return 0; } {
public function getLabelMarginLeft() { return 0; } return $this->pageMarginLeft;
public function getLabelMarginRight() { return 0; } }
public function getLabelColumnSpacing() { return $this->labelSpacingH; } public function getPageMarginRight()
public function getLabelRowSpacing() { return $this->labelSpacingV; } {
return $this->pageMarginRight;
}
public function getSupportAssetTag() { return false; } public function getColumns()
public function getSupport1DBarcode() { return true; } {
public function getSupport2DBarcode() { return true; } return $this->columns;
public function getSupportFields() { return 4; } }
public function getSupportTitle() { return true; }
public function getSupportLogo() { return true; }
public function preparePDF($pdf) {} public function getRows()
{
return $this->rows;
}
public function write($pdf, $record) { public function getLabelBorder()
{
return 0;
}
public function getLabelWidth()
{
return $this->labelWidth;
}
public function getLabelHeight()
{
return $this->labelHeight;
}
public function getLabelMarginTop()
{
return 0;
}
public function getLabelMarginBottom()
{
return 0;
}
public function getLabelMarginLeft()
{
return 0;
}
public function getLabelMarginRight()
{
return 0;
}
public function getLabelColumnSpacing()
{
return $this->labelSpacingH;
}
public function getLabelRowSpacing()
{
return $this->labelSpacingV;
}
public function getSupportAssetTag()
{
return false;
}
public function getSupport1DBarcode()
{
return true;
}
public function getSupport2DBarcode()
{
return true;
}
public function getSupportFields()
{
return 4;
}
public function getSupportTitle()
{
return true;
}
public function getSupportLogo()
{
return true;
}
public function preparePDF($pdf)
{
}
public function write($pdf, $record)
{
$asset = $record->get('asset'); $asset = $record->get('asset');
$settings = Setting::getSettings(); $settings = Setting::getSettings();
@ -164,7 +256,7 @@ class DefaultLabel extends RectangleSheet
$fieldsDone = 0; $fieldsDone = 0;
if ($settings->labels_display_name && $fieldsDone < $this->getSupportFields()) { if ($settings->labels_display_name && $fieldsDone < $this->getSupportFields()) {
foreach ($record->get('fields') as $field){ foreach ($record->get('fields') as $field) {
static::writeText( static::writeText(
$pdf, $field['label'][0] . ': ' . $field['value'], $pdf, $field['label'][0] . ': ' . $field['value'],
$textX1, $textY, $textX1, $textY,
@ -176,59 +268,6 @@ class DefaultLabel extends RectangleSheet
$fieldsDone++; $fieldsDone++;
} }
} }
// if ($settings->labels_display_company_name && $fieldsDone < $this->getSupportFields()) {
// if ($asset->company) {
// static::writeText(
// $pdf, 'C: '.$asset->company->name,
// $textX1, $textY,
// 'freesans', '', $this->textSize, 'L',
// $textW, $this->textSize,
// true, 0
// );
// $textY += $this->textSize + self::TEXT_MARGIN;
// $fieldsDone++;
// }
// }
// if ($settings->labels_display_tag && $fieldsDone < $this->getSupportFields()) {
// if ($asset->asset_tag) {
// static::writeText(
// $pdf, 'T: '.$asset->asset_tag,
// $textX1, $textY,
// 'freesans', '', $this->textSize, 'L',
// $textW, $this->textSize,
// true, 0
// );
// $textY += $this->textSize + self::TEXT_MARGIN;
// $fieldsDone++;
// }
// }
// if ($settings->labels_display_serial && $fieldsDone < $this->getSupportFields()) {
// if ($asset->serial) {
// static::writeText(
// $pdf, 'S: '.$asset->serial,
// $textX1, $textY,
// 'freesans', '', $this->textSize, 'L',
// $textW, $this->textSize,
// true, 0
// );
// $textY += $this->textSize + self::TEXT_MARGIN;
// $fieldsDone++;
// }
// }
// if ($settings->labels_display_model && $fieldsDone < $this->getSupportFields()) {
// if ($asset->model) {
// static::writeText(
// $pdf, 'M: '.$asset->model->name,
// $textX1, $textY,
// 'freesans', '', $this->textSize, 'L',
// $textW, $this->textSize,
// true, 0
// );
// $textY += $this->textSize + self::TEXT_MARGIN;
// $fieldsDone++;
// }
// }
} }
} }