Fix import

This commit is contained in:
2026-03-31 17:15:43 +03:00
parent 0be7109df4
commit abb4200215
2 changed files with 22 additions and 2 deletions
+13
View File
@@ -74,6 +74,16 @@ try {
$startRow = max(1, $header_row);
$startColumn = max(1, $start_column);
// Advance startColumn to first non-empty cell in header row (match JS behavior)
for ($sc = $startColumn; $sc <= $highestColumnIndex; $sc++) {
$cl = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($sc);
$cv = trim((string)($worksheet->getCell($cl . $header_row)->getCalculatedValue() ?? ''));
if ($cv !== '') {
$startColumn = $sc;
break;
}
}
// Debug dei parametri
error_log("Processing - template_id: $template_id, startRow: $startRow, startColumn: $startColumn, highestRow: $highestRow, highestColumn: $highestColumn, highestColumnIndex: $highestColumnIndex");
@@ -127,6 +137,9 @@ try {
$headerRowData[] = ($cellValue !== '') ? $cellValue : '__empty_' . $logicalNum . '__';
}
error_log("Logical headers: " . json_encode($headerRowData));
error_log("Logical cols (physical indices): " . json_encode($logicalCols));
// Find which logical columns have real headers
$headerFilledIndices = [];
foreach ($headerRowData as $idx => $hVal) {