Skip to content

Commit fee2f50

Browse files
committed
refactor: miglioria avvisi ricevute fatture
1 parent f272f85 commit fee2f50

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

modules/fatture/controller_before.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
if ($module->name == 'Fatture di vendita' && $services_enable) {
3333
$documenti_scarto = [];
3434
$documenti_invio = [];
35-
$codici_scarto = ['EC02', 'ERR', 'ERVAL', 'NS'];
35+
$codici_scarto = ['EC02', 'NS'];
36+
$codici_errore = ['ERR', 'ERVAL',];
3637
$codici_invio = ['GEN', 'QUEUE'];
3738
$data_limite = (new Carbon())->subMonths(6);
3839
$data_limite_invio = (new Carbon())->subDays(10);
@@ -52,7 +53,7 @@
5253
$stato_fe = StatoFE::find($documento->codice_stato_fe);
5354
if (in_array($documento->codice_stato_fe, $codici_scarto)) {
5455
// In caso di NS verifico che non sia semplicemente un codice 00404 (Fattura duplicata)
55-
if ($documento->codice_stato_fe == 'NS' && ($documento->stato != Stato::where('name', 'Bozza')->first()->id) && ($documento->stato != Stato::where('name', 'Non valida')->first()->id)) {
56+
if ($documento->stato->name != 'Bozza' && $documento->stato->name != 'Non valida') {
5657
$ricevuta_principale = $documento->getRicevutaPrincipale();
5758

5859
if (!empty($ricevuta_principale)) {
@@ -76,6 +77,17 @@
7677
}
7778
}
7879
$show_avviso = $show_avviso ?: ($documento->data_stato_fe < (new Carbon())->subDays(4) ? 1 : 0);
80+
} elseif (in_array($documento->codice_stato_fe, $codici_errore)) {
81+
$documenti_scarto[] = [
82+
'id' => $documento->id,
83+
'label' => tr('_ICON_ Fattura numero _NUM_ del _DATE_ : <b>_STATO_</b>', [
84+
'_ICON_' => '<i class="'.$stato_fe->icon.'"></i>',
85+
'_NUM_' => $documento->numero_esterno,
86+
'_DATE_' => dateFormat($documento->data),
87+
'_STATO_' => $stato_fe->name,
88+
]),
89+
];
90+
7991
} elseif (in_array($documento->codice_stato_fe, $codici_invio)) {
8092
$is_estera = false;
8193

0 commit comments

Comments
 (0)