From 61facdfc3d28356ab391cefe5bf366b8b32b6d1a Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Wed, 28 Feb 2024 10:21:46 +0100 Subject: [PATCH] Aggiunta tabella fe_natura_lang --- modules/iva/add.php | 2 +- modules/iva/edit.php | 2 +- update/2_4_55.sql | 22 +++++++++++++++++++++- update/tables.php | 1 + 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/modules/iva/add.php b/modules/iva/add.php index 8fa3a10eb..0d1845cf5 100755 --- a/modules/iva/add.php +++ b/modules/iva/add.php @@ -62,7 +62,7 @@ $codice = Aliquota::max('codice') + 1;
- {[ "type": "select", "label": "", "name": "codice_natura_fe", "values": "query=SELECT codice as id, CONCAT(codice, ' - ', descrizione) AS descrizione FROM fe_natura", "extra": "disabled" ]} + {[ "type": "select", "label": "", "name": "codice_natura_fe", "values": "query=SELECT `codice` as id, CONCAT(`codice`, ' - ', `name`) AS descrizione FROM `fe_natura` LEFT JOIN `fe_natura_lang` ON (`fe_natura`.`codice` = `fe_natura_lang`.`id_record` AND `fe_natura_lang`.`id_lang` = )", "extra": "disabled" ]}
diff --git a/modules/iva/edit.php b/modules/iva/edit.php index b2cd18ed1..86aa5494d 100755 --- a/modules/iva/edit.php +++ b/modules/iva/edit.php @@ -78,7 +78,7 @@ if ($res) {
- {[ "type": "select", "label": "", "name": "codice_natura_fe", "value": "$codice_natura_fe$", "required": , "disabled": , "values": "query=SELECT codice as id, CONCAT(codice, ' - ', descrizione) AS descrizione FROM fe_natura", "readonly": "", "extra": "" ]} + {[ "type": "select", "label": "", "name": "codice_natura_fe", "value": "$codice_natura_fe$", "required": , "disabled": , "values": "query=SELECT `codice` as id, CONCAT(`codice`, ' - ', `name`) AS descrizione FROM fe_natura LEFT JOIN `fe_natura_lang` ON (`fe_natura`.`codice` = `fe_natura_lang`.`id_record` AND `fe_natura_lang`.`id_lang` = )", "readonly": "", "extra": "" ]}
diff --git a/update/2_4_55.sql b/update/2_4_55.sql index 2da332967..3308405b6 100644 --- a/update/2_4_55.sql +++ b/update/2_4_55.sql @@ -1170,4 +1170,24 @@ WHERE GROUP BY `co_pagamenti_lang`.`name` HAVING - 2=2" WHERE `name` = 'Pagamenti'; \ No newline at end of file + 2=2" WHERE `name` = 'Pagamenti'; + +-- Aggiunta tabella fe_natura_lang +CREATE TABLE IF NOT EXISTS `fe_natura_lang` ( + `id` int NOT NULL, + `id_lang` int NOT NULL, + `id_record` varchar(5) NOT NULL, + `name` VARCHAR(255) NOT NULL +); +ALTER TABLE `fe_natura_lang` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `fe_natura_lang` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +INSERT INTO `fe_natura_lang` (`id`, `id_lang`, `id_record`, `name`) SELECT NULL, (SELECT `id` FROM `zz_langs` WHERE `iso_code` = 'it'), `codice`, `descrizione` FROM `fe_natura`; + +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; diff --git a/update/tables.php b/update/tables.php index 5c696c254..363e2c2bf 100755 --- a/update/tables.php +++ b/update/tables.php @@ -94,6 +94,7 @@ return [ 'fe_modalita_pagamento', 'fe_modalita_pagamento_lang', 'fe_natura', + 'fe_natura_lang', 'fe_regime_fiscale', 'fe_stati_documento', 'fe_tipi_documento',