diff --git a/modules/fatture/init.php b/modules/fatture/init.php index 55dacb209..d93c8c4fe 100755 --- a/modules/fatture/init.php +++ b/modules/fatture/init.php @@ -78,7 +78,7 @@ if (isset($id_record)) { if (empty($autofattura_vendita) && !empty($fattura->progressivo_invio)) { $autofattura_collegata = Fattura::where('progressivo_invio', '=', $fattura->progressivo_invio)->where('id', '!=', $fattura->id)->first(); } - $abilita_autofattura = ($fattura->anagrafica->nazione->iso2 != 'IT' || $reverse_charge) && $dir == 'uscita' && $fattura->id_autofattura == null && empty($autofattura_collegata); + $abilita_autofattura = (($fattura->anagrafica->nazione->iso2 != 'IT' && !empty($fattura->anagrafica->nazione->iso2)) || $reverse_charge) && $dir == 'uscita' && $fattura->id_autofattura == null && empty($autofattura_collegata); $fattura_acquisto_originale = Fattura::where('id_autofattura', '=', $fattura->id)->first(); } diff --git a/update/2_4_33.sql b/update/2_4_33.sql index 6960bba61..baee12a26 100644 --- a/update/2_4_33.sql +++ b/update/2_4_33.sql @@ -160,7 +160,7 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione` INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Sezionale per autofatture di acquisto', (SELECT `id` FROM `zz_segments` WHERE `name`='Autofatture' AND `id_module`=(SELECT `id` FROM `zz_modules` WHERE name="Fatture di acquisto")), 'query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=(SELECT id FROM zz_modules WHERE name=\"Fatture di acquisto\") ORDER BY name', '1', 'Fatturazione', NULL, NULL); -INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Conto per autofattura', '', 'query=SELECT `id`, CONCAT_WS(\' - \', `numero`, `descrizione`) AS descrizione FROM `co_pianodeiconti3` ORDER BY `descrizione` ASC', '1', 'Piano dei conti', NULL, NULL); +INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Conto per autofattura', (SELECT id FROM `co_pianodeiconti3` WHERE `descrizione`="Compensazione per autofattura"), 'query=SELECT `id`, CONCAT_WS(\' - \', `numero`, `descrizione`) AS descrizione FROM `co_pianodeiconti3` ORDER BY `descrizione` ASC', '1', 'Piano dei conti', NULL, NULL); INSERT INTO `co_pianodeiconti2` (`numero`, `descrizione`, `idpianodeiconti1`, `dir`) VALUES ('910', 'Conti compensativi', (SELECT `id` FROM `co_pianodeiconti1` WHERE `descrizione`='Patrimoniale'), 'entrata/uscita');