FabioFratini 10 месяцев назад
Родитель
Сommit
33e6f07d18
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      app/Http/Livewire/Istat.php

+ 8 - 1
app/Http/Livewire/Istat.php

@@ -704,6 +704,12 @@ class Istat extends Component
                                     $v_data['cittadinanza_conducente'] .= str_pad($country->istat_code, 3, ' ', STR_PAD_RIGHT);
                                     $v_data['cittadinanza_conducente'] .= str_pad(preg_replace('[^A-Z ]', '', strtoupper($country->name)), 30, ' ', STR_PAD_RIGHT);
                                 }
+
+                                $countryDataLen = strlen($v_data['cittadinanza_conducente']);
+                                $expectedCountryDataLen = 34;
+                                if ($countryDataLen < $expectedCountryDataLen) {
+                                    $v_data['cittadinanza_conducente'] .= str_repeat(' ', $expectedCountryDataLen - $countryDataLen);
+                                }
                             } else {
                                 $v_data['tipo'] .= str_repeat(' ', 2);
                                 $v_data['veicolo'] .= str_repeat(' ', 18);
@@ -902,7 +908,8 @@ class Istat extends Component
                     continue;
                 }
             }
-            $txt_data = implode("\n", $txt);
+            $txt_data = implode("\r\n", $txt);
+
             return response()->streamDownload(function () use ($txt_data) {
                 echo  $txt_data;
             }, 'istat_' . $this->from . "_" . $this->to . '.txt');