diff --git a/update/2_4_55.sql b/update/2_4_55.sql index 3308405b6..9c0bf8d41 100644 --- a/update/2_4_55.sql +++ b/update/2_4_55.sql @@ -1191,3 +1191,25 @@ ALTER TABLE `fe_natura` DROP `descrizione`; ALTER TABLE `fe_natura_lang` ADD CONSTRAINT `fe_natura_lang_ibfk_1` FOREIGN KEY (`id_record`) REFERENCES `fe_natura`(`codice`) ON DELETE CASCADE ON UPDATE RESTRICT; + +-- Aggiunta tabella fe_regime_fiscale_lang +CREATE TABLE IF NOT EXISTS `fe_regime_fiscale_lang` ( + `id` int NOT NULL, + `id_lang` int NOT NULL, + `id_record` varchar(5) NOT NULL, + `name` VARCHAR(255) NOT NULL +); +ALTER TABLE `fe_regime_fiscale_lang` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `fe_regime_fiscale_lang` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +INSERT INTO `fe_regime_fiscale_lang` (`id`, `id_lang`, `id_record`, `name`) SELECT NULL, (SELECT `id` FROM `zz_langs` WHERE `iso_code` = 'it'), `codice`, `descrizione` FROM `fe_regime_fiscale`; + +ALTER TABLE `fe_regime_fiscale` + DROP `descrizione`; + +ALTER TABLE `fe_regime_fiscale_lang` ADD CONSTRAINT `fe_regime_fiscale_lang_ibfk_1` FOREIGN KEY (`id_record`) REFERENCES `fe_regime_fiscale`(`codice`) ON DELETE CASCADE ON UPDATE RESTRICT; + +UPDATE `zz_settings` SET `tipo` = 'query=SELECT `codice` AS id, CONCAT(`codice`, \' - \', `name`)as descrizione FROM fe_regime_fiscale LEFT JOIN `fe_regime_fiscale_lang` ON (`fe_regime_fiscale_lang`.`id_record`=`fe_regime_fiscale`.`codice` AND `fe_regime_fiscale_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \'Lingua\'))' WHERE `zz_settings`.`nome` = 'Regime fiscale'; \ No newline at end of file diff --git a/update/tables.php b/update/tables.php index 363e2c2bf..4125a40bf 100755 --- a/update/tables.php +++ b/update/tables.php @@ -96,6 +96,7 @@ return [ 'fe_natura', 'fe_natura_lang', 'fe_regime_fiscale', + 'fe_regime_fiscale_lang', 'fe_stati_documento', 'fe_tipi_documento', 'fe_tipo_cassa',