Skip to content

Commit 6121800

Browse files
committed
fix: confronto dati fe
1 parent 1895902 commit 6121800

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

modules/aggiornamenti/src/Controlli/DatiFattureElettroniche.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,10 @@ protected function checkDocumentoData(Fattura $fattura_vendita, $xml)
658658
$causale_gestionale = $fattura_vendita->note ?? '';
659659

660660
if (!empty($causale_xml) && !empty($causale_gestionale)) {
661-
// Controllo più flessibile per la causale
662-
$causale_xml_clean = strtolower(trim((string) preg_replace('/\s+/', ' ', (string) $causale_xml)));
663-
$causale_gestionale_clean = strtolower(trim((string) preg_replace('/\s+/', ' ', (string) $causale_gestionale)));
661+
// Controllo più flessibile per la causale usando normalizeTextForComparison
662+
// per applicare le stesse trasformazioni usate nella generazione dell'XML
663+
$causale_xml_clean = $this->normalizeTextForComparison($causale_xml, false);
664+
$causale_gestionale_clean = $this->normalizeTextForComparison($causale_gestionale, true);
664665

665666
if ($causale_xml_clean !== $causale_gestionale_clean) {
666667
$errors[] = [
@@ -876,20 +877,20 @@ protected function generateErrorSection($title, $errors, $type, $compact_mode =
876877
$border_color = $error['type'] === self::ERROR_WARNING ? '#dc3545' :
877878
($error['type'] === self::ERROR_WARNING ? '#ffc107' : '#17a2b8');
878879

879-
$html .= '<div style="background: #f8f9fa; border-left: 3px solid '.$border_color.'; padding: 5px 10px; margin-bottom: 3px; font-size: 11px; display: flex; align-items: center; gap: 0; min-height: 28px;">';
880+
$html .= '<div style="background: #f8f9fa; border-left: 3px solid '.$border_color.'; padding: 5px 10px; margin-bottom: 3px; font-size: 11px; display: flex; align-items: flex-start; gap: 10px; min-height: 28px;">';
880881

881-
// Nome del campo in grassetto nero - larghezza fissa per allineamento
882-
$html .= '<span style="color: #000; font-weight: 700; font-size: 11px; white-space: nowrap; min-width: 180px; display: inline-block;">'.htmlspecialchars((string) $error['field']).'</span>';
882+
// Nome del campo in grassetto nero - può andare a capo
883+
$html .= '<span style="color: #000; font-weight: 700; font-size: 11px; flex: 1; display: inline-block; word-wrap: break-word;">'.htmlspecialchars((string) $error['field']).'</span>';
883884

884-
// Valori in formato ultra-compatto con correzione simbolo euro - incolonnati
885+
// Valori in formato ultra-compatto con correzione simbolo euro - larghezza fissa, può andare a capo
885886
if (!empty($error['xml_value']) && $error['xml_value'] !== '-') {
886887
$xml_value = str_replace('&euro;', '', (string) $error['xml_value']);
887-
$html .= '<span style="font-size: 11px; color: #6c757d; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-width: 280px;"><span style="min-width: 35px; font-weight: 600;">XML:</span><span style="color: #495057;">'.htmlspecialchars($xml_value).'</span></span>';
888+
$html .= '<span style="font-size: 11px; color: #6c757d; display: inline-flex; align-items: flex-start; gap: 6px; width: 280px; flex-shrink: 0;"><span style="min-width: 35px; font-weight: 600; flex-shrink: 0;">XML:</span><span style="color: #495057; word-wrap: break-word; overflow-wrap: break-word;">'.htmlspecialchars($xml_value).'</span></span>';
888889
}
889890

890891
if (!empty($error['gestionale_value']) && $error['gestionale_value'] !== '-') {
891892
$gest_value = str_replace('&euro;', '', (string) $error['gestionale_value']);
892-
$html .= '<span style="font-size: 11px; color: #6c757d; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-width: 280px;"><span style="min-width: 35px; font-weight: 600;">Gest:</span><span style="color: #495057;">'.htmlspecialchars($gest_value).'</span></span>';
893+
$html .= '<span style="font-size: 11px; color: #6c757d; display: inline-flex; align-items: flex-start; gap: 6px; width: 280px; flex-shrink: 0;"><span style="min-width: 35px; font-weight: 600; flex-shrink: 0;">Gest:</span><span style="color: #495057; word-wrap: break-word; overflow-wrap: break-word;">'.htmlspecialchars($gest_value).'</span></span>';
893894
}
894895

895896
// Mostra la differenza solo per campi totali (imponibile, iva, totale_documento)
@@ -899,7 +900,7 @@ protected function generateErrorSection($title, $errors, $type, $compact_mode =
899900
if ($show_diff && !empty($error['xml_value']) && !empty($error['gestionale_value']) && $this->isNumericValue($error['xml_value']) && $this->isNumericValue($error['gestionale_value'])) {
900901
$diff = $this->calculateDifference($error['xml_value'], $error['gestionale_value']);
901902
if ($diff !== null) {
902-
$html .= '<span style="font-size: 10px; color: #dc3545; white-space: nowrap; font-weight: 600; display: inline-flex; align-items: center; gap: 4px;"><span style="min-width: 30px; font-weight: 600;">Diff:</span><span>'.htmlspecialchars($diff).'</span></span>';
903+
$html .= '<span style="font-size: 10px; color: #dc3545; white-space: nowrap; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;"><span style="min-width: 30px; font-weight: 600;">Diff:</span><span>'.htmlspecialchars($diff).'</span></span>';
903904
}
904905
}
905906

0 commit comments

Comments
 (0)