diff --git a/modules/anagrafiche/actions.php b/modules/anagrafiche/actions.php index 2669e6251..2e5574f8f 100755 --- a/modules/anagrafiche/actions.php +++ b/modules/anagrafiche/actions.php @@ -193,7 +193,7 @@ switch (post('op')) { break; case 'add': - $idtipoanagrafica = post('idtipoanagrafica'); + $idtipoanagrafica = (array)post('idtipoanagrafica'); $ragione_sociale = post('ragione_sociale'); $anagrafica = Anagrafica::build($ragione_sociale, post('nome'), post('cognome'), $idtipoanagrafica); diff --git a/src/Translator.php b/src/Translator.php index 872a97c53..925722d81 100755 --- a/src/Translator.php +++ b/src/Translator.php @@ -187,7 +187,7 @@ class Translator extends Util\Singleton { if (!isset(self::$currency)) { $id = setting('Valuta'); - $valuta = database()->fetchOne('SELECT symbol FROM zz_currencies WHERE id = '.prepare($id)); + $valuta = database()->fetchOne('SELECT `symbol` FROM `zz_currencies` WHERE `id` = '.prepare($id)); self::$currency = $valuta['symbol']; } diff --git a/update/2_5.sql b/update/2_5.sql index bcf9b1f92..753cd453c 100644 --- a/update/2_5.sql +++ b/update/2_5.sql @@ -1510,6 +1510,30 @@ INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class` INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT id FROM zz_modules WHERE name = 'Articoli'), 0, 'Inventario cespiti', 'Inventario cespiti', 'Cespiti', 'magazzino_cespiti', '', '', 'fa fa-print', '', '', 0, 0, 1, 1); +-- Aggiunta tabella zz_currencies_lang +CREATE TABLE IF NOT EXISTS `zz_currencies_lang` ( + `id` int NOT NULL, + `id_lang` int NOT NULL, + `id_record` int NOT NULL, + `name` VARCHAR(255) NOT NULL, + `title` VARCHAR(255) NOT NULL +); +ALTER TABLE `zz_currencies_lang` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `zz_currencies_lang` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +INSERT INTO `zz_currencies_lang` (`id`, `id_lang`, `id_record`, `name`, `title`) SELECT NULL, (SELECT `id` FROM `zz_langs` WHERE `iso_code` = 'it'), `id`, `name`, `title` FROM `zz_currencies`; + +ALTER TABLE `zz_currencies` + DROP `name`, + DROP `title`; + +ALTER TABLE `zz_currencies_lang` ADD CONSTRAINT `zz_currencies_lang_ibfk_1` FOREIGN KEY (`id_record`) REFERENCES `zz_currencies`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT; + +UPDATE `zz_settings` SET `tipo` = 'query=SELECT `zz_currencies`.`id` AS id, CONCAT(`title`, \' - \', `symbol`) AS text FROM zz_currencies LEFT JOIN `zz_currencies_lang` ON (`zz_currencies_lang`.`id_record` = `zz_currencies`.`id` AND `zz_currencies_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = "Lingua"))' WHERE `zz_settings`.`nome` = 'Valuta'; + -- Aggiunta tabella zz_widgets_lang CREATE TABLE IF NOT EXISTS `zz_widgets_lang` ( `id` int NOT NULL, diff --git a/update/tables.php b/update/tables.php index 8763fbcc5..aca1fc7ac 100755 --- a/update/tables.php +++ b/update/tables.php @@ -155,6 +155,7 @@ return [ 'zz_api_resources', 'zz_cache', 'zz_currencies', + 'zz_currencies_lang', 'zz_checks', 'zz_check_user', 'zz_checklists',