@@ -583,23 +583,17 @@ public function save(array $options = [])
583583 $ this ->attributes ['rivalsainps ' ] = $ this ->rivalsa_inps ;
584584 $ this ->attributes ['ritenutaacconto ' ] = $ this ->ritenuta_acconto ;
585585
586-
587- $ save_result = parent ::save ($ options );
586+ parent ::save ($ options );
588587
589588 $ this ->id_riga_bollo = $ this ->gestoreBollo ->manageRigaMarcaDaBollo ();
590589 $ this ->id_riga_spese_incasso = $ this ->manageRigaSpeseIncasso ();
591590
592591 // Generazione numero fattura se non presente (Bozza -> Emessa)
593- $ numero_generato = false ;
594592 if ((($ id_stato_precedente == $ id_stato_bozza && $ id_stato_attuale == $ id_stato_emessa ) or (!$ is_fiscale )) && empty ($ this ->numero_esterno )) {
595593 $ this ->numero_esterno = self ::getNextNumeroSecondario ($ this ->data , $ this ->direzione , $ this ->id_segment );
596- $ numero_generato = true ;
597- }
598-
599- if ($ this ->isDirty (['id_riga_bollo ' , 'id_riga_spese_incasso ' ]) || $ numero_generato ) {
600- parent ::save ($ options );
601594 }
602595
596+ parent ::save ($ options );
603597 // Operazioni al cambiamento di stato
604598 // Bozza o Annullato -> Stato diverso da Bozza o Annullato
605599 if (
@@ -650,13 +644,8 @@ public function save(array $options = [])
650644 if ($ this ->direzione == 'entrata ' && $ id_stato_precedente == $ id_stato_bozza && $ id_stato_attuale == $ id_stato_emessa ) {
651645 $ stato_fe = StatoFE::find ($ this ->codice_stato_fe );
652646 $ abilita_genera = empty ($ this ->codice_stato_fe ) || intval ($ stato_fe ['is_generabile ' ]);
653-
654647 $ this ->refresh ();
655648
656- if (empty ($ this ->numero_esterno )) {
657- flash ()->error (tr ('Impossibile generare la fattura elettronica: numero fattura mancante ' ));
658- return $ save_result ;
659- }
660649
661650 // Generazione automatica della Fattura Elettronica
662651 $ checks = FatturaElettronica::controllaFattura ($ this );
@@ -698,8 +687,6 @@ public function save(array $options = [])
698687 }
699688 }
700689 }
701-
702- return $ save_result ;
703690 }
704691
705692 public function delete ()
0 commit comments