Files
citrus-cms/app/Services/RegisterCreator/DocumentProcessors/DrawingsProcessor.php
T
2026-04-28 21:14:25 +03:00

51 lines
1.3 KiB
PHP

<?php
namespace App\Services\RegisterCreator\DocumentProcessors;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class DrawingsProcessor extends AbstractDocumentProcessor
{
/**
* Process drawings documents
*/
public function process(
array $weldLogData,
array $document,
Worksheet $sheet,
int &$currentRow,
array $settings
): int {
$this->initialize($weldLogData, $document, $sheet, $currentRow, $settings);
$this->log("Processing Drawings");
$lineIdentifier = $weldLogData[$this->registerColumnBased];
$normalized = $this->normalizeSearchTerm($lineIdentifier);
$search = $this->searchFiles("{$document['path']}/*{$normalized}*.pdf");
$placeholderReplacer = new \App\Services\RegisterCreator\PlaceholderReplacer();
$documentDate = $placeholderReplacer->getLatestDate($weldLogData, $this->registerColumnBased);
// Use the new ExcelRowHandler service method
$newRow = $this->addRowToExcel(
$search,
$lineIdentifier,
$documentDate
);
if ($newRow > $currentRow) {
$currentRow = $newRow;
}
return $currentRow;
}
}