|
137 | 137 | $fattura->note_aggiuntive = post('note_aggiuntive'); |
138 | 138 |
|
139 | 139 | $fattura->idanagrafica = post('idanagrafica'); |
140 | | - $fattura->idagente = post('idagente') ?: ''; |
141 | | - $fattura->idreferente = post('idreferente'); |
142 | | - $fattura->idpagamento = post('idpagamento'); |
143 | | - $fattura->id_banca_azienda = post('id_banca_azienda'); |
144 | | - $fattura->id_banca_controparte = post('id_banca_controparte'); |
145 | | - $fattura->idcausalet = post('idcausalet'); |
146 | | - $fattura->idspedizione = post('idspedizione'); |
147 | | - $fattura->idporto = post('idporto'); |
148 | | - $fattura->idaspettobeni = post('idaspettobeni'); |
149 | | - $fattura->idvettore = post('idvettore'); |
150 | | - $fattura->idsede_partenza = post('idsede_partenza'); |
151 | | - $fattura->idsede_destinazione = post('idsede_destinazione'); |
152 | | - $fattura->idconto = post('idconto'); |
| 140 | + $fattura->idagente = post('idagente') ?: null; |
| 141 | + $fattura->idreferente = post('idreferente') ?: null; |
| 142 | + $fattura->idpagamento = post('idpagamento') ?: null; |
| 143 | + $fattura->id_banca_azienda = post('id_banca_azienda') ?: null; |
| 144 | + $fattura->id_banca_controparte = post('id_banca_controparte') ?: null; |
| 145 | + $fattura->idcausalet = post('idcausalet') ?: null; |
| 146 | + $fattura->idspedizione = post('idspedizione') ?: null; |
| 147 | + $fattura->idporto = post('idporto') ?: null; |
| 148 | + $fattura->idaspettobeni = post('idaspettobeni') ?: null; |
| 149 | + $fattura->idvettore = post('idvettore') ?: null; |
| 150 | + $fattura->idsede_partenza = post('idsede_partenza') ?: null; |
| 151 | + $fattura->idsede_destinazione = post('idsede_destinazione') ?: null; |
| 152 | + $fattura->idconto = post('idconto') ?: null; |
153 | 153 | $fattura->split_payment = post('split_payment') ?: 0; |
154 | 154 | $fattura->is_fattura_conto_terzi = post('is_fattura_conto_terzi') ?: 0; |
155 | 155 | $fattura->n_colli = post('n_colli'); |
|
171 | 171 | if ($dir == 'uscita') { |
172 | 172 | $fattura->numero = post('numero'); |
173 | 173 | $fattura->numero_esterno = post('numero_esterno'); |
174 | | - $fattura->idrivalsainps = post('id_rivalsa_inps'); |
175 | | - $fattura->idritenutaacconto = post('id_ritenuta_acconto'); |
| 174 | + $fattura->idrivalsainps = post('id_rivalsa_inps') ?: null; |
| 175 | + $fattura->idritenutaacconto = post('id_ritenuta_acconto') ?: null; |
176 | 176 | } |
177 | 177 |
|
178 | 178 | // Operazioni sul bollo |
|
533 | 533 | $articolo->data_fine_competenza = post('data_fine_competenza') ?: null; |
534 | 534 |
|
535 | 535 | $articolo->id_iva = post('idiva'); |
536 | | - $articolo->idconto = post('idconto'); |
| 536 | + $articolo->idconto = post('idconto') ?: null; |
537 | 537 |
|
538 | 538 | $articolo->calcolo_ritenuta_acconto = post('calcolo_ritenuta_acconto') ?: null; |
539 | 539 | $articolo->id_ritenuta_acconto = post('id_ritenuta_acconto') ?: null; |
|
784 | 784 |
|
785 | 785 | $fattura = Fattura::build($documento->anagrafica, $tipo, post('data'), post('id_segment')); |
786 | 786 |
|
787 | | - if (!empty($documento->idpagamento)) { |
| 787 | + if (!empty($documento->idpagamento) && $documento->idpagamento != 0) { |
788 | 788 | $fattura->idpagamento = $documento->idpagamento; |
789 | 789 | } else { |
790 | 790 | $fattura->idpagamento = setting('Tipo di pagamento predefinito'); |
791 | 791 | } |
792 | 792 |
|
793 | | - $fattura->idsede_partenza = $idsede_partenza; |
794 | | - $fattura->idsede_destinazione = $idsede_destinazione; |
| 793 | + $fattura->idsede_partenza = $idsede_partenza ?: null; |
| 794 | + $fattura->idsede_destinazione = $idsede_destinazione ?: null; |
795 | 795 | $fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null; |
796 | | - $fattura->idreferente = $documento->idreferente; |
797 | | - $fattura->idagente = $documento->idagente ?: ''; |
| 796 | + $fattura->idreferente = $documento->idreferente ?: null; |
| 797 | + $fattura->idagente = $documento->idagente ?: null; |
798 | 798 |
|
799 | 799 | $fattura->save(); |
800 | 800 |
|
|
1159 | 1159 |
|
1160 | 1160 | $provvigione = $dbo->selectOne('an_anagrafiche', 'provvigione_default', ['idanagrafica' => $fattura->idagente])['provvigione_default']; |
1161 | 1161 |
|
1162 | | - $articolo->id_rivalsa_inps = setting('Cassa previdenziale predefinita') ?: ''; |
1163 | | - $articolo->id_ritenuta_acconto = setting('Ritenuta d\'acconto predefinita') ?: ''; |
| 1162 | + $articolo->id_rivalsa_inps = setting('Cassa previdenziale predefinita') ?: null; |
| 1163 | + $articolo->id_ritenuta_acconto = setting('Ritenuta d\'acconto predefinita') ?: null; |
1164 | 1164 | $articolo->setPrezzoUnitario($prezzo_unitario, $id_iva); |
1165 | 1165 | $articolo->setSconto($sconto, 'PRC'); |
1166 | 1166 | $articolo->setProvvigione($provvigione ?: 0, 'PRC'); |
|
0 commit comments