diff --git a/lib/helpers.php b/lib/helpers.php
index 0829e10dd..bcaf6b023 100755
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -23,6 +23,7 @@
* @since 2.4.2
*/
use HTMLBuilder\HTMLBuilder;
+use Models\Setting;
/**
* Restituisce l'oggetto dedicato alla gestione della connessione con il database.
@@ -105,7 +106,7 @@ function get($param, $raw = false)
*/
function setting($name, $again = false)
{
- return Settings::getValue($name);
+ return Setting::find((new Setting())->getByName($name)->id_record)->valore;
}
/**
diff --git a/mail.php b/mail.php
index 686de747d..67536c7e5 100755
--- a/mail.php
+++ b/mail.php
@@ -164,7 +164,7 @@ if ($smtp['pec'] == 1 && $module['name'] == 'Fatture di vendita') {
echo '
- {[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "uploads[]", "value": "'.implode(',', $uploads).'", "help": "'.tr('Allegati del documento o caricati nell\'anagrafica dell\'azienda.').'", "values": "query=SELECT `id`, `name` AS text FROM `zz_files` WHERE `id_module` = '.prepare($id_module).' AND `id_record` = '.prepare($id_record).' UNION SELECT `id`, CONCAT(`name`, \' (Azienda)\') AS text FROM `zz_files` WHERE `id_module` = '.(new Module())->getByName('Anagrafiche')->id_record.' AND `id_record` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \'Azienda predefinita\')", "link": "allegato" ]}
+ {[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "uploads[]", "value": "'.implode(',', $uploads).'", "help": "'.tr('Allegati del documento o caricati nell\'anagrafica dell\'azienda.').'", "values": "query=SELECT `id`, `name` AS text FROM `zz_files` WHERE `id_module` = '.prepare($id_module).' AND `id_record` = '.prepare($id_record).' UNION SELECT `id`, CONCAT(`name`, \' (Azienda)\') AS text FROM `zz_files` WHERE `id_module` = '.(new Module())->getByName('Anagrafiche')->id_record.' AND `id_record` = (SELECT `valore` FROM `zz_settings` LEFT JOIN `zz_settings_lang` ON (`zz_settings`.`id` = `zz_settings_lang`.`id_record` AND `zz_settings_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `name` = \'Azienda predefinita\')", "link": "allegato" ]}
';
diff --git a/modules/articoli/ajax/select.php b/modules/articoli/ajax/select.php
index cb874bab4..65d228bf0 100755
--- a/modules/articoli/ajax/select.php
+++ b/modules/articoli/ajax/select.php
@@ -36,7 +36,8 @@ switch ($resource) {
$solo_non_varianti = $superselect['solo_non_varianti'];
$idagente = $superselect['idagente'];
$id_listino = $superselect['id_listino'];
-
+ $iva_predefinita = setting('IVA predefinita');
+
$query = "SELECT
DISTINCT `mg_articoli`.`id`,
IF(`categoria_lang`.`name` IS NOT NULL, CONCAT(`categoria_lang`.`name`, IF(`sottocategoria_lang`.`name` IS NOT NULL, CONCAT(' (', `sottocategoria_lang`.`name`, ')'), '-')), '".tr('Nessuna categoria')."') AS optgroup,
@@ -111,7 +112,7 @@ switch ($resource) {
ON `righe`.`id`=`mg_articoli`.`id`
LEFT JOIN `co_iva` AS iva_articolo ON `iva_articolo`.`id` = `mg_articoli`.`idiva_vendita`
LEFT JOIN `co_iva_lang` AS iva_articolo_lang on (`iva_articolo`.`id` = `iva_articolo_lang`.`id_record` AND `iva_articolo_lang`.`id_lang` = ".prepare(setting('Lingua')).")
- LEFT JOIN `co_iva` AS `iva_predefinita` ON `iva_predefinita`.`id` = (SELECT `valore` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Iva predefinita')
+ LEFT JOIN `co_iva` AS `iva_predefinita` ON `iva_predefinita`.`id` = '.$iva_predefinita.'
LEFT JOIN `co_iva_lang` AS iva_predefinita_lang on (`iva_predefinita`.`id` = `iva_predefinita_lang`.`id_record` AND `iva_predefinita_lang`.`id_lang` = ".prepare(setting('Lingua')).')';
if ($usare_iva_anagrafica) {
diff --git a/modules/impostazioni/sezione.php b/modules/impostazioni/sezione.php
index a0e5df107..b1ce34e50 100644
--- a/modules/impostazioni/sezione.php
+++ b/modules/impostazioni/sezione.php
@@ -28,7 +28,7 @@ $impostazioni = Setting::where('sezione', $sezione)
foreach ($impostazioni as $impostazione) {
echo '
- '.Settings::input($impostazione['id']).'
+ '.Settings::input($impostazione->id).'