File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -583,7 +583,9 @@ public function save(array $options = [])
583583 $ this ->attributes ['rivalsainps ' ] = $ this ->rivalsa_inps ;
584584 $ this ->attributes ['ritenutaacconto ' ] = $ this ->ritenuta_acconto ;
585585
586- // Fix dei campi statici
586+
587+ $ result = parent ::save ($ options );
588+
587589 $ this ->id_riga_bollo = $ this ->gestoreBollo ->manageRigaMarcaDaBollo ();
588590 $ this ->id_riga_spese_incasso = $ this ->manageRigaSpeseIncasso ();
589591
@@ -592,8 +594,9 @@ public function save(array $options = [])
592594 $ this ->numero_esterno = self ::getNextNumeroSecondario ($ this ->data , $ this ->direzione , $ this ->id_segment );
593595 }
594596
595- // Salvataggio effettivo
596- parent ::save ($ options );
597+ if ($ this ->isDirty (['id_riga_bollo ' , 'id_riga_spese_incasso ' ])) {
598+ parent ::save ($ options );
599+ }
597600
598601 // Operazioni al cambiamento di stato
599602 // Bozza o Annullato -> Stato diverso da Bozza o Annullato
Original file line number Diff line number Diff line change @@ -90,6 +90,10 @@ public function manageRigaMarcaDaBollo()
9090 return null ;
9191 }
9292
93+ if (empty ($ this ->fattura ->id )) {
94+ return null ;
95+ }
96+
9397 // Creazione riga bollo se non presente
9498 if (empty ($ riga )) {
9599 $ riga = Components \Riga::build ($ this ->fattura );
@@ -99,7 +103,7 @@ public function manageRigaMarcaDaBollo()
99103 $ riga ->descrizione = setting ('Descrizione addebito bollo ' );
100104 $ riga ->id_iva = $ righe_bollo ->idiva ?: database ()->fetchOne ('SELECT `id` FROM `co_iva` WHERE `name` = "Escluso art. 15" ' )['id ' ];
101105 $ riga ->idconto = setting ('Conto predefinito per la marca da bollo ' );
102- $ riga ->iddocumento = $ this ->fattura ->id ?: 0 ;
106+ $ riga ->iddocumento = $ this ->fattura ->id ;
103107
104108 // Applico la rivalsa alla marca da bollo se previsto
105109 if ((setting ('Regime Fiscale ' ) == 'RF19 ' ) && (!empty (setting ('Cassa previdenziale predefinita ' )))) {
You can’t perform that action at this time.
0 commit comments