Aggiunta tabella fe_natura_lang

This commit is contained in:
Pek5892 2024-02-28 10:21:46 +01:00
parent a058f89f9a
commit 61facdfc3d
4 changed files with 24 additions and 3 deletions

View File

@ -62,7 +62,7 @@ $codice = Aliquota::max('codice') + 1;
</div>
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('Codice Natura (Fatturazione Elettronica)'); ?>", "name": "codice_natura_fe", "values": "query=SELECT codice as id, CONCAT(codice, ' - ', descrizione) AS descrizione FROM fe_natura", "extra": "disabled" ]}
{[ "type": "select", "label": "<?php echo tr('Codice Natura (Fatturazione Elettronica)'); ?>", "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` = <?php echo prepare(setting('Lingua')); ?>)", "extra": "disabled" ]}
</div>
</div>

View File

@ -78,7 +78,7 @@ if ($res) {
</div>
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('Codice Natura (Fatturazione Elettronica)'); ?>", "name": "codice_natura_fe", "value": "$codice_natura_fe$", "required": <?php echo intval($record['esente']); ?>, "disabled": <?php echo intval(!$record['esente']); ?>, "values": "query=SELECT codice as id, CONCAT(codice, ' - ', descrizione) AS descrizione FROM fe_natura", "readonly": "<?php echo $is_readonly; ?>", "extra": "<?php echo $attr; ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Codice Natura (Fatturazione Elettronica)'); ?>", "name": "codice_natura_fe", "value": "$codice_natura_fe$", "required": <?php echo intval($record['esente']); ?>, "disabled": <?php echo intval(!$record['esente']); ?>, "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` = <?php echo prepare(setting('Lingua')); ?>)", "readonly": "<?php echo $is_readonly; ?>", "extra": "<?php echo $attr; ?>" ]}
</div>
</div>

View File

@ -1170,4 +1170,24 @@ WHERE
GROUP BY
`co_pagamenti_lang`.`name`
HAVING
2=2" WHERE `name` = 'Pagamenti';
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;

View File

@ -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',