@@ -153,7 +153,7 @@ if (!empty($options['create_document'])) {
// Opzioni aggiuntive per i DDT
elseif (in_array($final_module->getTranslation('title'), ['Ddt in uscita', 'Ddt in entrata'])) {
- $stato_predefinito = (new Stato())->getByField('title', 'Bozza', Models\Locale::getPredefined()->id);
+ $stato_predefinito = Stato::where('name', 'Bozza')->first()->id;
echo '
- {[ "type": "select", "label": "'.tr('Causale trasporto').'", "name": "id_causale_trasporto", "required": 1, "ajax-source": "causali", "icon-after": "add|'.(new Module())->getByField('title', 'Causali', Models\Locale::getPredefined()->id).'", "help": "'.tr('Definisce la causale del trasporto').'" ]}
+ {[ "type": "select", "label": "'.tr('Causale trasporto').'", "name": "id_causale_trasporto", "required": 1, "ajax-source": "causali", "icon-after": "add|'.Module::where('name', 'Causali')->first()->id.'", "help": "'.tr('Definisce la causale del trasporto').'" ]}
';
}
// Opzioni aggiuntive per gli Ordini
elseif (in_array($final_module->getTranslation('title'), ['Ordini cliente', 'Ordini fornitore'])) {
- $stato_predefinito = (new StatoOrdine())->getByField('title', 'Bozza', Models\Locale::getPredefined()->id);
+ $stato_predefinito = StatoOrdine::where('name', 'Bozza')->first()->id;
echo '
@@ -182,7 +182,7 @@ if (!empty($options['create_document'])) {
echo '
- {[ "type": "select", "label": "'.$tipo_anagrafica.'", "name": "idanagrafica", "required": 1, "ajax-source": "'.$ajax.'", "icon-after": "add|'.(new Module())->getByField('title', 'Anagrafiche', Models\Locale::getPredefined()->id).'|tipoanagrafica='.$tipo_anagrafica.'" ]}
+ {[ "type": "select", "label": "'.$tipo_anagrafica.'", "name": "idanagrafica", "required": 1, "ajax-source": "'.$ajax.'", "icon-after": "add|'.Module::where('name', 'Anagrafiche')->first()->id.'|tipoanagrafica='.$tipo_anagrafica.'" ]}
';
}
diff --git a/include/common/riga.php b/include/common/riga.php
index fbd585da6..bc1b86489 100755
--- a/include/common/riga.php
+++ b/include/common/riga.php
@@ -45,7 +45,7 @@ echo '
// Unità di misura
echo '
- {[ "type": "select", "label": "'.tr('Unità di misura').'", "icon-after": "add|'.(new Module())->getByField('title', 'Unità di misura', Models\Locale::getPredefined()->id).'", "name": "um", "value": "'.$result['um'].'", "ajax-source": "misure" ]}
+ {[ "type": "select", "label": "'.tr('Unità di misura').'", "icon-after": "add|'.Module::where('name', 'Unità di misura')->first()->id.'", "name": "um", "value": "'.$result['um'].'", "ajax-source": "misure" ]}
';
// Unità di misura
diff --git a/include/init/init.php b/include/init/init.php
index 510e50de5..e09699b83 100755
--- a/include/init/init.php
+++ b/include/init/init.php
@@ -28,7 +28,7 @@ if (Update::isUpdateAvailable() || !$dbo->isInstalled()) {
return;
}
-$id_tipo_azienda = Tipo::find((new Tipo())->getByField('title', 'Azienda', Models\Locale::getPredefined()->id))->id;
+$id_tipo_azienda = Tipo::where('name', 'Azienda')->first()->id;
$has_azienda = $dbo->fetchNum('SELECT `an_anagrafiche`.`idanagrafica` FROM `an_anagrafiche`
LEFT JOIN `an_tipianagrafiche_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica`
@@ -74,7 +74,7 @@ if (post('action') == 'init') {
// Azienda predefinita
if (!$has_azienda) {
Filter::set('post', 'op', 'add');
- $id_module = (new Module())->getByField('title', 'Anagrafiche', Models\Locale::getPredefined()->id);
+ $id_module = Module::where('name', 'Anagrafiche')->first()->id;
include base_dir().'/modules/anagrafiche/actions.php';
// Logo stampe
@@ -178,7 +178,7 @@ if (!$has_azienda) {
';
- $idtipoanagrafica = (new Tipo())->getByField('title', 'Azienda', Models\Locale::getPredefined()->id);
+ $idtipoanagrafica = Tipo::where('name', 'Azienda')->first()->id;
$readonly_tipo = true;
ob_start();
diff --git a/include/riferimenti/riferimenti.php b/include/riferimenti/riferimenti.php
index dc3659413..a9b4d2a53 100644
--- a/include/riferimenti/riferimenti.php
+++ b/include/riferimenti/riferimenti.php
@@ -54,7 +54,7 @@ $direzione_richiesta = $source->getDocument()->direzione == 'entrata' ? 'uscita'
// Individuazione DDT disponibili
$ddt = DDT::whereHas('stato', function ($query) {
- $id_stato = (new StatoDDT())->getByField('title', 'Bozza', Models\Locale::getPredefined()->id);
+ $id_stato = StatoDDT::where('name', 'Bozza')->first()->id;
$query->where('id', '!=', $id_stato);
})->whereHas('tipo', function ($query) use ($direzione_richiesta) {
$query->where('dir', '=', $direzione_richiesta);
@@ -70,7 +70,7 @@ foreach ($ddt as $elemento) {
// Individuazione ordini disponibili
$tipo_ordini = $direzione_richiesta == 'entrata' ? 'cliente' : 'fornitore';
$ordini = Ordine::whereHas('stato', function ($query) {
- $id_stato = (new StatoOrdine())->getByField('title', 'Bozza', Models\Locale::getPredefined()->id);
+ $id_stato = StatoOrdine::where('name', 'Bozza')->first()->id;
$query->where('id', '!=', $id_stato);
})->whereHas('tipo', function ($query) use ($direzione_richiesta) {
$query->where('dir', '=', $direzione_richiesta);
diff --git a/include/top.php b/include/top.php
index ff15aaf09..864c33903 100755
--- a/include/top.php
+++ b/include/top.php
@@ -238,7 +238,7 @@ if (Auth::check()) {
{ name: "tools", items : [ "Maximize", "ShowBlocks" ] },
{ name: "about", items: [ "About" ] }
],
- order_manager_id: "'.($dbo->isInstalled() ? (new Module())->getByField('title', 'Stato dei servizi', Models\Locale::getPredefined()->id) : '').'",
+ order_manager_id: "'.($dbo->isInstalled() ? Module::where('name', 'Stato dei servizi')->first()->id : '').'",
dataload_page_buffer: '.setting('Lunghezza in pagine del buffer Datatables').',
tempo_attesa_ricerche: '.setting('Tempo di attesa ricerche in secondi').',
restrict_summables_to_selected: '.setting('Totali delle tabelle ristretti alla selezione').',
diff --git a/mail.php b/mail.php
index cd07b5621..eab40a1e9 100755
--- a/mail.php
+++ b/mail.php
@@ -164,7 +164,7 @@ if ($smtp['pec'] == 1 && $module->getTranslation('title') == '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())->getByField('title', 'Anagrafiche', Models\Locale::getPredefined()->id).' AND `id_record` = '.setting('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` = '.Module::where('name', 'Anagrafiche')->first()->id.' AND `id_record` = '.setting('Azienda predefinita').'", "link": "allegato" ]}
';
diff --git a/modules/aggiornamenti/actions.php b/modules/aggiornamenti/actions.php
index 2f3b449cd..11ac080f5 100755
--- a/modules/aggiornamenti/actions.php
+++ b/modules/aggiornamenti/actions.php
@@ -39,7 +39,7 @@ switch (filter('op')) {
}
// Salvataggio della versione nella cache
- Cache::find((new Cache())->getByField('title', 'Ultima esecuzione del cron', Models\Locale::getPredefined()->id))->set($versione);
+ Cache::where('name', 'Ultima esecuzione del cron')->first()->set($versione);
echo $versione;
break;
diff --git a/modules/aggiornamenti/src/UpdateHook.php b/modules/aggiornamenti/src/UpdateHook.php
index 6987d5e09..ab7ece2eb 100755
--- a/modules/aggiornamenti/src/UpdateHook.php
+++ b/modules/aggiornamenti/src/UpdateHook.php
@@ -47,7 +47,7 @@ class UpdateHook extends CachedManager
$update = null;
}
- $module = Module::find((new Module())->getByField('title', 'Aggiornamenti', \Models\Locale::getPredefined()->id));
+ $module = Module::where('name', 'Aggiornamento')->first();
$link = base_path().'/controller.php?id_module='.$module->id;
$message = tr("E' disponibile la versione _VERSION_ del gestionale", [
diff --git a/modules/aggiornamenti/upload_modules.php b/modules/aggiornamenti/upload_modules.php
index a27fff848..56393891f 100755
--- a/modules/aggiornamenti/upload_modules.php
+++ b/modules/aggiornamenti/upload_modules.php
@@ -68,7 +68,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
$directory = 'modules';
$table = 'zz_modules';
- $installed = Module::find((new Module())->getByField('title', $info['name']));
+ $installed = Module::where('name', $info['name'])->first();
}
// Copia dei file nella cartella relativa
@@ -86,7 +86,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
'default' => 0,
'enabled' => 1,
'icon' => $info['icon'],
- 'parent' => (new Module())->getByField('title', $info['parent']),
+ 'parent' => Module::where('name', $info['parent'])->first()->id,
]));
$id_record = $dbo->lastInsertedID();
$dbo->insert($table.'_lang', array_merge($insert, [
@@ -122,9 +122,9 @@ if (file_exists($extraction_dir.'/VERSION')) {
$directory = 'plugins';
$table = 'zz_plugins';
- $installed = Plugin::find((new Plugin())->getByField('title', $info['name']));
- $insert['idmodule_from'] = (new Module())->getByField('title', $info['module_from']);
- $insert['idmodule_to'] = (new Module())->getByField('title', $info['module_to']);
+ $installed = Plugin::where('name', $info['name'])->first()->id;
+ $insert['idmodule_from'] = Module::where('name', $info['module_from'])->first()->id;
+ $insert['idmodule_to'] = Module::where('name', $info['module_to'])->first()->id;
$insert['position'] = $info['position'];
}
@@ -134,7 +134,7 @@ if (file_exists($extraction_dir.'/VERSION')) {
$table = 'zz_prints';
$installed = Prints::getPrints()[$info['name']];
- $insert['id_module'] = (new Module())->getByField('title', $info['module']);
+ $insert['id_module'] = Module::where('name', $info['module'])->first()->id;
$insert['is_record'] = $info['is_record'];
$insert_lang['filename'] = $info['filename'];
$insert['icon'] = $info['icon'];
diff --git a/modules/anagrafiche/add.php b/modules/anagrafiche/add.php
index 17fc55997..2d001cd47 100755
--- a/modules/anagrafiche/add.php
+++ b/modules/anagrafiche/add.php
@@ -22,10 +22,10 @@ use Modules\Anagrafiche\Tipo;
include_once __DIR__.'/../../core.php';
-$id_nazione_italia = (new Nazione())->getByField('title', 'Italia', Models\Locale::getPredefined()->id);
+$id_nazione_italia = Nazione::where('name', 'Italia')->first()->id;
$tipo = get('tipoanagrafica');
-$id_tipo = (new Tipo())->getByField('title', $tipo, Models\Locale::getPredefined()->id);
-$id_tipo_azienda = (new Tipo())->getByField('title', 'Azienda', Models\Locale::getPredefined()->id);
+$id_tipo = Tipo::where('name', $tipo)->first()->id;
+$id_tipo_azienda = Tipo::where('name', 'Azienda')->first()->id;
if (!empty($tipo)) {
$rs = $dbo->fetchArray('SELECT `an_tipianagrafiche`.`id`, `an_tipianagrafiche_lang`.`title` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `an_tipianagrafiche`.`id`='.prepare($id_tipo));
diff --git a/modules/anagrafiche/ajax/search.php b/modules/anagrafiche/ajax/search.php
index 2bef50813..06b1f64cb 100755
--- a/modules/anagrafiche/ajax/search.php
+++ b/modules/anagrafiche/ajax/search.php
@@ -24,7 +24,7 @@ use Models\Module;
Anagrafiche
*/
-$link_id = (new Module())->getByField('title', 'Anagrafiche', Models\Locale::getPredefined()->id);
+$link_id = Module::where('name', 'Anagrafiche')->first()->id;
$fields = [
'Codice' => 'codice',
diff --git a/modules/anagrafiche/ajax/select.php b/modules/anagrafiche/ajax/select.php
index 756e33250..f8d04bcd7 100755
--- a/modules/anagrafiche/ajax/select.php
+++ b/modules/anagrafiche/ajax/select.php
@@ -25,7 +25,7 @@ $filter_agente = Auth::user()['gruppo'] == 'Agenti';
switch ($resource) {
case 'clienti':
$id_azienda = setting('Azienda predefinita');
- $tipologia = Tipo::find((new Tipo())->getByField('title', 'Cliente', Models\Locale::getPredefined()->id))->id;
+ $tipologia = Tipo::where('name', 'Cliente')->first()->id;
$query = "SELECT
`an_anagrafiche`.`idanagrafica` AS id,
@@ -103,7 +103,7 @@ switch ($resource) {
case 'fornitori':
$id_azienda = setting('Azienda predefinita');
- $tipologia = Tipo::find((new Tipo())->getByField('title', 'Fornitore', Models\Locale::getPredefined()->id))->id;
+ $tipologia = Tipo::where('name', 'Fornitore')->first()->id;
$query = "SELECT
`an_anagrafiche`.`idanagrafica` AS id,
@@ -147,7 +147,7 @@ switch ($resource) {
break;
case 'vettori':
- $tipologia = Tipo::find((new Tipo())->getByField('title', 'Vettore', Models\Locale::getPredefined()->id))->id;
+ $tipologia = Tipo::where('name', 'Vettore')->first()->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT(`ragione_sociale`, IF(`citta` IS NULL OR `citta` = '', '', CONCAT(' (', `citta`, ')')), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `idtipointervento_default` AS idtipointervento FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `ragione_sociale`';
@@ -176,7 +176,7 @@ switch ($resource) {
* - idanagrafica
*/
case 'agenti':
- $tipologia = Tipo::find((new Tipo())->getByField('title', 'Agente', Models\Locale::getPredefined()->id))->id;
+ $tipologia = Tipo::where('name', 'Agente')->first()->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT(`ragione_sociale`, IF(`citta` IS NULL OR `citta` = '', '', CONCAT(' (', `citta`, ')')), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `idtipointervento_default` FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `ragione_sociale`';
@@ -216,7 +216,7 @@ switch ($resource) {
break;
case 'tecnici':
- $tipologia = Tipo::find((new Tipo())->getByField('title', 'Tecnico', Models\Locale::getPredefined()->id))->id;
+ $tipologia = Tipo::where('name', 'Tecnico')->first()->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT(`ragione_sociale`, IF(`citta` IS NULL OR `citta` = '', '', CONCAT(' (', `citta`, ')')), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `idtipointervento_default` FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `ragione_sociale`';
@@ -250,9 +250,9 @@ switch ($resource) {
break;
case 'clienti_fornitori':
- $id_cliente = Tipo::find((new Tipo())->getByField('title', 'Cliente', Models\Locale::getPredefined()->id))->id;
- $id_fornitore = Tipo::find((new Tipo())->getByField('title', 'Fornitore', Models\Locale::getPredefined()->id))->id;
- $id_azienda = Tipo::find((new Tipo())->getByField('title', 'Azienda', Models\Locale::getPredefined()->id))->id;
+ $id_cliente = Tipo::where('name', 'Cliente')->first()->id;
+ $id_fornitore = Tipo::where('name', 'Fornitore')->first()->id;
+ $id_azienda = Tipo::where('name', 'Azienda')->first()->id;
$query = "SELECT `an_anagrafiche`.`idanagrafica` AS id, CONCAT_WS('', `ragione_sociale`, IF(`citta` !='' OR `provincia` != '', CONCAT(' (', `citta`, IF(`provincia`!='', CONCAT(' ', `provincia`), ''), ')'), ''), IF(`an_anagrafiche`.`deleted_at` IS NULL, '', ' (".tr('eliminata').")'),' - ', `an_anagrafiche`.`codice`) AS descrizione, `an_tipianagrafiche_lang`.`title` AS optgroup, `idtipointervento_default`, `an_tipianagrafiche`.`id` as id_tipo FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `optgroup` ASC, `ragione_sociale` ASC';
diff --git a/modules/anagrafiche/buttons.php b/modules/anagrafiche/buttons.php
index 482490c3a..d57df4e5e 100755
--- a/modules/anagrafiche/buttons.php
+++ b/modules/anagrafiche/buttons.php
@@ -32,7 +32,7 @@ if (in_array($id_cliente, $tipi_anagrafica) or in_array($id_fornitore, $tipi_ana
// Aggiunta utente per i tecnici
if (in_array($id_tecnico, $tipi_anagrafica)) {
echo '
-
+
'.tr('Nuovo utente').'
';
}
@@ -40,35 +40,35 @@ if (in_array($id_cliente, $tipi_anagrafica) or in_array($id_fornitore, $tipi_ana
if (in_array($id_cliente, $tipi_anagrafica)) {
echo '
-
+
'.tr('Nuova attività').'
-
+
'.tr('Nuovo preventivo').'
-
'.tr('Nuovo contratto').'
+
'.tr('Nuovo contratto').'
-
'.tr('Nuovo ordine cliente').'
+
'.tr('Nuovo ordine cliente').'
-
'.tr('Nuovo ddt in uscita').'
+
'.tr('Nuovo ddt in uscita').'
-
'.tr('Nuova fattura di vendita').'
+
'.tr('Nuova fattura di vendita').'
-
'.tr('Nuova registrazione contabile (cliente)').'';
+
'.tr('Nuova registrazione contabile (cliente)').'';
}
if (in_array($id_fornitore, $tipi_anagrafica)) {
echo '
-
'.tr('Nuovo ordine fornitore').'
+
'.tr('Nuovo ordine fornitore').'
-
'.tr('Nuovo ddt in entrata').'
+
'.tr('Nuovo ddt in entrata').'
-
'.tr('Nuova fattura di acquisto').'
+
'.tr('Nuova fattura di acquisto').'
-
'.tr('Nuova registrazione contabile (fornitore)').'';
+
'.tr('Nuova registrazione contabile (fornitore)').'';
}
echo '
diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php
index 15cd7fb13..f3abed7cb 100755
--- a/modules/anagrafiche/edit.php
+++ b/modules/anagrafiche/edit.php
@@ -32,9 +32,9 @@ $is_agente = in_array($id_agente, $tipi_anagrafica);
$is_azienda = in_array($id_azienda, $tipi_anagrafica);
if (!$is_cliente && !$is_fornitore && !$is_azienda && $is_tecnico) {
- $ignore = Plugin::where('id', '=', (new Plugin())->getByField('title', 'Sedi', Models\Locale::getPredefined()->id))
- ->orWhere('id', '=', (new Plugin())->getByField('title', 'Referenti', Models\Locale::getPredefined()->id))
- ->orWhere('id', '=', (new Plugin())->getByField('title', 'Dichiarazioni d\'intento', Models\Locale::getPredefined()->id))
+ $ignore = Plugin::where('name', 'Sedi')
+ ->orWhere('name', 'Referenti')
+ ->orWhere('name', 'Dichiarazioni d\'intento')
->get();
foreach ($ignore as $plugin) {
@@ -46,9 +46,9 @@ if (!$is_cliente && !$is_fornitore && !$is_azienda && $is_tecnico) {
}
if (!$is_cliente) {
- $ignore = Plugin::where('id', '=', (new Plugin())->getByField('title', 'Impianti del cliente', Models\Locale::getPredefined()->id))
- ->orWhere('id', '=', (new Plugin())->getByField('title', 'Contratti del cliente', Models\Locale::getPredefined()->id))
- ->orWhere('id', '=', (new Plugin())->getByField('title', 'Ddt del cliente', Models\Locale::getPredefined()->id))
+ $ignore = Plugin::where('name', 'Impianti del cliente')
+ ->orWhere('name', 'Contratti del cliente')
+ ->orWhere('name', 'Ddt del cliente')
->get();
foreach ($ignore as $plugin) {
@@ -228,7 +228,7 @@ if (in_array($id_azienda, $tipi_anagrafica)) {
- {[ "type": "select", "label": "", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC", "value": "$idzona$", "placeholder": "", "icon-after": "add|getByField('title', 'Zone', Models\Locale::getPredefined()->id); ?>" ]}
+ {[ "type": "select", "label": "", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC", "value": "$idzona$", "placeholder": "", "icon-after": "add|first()->id ?>" ]}
@@ -457,7 +457,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
- {[ "type": "select", "label": "'.tr('Relazione').'", "name": "idrelazione", "ajax-source": "relazioni", "value": "$idrelazione$", "icon-after": "add|'.(new Module())->getByField('title', 'Relazioni', Models\Locale::getPredefined()->id).'" ]}
+ {[ "type": "select", "label": "'.tr('Relazione').'", "name": "idrelazione", "ajax-source": "relazioni", "value": "$idrelazione$", "icon-after": "add|'.Module::where('name', 'Relazioni')->first()->id.'" ]}