1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-19 20:00:29 +01:00

Aggiunta tabella mg_categorie_lang

This commit is contained in:
Pek5892 2024-03-01 09:08:08 +01:00
parent 026127d7b3
commit 9073633705
13 changed files with 145 additions and 42 deletions

View File

@ -29,8 +29,8 @@ $fields = [
'Codice' => 'codice',
'Barcode' => 'barcode',
'Descrizione' => 'descrizione',
'Categoria' => '(SELECT `nome` FROM `mg_categorie` WHERE `mg_categorie`.`id` = `mg_articoli`.`id_categoria`)',
'Subcategoria' => '(SELECT `nome` FROM `mg_categorie` WHERE `mg_categorie`.`id` = `mg_articoli`.`id_sottocategoria`)',
'Categoria' => '(SELECT `name` FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `mg_categorie`.`id` = `mg_articoli`.`id_categoria`)',
'Subcategoria' => '(SELECT `name` FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `mg_categorie`.`id` = `mg_articoli`.`id_sottocategoria`)',
'Note' => 'note',
];

View File

@ -100,7 +100,9 @@ switch ($resource) {
`mg_articoli`
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli`.`id` = `mg_articoli_lang`.`id_record` AND `mg_articoli_lang`.`id_lang` = ".prepare(setting('Lingua')).")
LEFT JOIN `mg_categorie` AS categoria ON `categoria`.`id` = `mg_articoli`.`id_categoria`
LEFT JOIN `mg_categorie_lang` AS categoria_lang ON (`categoria`.`id` = `categoria_lang`.`id_record` AND `categoria_lang`.`id_lang` = ".prepare(setting('Lingua')).")
LEFT JOIN `mg_categorie` AS sottocategoria ON `sottocategoria`.`id` = `mg_articoli`.`id_sottocategoria`
LEFT JOIN `mg_categorie_lang` AS sottocategoria_lang ON (`sottocategoria`.`id` = `sottocategoria_lang`.`id_record` AND `sottocategoria_lang`.`id_lang` = ".prepare(setting('Lingua')).")
LEFT JOIN `co_pianodeiconti3` AS conto_vendita_sottocategoria ON `conto_vendita_sottocategoria`.`id`=`mg_articoli`.`idconto_vendita`
LEFT JOIN `co_pianodeiconti2` AS conto_vendita_categoria ON `conto_vendita_sottocategoria`.`idpianodeiconti2`=`conto_vendita_categoria`.`id`
LEFT JOIN `co_pianodeiconti3` AS conto_acquisto_sottocategoria ON `conto_acquisto_sottocategoria`.`id`=`mg_articoli`.`idconto_acquisto`
@ -217,16 +219,16 @@ switch ($resource) {
break;
case 'categorie':
$query = 'SELECT `id`, `nome` AS descrizione FROM `mg_categorie` |where| ORDER BY `nome`';
$query = 'SELECT `mg_categorie`.`id`, `name` AS descrizione FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).') |where| ORDER BY `name`';
foreach ($elements as $element) {
$filter[] = '`id`='.prepare($element);
$filter[] = '`mg_categorie`.`id`='.prepare($element);
}
$where[] = '`parent` IS NULL';
if (!empty($search)) {
$search_fields[] = '`nome` LIKE '.prepare('%'.$search.'%');
$search_fields[] = '`name` LIKE '.prepare('%'.$search.'%');
}
break;
@ -237,16 +239,16 @@ switch ($resource) {
*/
case 'sottocategorie':
if (isset($superselect['id_categoria'])) {
$query = 'SELECT `id`, `nome` AS descrizione FROM `mg_categorie` |where| ORDER BY `nome`';
$query = 'SELECT `mg_categorie`.`id`, `name` AS descrizione FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).') |where| ORDER BY `name`';
foreach ($elements as $element) {
$filter[] = '`id`='.prepare($element);
$filter[] = '`mg_categorie`.`id`='.prepare($element);
}
$where[] = '`parent`='.prepare($superselect['id_categoria']);
if (!empty($search)) {
$search_fields[] = '`nome` LIKE '.prepare('%'.$search.'%');
$search_fields[] = '`name` LIKE '.prepare('%'.$search.'%');
}
}
break;

View File

@ -48,12 +48,25 @@ class Articoli extends Resource implements RetrieveInterface, UpdateInterface, C
'mg_articoli.id_categoria',
'categorie.id',
];
$joins[] = [
'mg_categorie_lang AS categorie_lang',
'mg_categorie.id',
'categorie_lang.id_record',
];
$joins[] = [
'mg_categorie AS sottocategorie',
'mg_articoli.id_sottocategoria',
'sottocategorie.id',
];
$joins[] = [
'mg_categorie_lang AS sottocategorie_lang',
'mg_categorie.id',
'sottocategorie_lang.id_record',
];
$where[] = ['mg_articoli.deleted_at', '=', null];
$whereraw = [];

View File

@ -45,4 +45,34 @@ class Categoria extends Model
{
return $this->hasMany(Articolo::class, 'id_categoria');
}
/**
* Ritorna l'attributo name della categoria articolo.
*
* @return string
*/
public function getNameAttribute()
{
return database()->table($this->table.'_lang')
->select('name')
->where('id_record', '=', $this->id)
->where('id_lang', '=', setting('Lingua'))
->first()->name;
}
/**
* Ritorna l'id della categoria articolo a partire dal nome.
*
* @param string $name il nome da ricercare
*
* @return \Illuminate\Support\Collection
*/
public function getByName($name)
{
return database()->table($this->table.'_lang')
->select('id_record')
->where('name', '=', $name)
->where('id_lang', '=', setting('Lingua'))
->first();
}
}

View File

@ -30,11 +30,16 @@ switch (filter('op')) {
$database->table('mg_categorie')
->where('id', '=', $id_record)
->update([
'nome' => $nome,
'nota' => $nota,
'colore' => $colore,
]);
$database->table('mg_categorie_lang')
->where('id_record', '=', $id_record)
->update([
'name' => $nome,
]);
flash()->info(tr('Salvataggio completato!'));
} else {
flash()->error(tr('Ci sono stati alcuni errori durante il salvataggio!'));
@ -58,7 +63,8 @@ switch (filter('op')) {
// Ricerca corrispondenze con stesso nome
$corrispondenze = $database->table('mg_categorie')
->where('nome', '=', $nome);
->join('mg_categorie_lang', 'mg_categorie.id', '=', 'mg_categorie_lang.id_record')
->where('name', '=', $nome);
if (!empty($id_original)) {
$corrispondenze = $corrispondenze->where('parent', '=', $id_original);
} else {
@ -70,12 +76,18 @@ switch (filter('op')) {
if ($corrispondenze->count() == 0) {
$id_record = $database->table('mg_categorie')
->insertGetId([
'nome' => $nome,
'nota' => $nota,
'colore' => $colore,
'parent' => $id_original,
]);
$database->table('mg_categorie_lang')
->insertGetId([
'id_record' => $id_record,
'name' => $nome,
'id_lang' => setting('Lingua'),
]);
flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [
'_TYPE_' => 'categoria',
]));

View File

@ -32,7 +32,7 @@ include_once __DIR__.'/../../core.php';
<div class="panel-body">
<div class="row">
<div class="col-md-8">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$nome$" ]}
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$name$" ]}
</div>
<div class="col-md-4">
@ -91,7 +91,7 @@ include_once __DIR__.'/../../core.php';
<?php
$elementi = $dbo->fetchArray('SELECT `mg_articoli`.`id`, `mg_articoli`.`codice`, `mg_articoli`.`barcode` FROM `mg_articoli` WHERE (`id_categoria`='.prepare($id_record).' OR `id_sottocategoria`='.prepare($id_record).' OR `id_sottocategoria` IN (SELECT id FROM `mg_categorie` WHERE `parent`='.prepare($id_record).')) AND `deleted_at` IS NULL');
$elementi = $dbo->fetchArray('SELECT `mg_articoli`.`id`, `mg_articoli`.`codice`, `mg_articoli`.`barcode` FROM `mg_articoli` WHERE (`id_categoria`='.prepare($id_record).' OR `id_sottocategoria`='.prepare($id_record).' OR `id_sottocategoria` IN (SELECT `id` FROM `mg_categorie` WHERE `parent`='.prepare($id_record).')) AND `deleted_at` IS NULL');
if (!empty($elementi)) {
echo '

View File

@ -20,5 +20,5 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `mg_categorie` WHERE id='.prepare($id_record));
$record = $dbo->fetchOne('SELECT * FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id`=`mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang`='.prepare(setting('Lingua')).') WHERE `mg_categorie`.`id`='.prepare($id_record));
}

View File

@ -19,13 +19,13 @@
include_once __DIR__.'/../../core.php';
$subcategorie = $dbo->fetchArray('SELECT * FROM `mg_categorie` WHERE `parent`='.prepare($id_record).' ORDER BY nome ASC ');
$subcategorie = $dbo->fetchArray('SELECT * FROM `mg_categorie` LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id`=`mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang`='.prepare(setting('Lingua')).') WHERE `parent`='.prepare($id_record).' ORDER BY `name` ASC ');
foreach ($subcategorie as $sub) {
$n_articoli = $dbo->fetchNum('SELECT * FROM `mg_articoli` LEFT JOIN `mg_articoli_lang` ON (`mg_articoli`.`id` = `mg_articoli_lang`.`id_record` AND `mg_articoli_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `id_sottocategoria`='.prepare($sub['id']).' AND deleted_at IS NULL');
echo '
<tr>
<td>'.$sub['nome'].'</td>
<td>'.$sub['name'].'</td>
<td>'.$sub['colore'].'</td>
<td>'.$sub['nota'].'</td>
<td>

View File

@ -55,11 +55,15 @@ class Articoli extends AppResource
`mg_articoli`.`qta`,
`mg_articoli`.`um`,
`mg_articoli`.`idiva_vendita` AS id_iva,
(SELECT `nome` FROM `mg_categorie` WHERE `id` = `mg_articoli`.`id_categoria`) AS categoria,
(SELECT `nome` FROM `mg_categorie` WHERE `id` = `mg_articoli`.`id_sottocategoria`) AS sottocategoria
`categoria_lang`.`name` AS categoria,
`sottocategoria_lang`.`name` AS sottocategoria
FROM
`mg_articoli`
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli`.`id` = `mg_articoli_lang`.`id_record` AND `mg_articoli_lang`.`id_lang` = '.prepare(setting('Lingua')).')
LEFT JOIN `mg_categorie` as categoria ON (`mg_articoli`.`id_categoria` = `mg_categorie`.`id`)
LEFT JOIN `mg_categorie_lang` as categoria_lang ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).')
LEFT JOIN `mg_categorie` as sottocategoria ON (`mg_articoli`.`id_sottocategoria` = `mg_categorie`.`id`)
LEFT JOIN `mg_categorie_lang` as sottocategoria_lang ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).')
WHERE
`mg_articoli`.`id` = '.prepare($id);

View File

@ -34,7 +34,7 @@ $query = "
`mg_articoli`.`codice`,
`mg_articoli`.`prezzo_vendita`,
`co_iva`.`percentuale` AS iva,
`mg_categorie`.`nome` AS subcategoria,
`mg_categorie_lang`.`name` AS subcategoria,
`mg_articoli_lang`.`name` AS descrizione,
`mg_movimenti`.`qta`,
`mg_movimenti`.`idutente`,
@ -50,6 +50,7 @@ $query = "
INNER JOIN `an_sedi` ON `mg_movimenti`.`idsede`=`an_sedi`.`id`
LEFT JOIN `co_iva_lang` ON (`co_iva`.`id` = `co_iva_lang`.`id_record` AND `co_iva_lang`.`id_lang` = ".prepare(setting('Lingua')).")
LEFT JOIN `mg_categorie` ON `mg_categorie`.`id`=`mg_articoli`.`id_sottocategoria`
LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id`=`mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = ".prepare(setting('Lingua')).")
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli`.`id`=`mg_articoli_lang`.`id_record` AND `mg_articoli_lang`.`id_lang` = ".prepare(setting('Lingua')).")
WHERE
`mg_movimenti`.`qta`>0 AND (`mg_movimenti`.`idsede` > 0) AND (`mg_movimenti`.`idintervento` IS NULL) AND

View File

@ -40,7 +40,7 @@ $query = 'SELECT
`an_sedi`.`nome`,
`mg_articoli`.`codice`,
`mg_articoli_lang`.`name` as descrizione,
`mg_categorie`.`nome` AS subcategoria,
`mg_categorie_lang`.`name` AS subcategoria,
SUM(`mg_movimenti`.`qta`) AS qta,
`mg_articoli`.`um`
FROM
@ -49,10 +49,11 @@ $query = 'SELECT
INNER JOIN `mg_articoli` ON `mg_movimenti`.`idarticolo` = `mg_articoli`.`id`
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli`.`id`=`mg_articoli_lang`.`id_record` AND `mg_articoli_lang`.`id_lang` = '.prepare(setting('Lingua')).')
LEFT JOIN `mg_categorie` ON `mg_categorie`.`id` = `mg_articoli`.`id_sottocategoria`
LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id`=`mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.`id_lang` = '.prepare(setting('Lingua')).')
WHERE
'.implode(' AND ', $where).'
GROUP BY
`an_sedi`.`targa`, `an_sedi`.`nome`, `an_sedi`.`descrizione`, `mg_articoli`.`codice`, `mg_articoli_lang`.`name`, `mg_categorie`.`nome`, `mg_articoli`.`um`
`an_sedi`.`targa`, `an_sedi`.`nome`, `an_sedi`.`descrizione`, `mg_articoli`.`codice`, `mg_articoli_lang`.`name`, `mg_categorie_lang`.`name`, `mg_articoli`.`um`
ORDER BY
`an_sedi`.`targa`, `an_sedi`.`descrizione`';

View File

@ -1427,27 +1427,6 @@ ALTER TABLE `mg_articoli`
ALTER TABLE `mg_articoli_lang` ADD CONSTRAINT `mg_articoli_lang_ibfk_1` FOREIGN KEY (`id_record`) REFERENCES `mg_articoli`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
-- Allineamento vista Articoli
UPDATE `zz_modules` SET `options` = "
SELECT
|select|
FROM
`mg_articoli`
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli_lang`.`id_record` = `mg_articoli`.`id` AND `mg_articoli_lang`.|lang|)
LEFT JOIN `an_anagrafiche` ON `mg_articoli`.`id_fornitore` = `an_anagrafiche`.`idanagrafica`
LEFT JOIN `co_iva` ON `mg_articoli`.`idiva_vendita` = `co_iva`.`id`
LEFT JOIN (SELECT SUM(`or_righe_ordini`.`qta` - `or_righe_ordini`.`qta_evasa`) AS qta_impegnata, `or_righe_ordini`.`idarticolo` FROM `or_righe_ordini` INNER JOIN `or_ordini` ON `or_righe_ordini`.`idordine` = `or_ordini`.`id` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id` INNER JOIN `or_statiordine` ON `or_ordini`.`idstatoordine` = `or_statiordine`.`id` WHERE `or_tipiordine`.`dir` = 'entrata' AND `or_righe_ordini`.`confermato` = 1 AND `or_statiordine`.`impegnato` = 1 GROUP BY `idarticolo`) a ON `a`.`idarticolo` = `mg_articoli`.`id`
LEFT JOIN (SELECT SUM(`or_righe_ordini`.`qta` - `or_righe_ordini`.`qta_evasa`) AS qta_ordinata, `or_righe_ordini`.`idarticolo` FROM `or_righe_ordini` INNER JOIN `or_ordini` ON `or_righe_ordini`.`idordine` = `or_ordini`.`id` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id` INNER JOIN `or_statiordine` ON `or_ordini`.`idstatoordine` = `or_statiordine`.`id` WHERE `or_tipiordine`.`dir` = 'uscita' AND `or_righe_ordini`.`confermato` = 1 AND `or_statiordine`.`impegnato` = 1
GROUP BY `idarticolo`) ordini_fornitore ON `ordini_fornitore`.`idarticolo` = `mg_articoli`.`id`
LEFT JOIN `mg_categorie` ON `mg_articoli`.`id_categoria` = `mg_categorie`.`id`
LEFT JOIN `mg_categorie` AS sottocategorie ON `mg_articoli`.`id_sottocategoria` = `sottocategorie`.`id`
LEFT JOIN (SELECT `co_iva`.`percentuale` AS perc, `co_iva`.`id`, `zz_settings`.`nome` FROM `co_iva` INNER JOIN `zz_settings` ON `co_iva`.`id`=`zz_settings`.`valore`)AS iva ON `iva`.`nome`= 'Iva predefinita'
WHERE
1=1 AND(`mg_articoli`.`deleted_at`) IS NULL
HAVING
2=2
ORDER BY
`mg_articoli_lang`.`name`" WHERE `name` = 'Articoli';
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`mg_articoli_lang`.`name`' WHERE `zz_modules`.`name` = 'Articoli' AND `zz_views`.`name` = 'Descrizione';
-- Aggiunta tabella mg_attributi_lang
@ -1497,3 +1476,63 @@ WHERE
`mg_combinazioni`.`deleted_at` IS NULL
HAVING
2=2" WHERE `name` = 'Combinazioni';
-- Aggiunta tabella mg_categorie_lang
CREATE TABLE IF NOT EXISTS `mg_categorie_lang` (
`id` int NOT NULL,
`id_lang` int NOT NULL,
`id_record` int NOT NULL,
`name` VARCHAR(255) NOT NULL
);
ALTER TABLE `mg_categorie_lang`
ADD PRIMARY KEY (`id`);
ALTER TABLE `mg_categorie_lang`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
INSERT INTO `mg_categorie_lang` (`id`, `id_lang`, `id_record`, `name`) SELECT NULL, (SELECT `id` FROM `zz_langs` WHERE `iso_code` = 'it'), `id`, `nome` FROM `mg_categorie`;
ALTER TABLE `mg_categorie`
DROP `nome`;
ALTER TABLE `mg_categorie_lang` ADD CONSTRAINT `mg_categorie_lang_ibfk_1` FOREIGN KEY (`id_record`) REFERENCES `mg_categorie`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
-- Allineamento vista Categorie articoli
UPDATE `zz_modules` SET `options` = "
SELECT
|select|
FROM
`mg_categorie`
LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.|lang|)
WHERE
1=1 AND `parent` IS NULL
HAVING
2=2" WHERE `name` = 'Categorie articoli';
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`mg_categorie_lang`.`name`' WHERE `zz_modules`.`name` = 'Categorie articoli' AND `zz_views`.`name` = 'Nome';
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`mg_categorie`.`id`' WHERE `zz_modules`.`name` = 'Categorie articoli' AND `zz_views`.`name` = 'id';
-- Allineamento vista Articoli
UPDATE `zz_modules` SET `options` = "
SELECT
|select|
FROM
`mg_articoli`
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli_lang`.`id_record` = `mg_articoli`.`id` AND `mg_articoli_lang`.|lang|)
LEFT JOIN `an_anagrafiche` ON `mg_articoli`.`id_fornitore` = `an_anagrafiche`.`idanagrafica`
LEFT JOIN `co_iva` ON `mg_articoli`.`idiva_vendita` = `co_iva`.`id`
LEFT JOIN (SELECT SUM(`or_righe_ordini`.`qta` - `or_righe_ordini`.`qta_evasa`) AS qta_impegnata, `or_righe_ordini`.`idarticolo` FROM `or_righe_ordini` INNER JOIN `or_ordini` ON `or_righe_ordini`.`idordine` = `or_ordini`.`id` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id` INNER JOIN `or_statiordine` ON `or_ordini`.`idstatoordine` = `or_statiordine`.`id` WHERE `or_tipiordine`.`dir` = 'entrata' AND `or_righe_ordini`.`confermato` = 1 AND `or_statiordine`.`impegnato` = 1 GROUP BY `idarticolo`) a ON `a`.`idarticolo` = `mg_articoli`.`id`
LEFT JOIN (SELECT SUM(`or_righe_ordini`.`qta` - `or_righe_ordini`.`qta_evasa`) AS qta_ordinata, `or_righe_ordini`.`idarticolo` FROM `or_righe_ordini` INNER JOIN `or_ordini` ON `or_righe_ordini`.`idordine` = `or_ordini`.`id` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id` INNER JOIN `or_statiordine` ON `or_ordini`.`idstatoordine` = `or_statiordine`.`id` WHERE `or_tipiordine`.`dir` = 'uscita' AND `or_righe_ordini`.`confermato` = 1 AND `or_statiordine`.`impegnato` = 1
GROUP BY `idarticolo`) ordini_fornitore ON `ordini_fornitore`.`idarticolo` = `mg_articoli`.`id`
LEFT JOIN `mg_categorie` ON `mg_articoli`.`id_categoria` = `mg_categorie`.`id`
LEFT JOIN `mg_categorie_lang` ON (`mg_categorie`.`id` = `mg_categorie_lang`.`id_record` AND `mg_categorie_lang`.|lang|)
LEFT JOIN `mg_categorie` AS sottocategorie ON `mg_articoli`.`id_sottocategoria` = `sottocategorie`.`id`
LEFT JOIN `mg_categorie_lang` AS sottocategorie_lang ON (`sottocategorie`.`id` = `sottocategorie_lang`.`id_record` AND `sottocategorie_lang`.|lang|)
LEFT JOIN (SELECT `co_iva`.`percentuale` AS perc, `co_iva`.`id`, `zz_settings`.`nome` FROM `co_iva` INNER JOIN `zz_settings` ON `co_iva`.`id`=`zz_settings`.`valore`)AS iva ON `iva`.`nome`= 'Iva predefinita'
WHERE
1=1 AND(`mg_articoli`.`deleted_at`) IS NULL
HAVING
2=2
ORDER BY
`mg_articoli_lang`.`name`" WHERE `name` = 'Articoli';
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`mg_categorie_lang`.`name`' WHERE `zz_modules`.`name` = 'Articoli' AND `zz_views`.`name` = 'Categoria';
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`mg_categorie_lang`.`name`' WHERE `zz_modules`.`name` = 'Articoli' AND `zz_views`.`name` = 'Sottocategoria';

View File

@ -121,6 +121,7 @@ return [
'mg_articoli_lang',
'mg_fornitore_articolo',
'mg_categorie',
'mg_categorie_lang',
'mg_causali_movimenti',
'mg_listini',
'mg_listini_articoli',