@@ -695,7 +695,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
- {[ "type": "select", "label": "", "name": "id_settore", "ajax-source": "settori", "value": "$id_settore$", "icon-after": "add|getByField('name', 'Settori', \Models\Locale::where('predefined', true)->first()->id); ?>" ]}
+ {[ "type": "select", "label": "", "name": "id_settore", "ajax-source": "settori", "value": "$id_settore$", "icon-after": "add|getByField('name', 'Settori', \Models\Locale::getPredefined()->id); ?>" ]}
diff --git a/modules/anagrafiche/liquida_provvigioni.php b/modules/anagrafiche/liquida_provvigioni.php
index 4ab9134a1..c59cdf48c 100644
--- a/modules/anagrafiche/liquida_provvigioni.php
+++ b/modules/anagrafiche/liquida_provvigioni.php
@@ -27,7 +27,7 @@ $id_record = filter('id_record');
$dir = filter('dir');
$nome_stampa = filter('nome_stampa');
$id_print = (new PrintTemplate())->getByField('name', $nome_stampa);
-$id_module = (new Module())->getByField('name', 'Stampe contabili', \Models\Locale::where('predefined', true)->first()->id);
+$id_module = (new Module())->getByField('name', 'Stampe contabili', \Models\Locale::getPredefined()->id);
$year = (new Carbon($_SESSION['period_end']))->format('Y');
diff --git a/modules/anagrafiche/plugins/allegati.php b/modules/anagrafiche/plugins/allegati.php
index 7256d39db..db04bbad4 100755
--- a/modules/anagrafiche/plugins/allegati.php
+++ b/modules/anagrafiche/plugins/allegati.php
@@ -60,53 +60,53 @@ if (empty($_GET['visualizza_allegati'])) {
}
// Interventi dell'anagrafica
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Interventi', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $interventi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Interventi', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, `id` AS id_record, CONCAT('Intervento num. ',codice,' del ',DATE_FORMAT(`data_richiesta`,'%d/%m/%Y')) AS descrizione FROM `in_interventi` WHERE `idanagrafica`=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Interventi', \Models\Locale::getPredefined()->id), $permessi)) {
+ $interventi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Interventi', \Models\Locale::getPredefined()->id))." AS id_module, `id` AS id_record, CONCAT('Intervento num. ',codice,' del ',DATE_FORMAT(`data_richiesta`,'%d/%m/%Y')) AS descrizione FROM `in_interventi` WHERE `idanagrafica`=".prepare($id_record));
$documenti = array_merge($documenti, $interventi);
}
// Preventivi dell'anagrafica
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Preventivi', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $preventivi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Preventivi', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_preventivi WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Preventivi', \Models\Locale::getPredefined()->id), $permessi)) {
+ $preventivi = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Preventivi', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_preventivi WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $preventivi);
}
// Contratti dell'anagrafica
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Contratti', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $contratti = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Contratti', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_contratti WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Contratti', \Models\Locale::getPredefined()->id), $permessi)) {
+ $contratti = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Contratti', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Preventivo num. ',numero,' del ',DATE_FORMAT(data_bozza,'%d/%m/%Y')) AS descrizione FROM co_contratti WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $contratti);
}
// DDT dell'anagrafica
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di vendita', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $ddt_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di vendita', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Ddt di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di vendita', \Models\Locale::getPredefined()->id), $permessi)) {
+ $ddt_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di vendita', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ddt di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ddt_vendita);
}
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di acquisto', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $ddt_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di acquisto', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Ddt di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Ddt di acquisto', \Models\Locale::getPredefined()->id), $permessi)) {
+ $ddt_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ddt di acquisto', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ddt di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM dt_ddt WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ddt_acquisto);
}
// Fatture dell'anagrafica
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di vendita', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $fatture_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di vendita', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Fattura di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di vendita', \Models\Locale::getPredefined()->id), $permessi)) {
+ $fatture_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di vendita', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Fattura di vendita num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $fatture_vendita);
}
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di acquisto', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $fatture_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di acquisto', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Fattura di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Fatture di acquisto', \Models\Locale::getPredefined()->id), $permessi)) {
+ $fatture_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Fatture di acquisto', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Fattura di acquisto num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data_registrazione,'%d/%m/%Y')) AS descrizione FROM co_documenti WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $fatture_acquisto);
}
// Ordini dell'anagrafica
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini cliente', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $ordini_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini cliente', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Ordine cliente num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini cliente', \Models\Locale::getPredefined()->id), $permessi)) {
+ $ordini_vendita = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini cliente', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ordine cliente num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ordini_vendita);
}
- if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini fornitore', \Models\Locale::where('predefined', true)->first()->id), $permessi)) {
- $ordini_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini fornitore', \Models\Locale::where('predefined', true)->first()->id))." AS id_module, id AS id_record, CONCAT('Ordine fornitore num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
+ if ($user->is_admin || in_array((new Module())->getByField('name', 'Ordini fornitore', \Models\Locale::getPredefined()->id), $permessi)) {
+ $ordini_acquisto = $dbo->fetcharray('SELECT '.prepare((new Module())->getByField('name', 'Ordini fornitore', \Models\Locale::getPredefined()->id))." AS id_module, id AS id_record, CONCAT('Ordine fornitore num. ',IFNULL(numero_esterno,numero),' del ',DATE_FORMAT(data,'%d/%m/%Y')) AS descrizione FROM or_ordini WHERE idanagrafica=".prepare($id_record));
$documenti = array_merge($documenti, $ordini_acquisto);
}
diff --git a/modules/anagrafiche/src/Anagrafica.php b/modules/anagrafiche/src/Anagrafica.php
index 4ee59e8e3..eaa65f590 100755
--- a/modules/anagrafiche/src/Anagrafica.php
+++ b/modules/anagrafiche/src/Anagrafica.php
@@ -156,7 +156,7 @@ class Anagrafica extends Model
public function setTipologieAttribute(array $tipologie)
{
if ($this->isAzienda()) {
- $tipologie[] = (new TipoAnagrafica())->getByField('name', 'Azienda', \Models\Locale::where('predefined', true)->first()->id);
+ $tipologie[] = (new TipoAnagrafica())->getByField('name', 'Azienda', \Models\Locale::getPredefined()->id);
}
$tipologie = array_clean($tipologie);
diff --git a/modules/anagrafiche/src/Import/CSV.php b/modules/anagrafiche/src/Import/CSV.php
index 4b285d5c4..0ace5659e 100644
--- a/modules/anagrafiche/src/Import/CSV.php
+++ b/modules/anagrafiche/src/Import/CSV.php
@@ -280,7 +280,7 @@ class CSV extends CSVImporter
// Fix per campi con contenuti derivati da query implicite
if (!empty($record['id_nazione'])) {
- $record['id_nazione'] = (new Nazione())->getByField('name', 'Italia', \Models\Locale::where('predefined', true)->first()->id);
+ $record['id_nazione'] = (new Nazione())->getByField('name', 'Italia', \Models\Locale::getPredefined()->id);
} else {
unset($record['id_nazione']);
}
diff --git a/modules/articoli/add.php b/modules/articoli/add.php
index 9bed32e7b..59a3bf0f3 100755
--- a/modules/articoli/add.php
+++ b/modules/articoli/add.php
@@ -46,11 +46,11 @@ $aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);
- {[ "type": "select", "label": "", "name": "categoria", "required": 0, "ajax-source": "categorie", "icon-after": "add|getByField('name', 'Categorie articoli', \Models\Locale::where('predefined', true)->first()->id); ?>" ]}
+ {[ "type": "select", "label": "", "name": "categoria", "required": 0, "ajax-source": "categorie", "icon-after": "add|getByField('name', 'Categorie articoli', \Models\Locale::getPredefined()->id); ?>" ]}
- {[ "type": "select", "label": "", "name": "subcategoria", "id": "subcategoria_add", "ajax-source": "sottocategorie", "icon-after": "add|getByField('name', 'Categorie articoli', \Models\Locale::where('predefined', true)->first()->id); ?>||hide" ]}
+ {[ "type": "select", "label": "", "name": "subcategoria", "id": "subcategoria_add", "ajax-source": "sottocategorie", "icon-after": "add|getByField('name', 'Categorie articoli', \Models\Locale::getPredefined()->id); ?>||hide" ]}
@@ -104,7 +104,7 @@ $aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);