diff --git a/database/migrations/2026_04_29_173500_expand_impostazioni_value_for_archive_settings.php b/database/migrations/2026_04_29_173500_expand_impostazioni_value_for_archive_settings.php new file mode 100644 index 0000000..1f5285b --- /dev/null +++ b/database/migrations/2026_04_29_173500_expand_impostazioni_value_for_archive_settings.php @@ -0,0 +1,48 @@ + 0 + ? $template['line_rows'] + : [ + [ + 'mode' => 'source', + 'source' => (string) ($template['stable_line_one_source'] ?? 'stabile_summary'), + 'text' => '', + ], + [ + 'mode' => ((string) ($template['stable_line_two_source'] ?? 'blank_line')) === 'blank_line' ? 'blank_line' : 'source', + 'source' => (string) ($template['stable_line_two_source'] ?? 'blank_line'), + 'text' => '', + ], + [ + 'mode' => ((int) ($template['blank_lines_count'] ?? 0)) >= 1 ? 'blank_line' : 'none', + 'source' => 'none', + 'text' => '', + ], + [ + 'mode' => ((int) ($template['blank_lines_count'] ?? 0)) >= 2 ? 'blank_line' : 'none', + 'source' => 'none', + 'text' => '', + ], + ]; + $stableLines = []; + foreach ($templateLineRows as $lineRow) { + if (! is_array($lineRow)) { + continue; + } + + $mode = (string) ($lineRow['mode'] ?? 'none'); + if ($mode === 'blank_line') { + $stableLines[] = '__BLANK_LINE__'; + continue; + } + + if ($mode === 'text') { + $stableLines[] = trim((string) ($lineRow['text'] ?? '')); + continue; + } + + if ($mode === 'source') { + $stableLines[] = $stableLineValue((string) ($lineRow['source'] ?? 'none'), $payload); + } + } $blankLinesCount = max(0, min(4, (int) ($template['blank_lines_count'] ?? 2))); @endphp