mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 14:57:46 +01:00
Aggiunta tabella mg_attributi_lang
This commit is contained in:
parent
8cecb9c4eb
commit
026127d7b3
12
editor.php
12
editor.php
@ -41,19 +41,21 @@ if (!empty($id_record)) {
|
|||||||
}
|
}
|
||||||
// Rimozione della condizione deleted_at IS NULL per visualizzare anche i record eliminati
|
// Rimozione della condizione deleted_at IS NULL per visualizzare anche i record eliminati
|
||||||
if (!empty($query)) {
|
if (!empty($query)) {
|
||||||
if (preg_match('/[`]*([a-z0-9_]*)[`]*[\.]*([`]*deleted_at[`]* IS NULL)/i', $query, $m)) {
|
if (preg_match('/[`]*([a-z0-9_]*)[`]*[\.]*([`]*deleted_at[`]* IS NULL)/si', $query, $m)) {
|
||||||
|
$query = str_replace(["\n", "\t"], ' ', $query);
|
||||||
$conditions_to_remove = [];
|
$conditions_to_remove = [];
|
||||||
|
|
||||||
$condition = trim($m[0]);
|
$condition = trim($m[0]);
|
||||||
|
|
||||||
if (!empty($table_name)) {
|
if (!empty($table_name)) {
|
||||||
$condition = $table_name.'.'.$condition;
|
$condition = $table_name.'.'.$condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
$conditions_to_remove[] = ' AND '.$condition;
|
$conditions_to_remove[] = ' AND\s*'.$condition;
|
||||||
$conditions_to_remove[] = $condition.' AND ';
|
$conditions_to_remove[] = $condition.'\s*AND ';
|
||||||
|
|
||||||
$query = str_replace($conditions_to_remove, '', $query);
|
foreach ($conditions_to_remove as $condition_to_remove) {
|
||||||
|
$query = preg_replace('/'.$condition_to_remove.'/si', '', $query);
|
||||||
|
}
|
||||||
$query = str_replace($condition, '', $query);
|
$query = str_replace($condition, '', $query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,11 +227,12 @@ class Articolo extends Model
|
|||||||
public function getNomeVarianteAttribute()
|
public function getNomeVarianteAttribute()
|
||||||
{
|
{
|
||||||
$valori = database()->fetchArray("SELECT
|
$valori = database()->fetchArray("SELECT
|
||||||
CONCAT(`mg_attributi`.`titolo`, ': ', `mg_valori_attributi`.`nome`) AS nome
|
CONCAT(`mg_attributi_lang`.`title`, ': ', `mg_valori_attributi`.`nome`) AS nome
|
||||||
FROM
|
FROM
|
||||||
`mg_articolo_attributo`
|
`mg_articolo_attributo`
|
||||||
INNER JOIN `mg_valori_attributi` ON `mg_valori_attributi`.`id` = `mg_articolo_attributo`.`id_valore`
|
INNER JOIN `mg_valori_attributi` ON `mg_valori_attributi`.`id` = `mg_articolo_attributo`.`id_valore`
|
||||||
INNER JOIN `mg_attributi` ON `mg_attributi`.`id` = `mg_valori_attributi`.`id_attributo`
|
INNER JOIN `mg_attributi` ON `mg_attributi`.`id` = `mg_valori_attributi`.`id_attributo`
|
||||||
|
LEFT JOIN `mg_attributi_lang` ON (`mg_attributi_lang`.`id_record` = `mg_attributi`.`id` AND `mg_attributi_lang`.`id_lang` = ".prepare(setting('Lingua')).")
|
||||||
INNER JOIN `mg_articoli` ON `mg_articoli`.`id` = `mg_articolo_attributo`.`id_articolo`
|
INNER JOIN `mg_articoli` ON `mg_articoli`.`id` = `mg_articolo_attributo`.`id_articolo`
|
||||||
INNER JOIN `mg_combinazioni` ON `mg_combinazioni`.`id` = `mg_articoli`.`id_combinazione`
|
INNER JOIN `mg_combinazioni` ON `mg_combinazioni`.`id` = `mg_articoli`.`id_combinazione`
|
||||||
INNER JOIN `mg_attributo_combinazione` ON `mg_attributo_combinazione`.`id_combinazione` = `mg_combinazioni`.`id` AND `mg_attributo_combinazione`.`id_attributo` = `mg_attributi`.`id`
|
INNER JOIN `mg_attributo_combinazione` ON `mg_attributo_combinazione`.`id_combinazione` = `mg_combinazioni`.`id` AND `mg_attributo_combinazione`.`id_attributo` = `mg_attributi`.`id`
|
||||||
|
@ -1,23 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
use Modules\AttributiCombinazioni\Attributo;
|
use Modules\AttributiCombinazioni\Attributo;
|
||||||
use Modules\AttributiCombinazioni\ValoreAttributo;
|
use Modules\AttributiCombinazioni\ValoreAttributo;
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
|
||||||
|
|
||||||
switch (filter('op')) {
|
switch (filter('op')) {
|
||||||
case 'add':
|
case 'add':
|
||||||
$nome = post('nome');
|
$nome = post('nome');
|
||||||
$esistente = Attributo::where('nome', '=', $nome)->count() !== 0;
|
$esistente = (new Attributo())->getByName(post('nome'));
|
||||||
|
|
||||||
if (!$esistente) {
|
if (!$esistente) {
|
||||||
$attributo = Attributo::build();
|
$attributo = Attributo::build();
|
||||||
$attributo->nome = $nome;
|
|
||||||
$attributo->titolo = post('titolo');
|
|
||||||
$attributo->save();
|
$attributo->save();
|
||||||
|
|
||||||
$id_record = $attributo->id;
|
$id_record = $attributo->id;
|
||||||
|
|
||||||
|
$database->query('INSERT INTO `mg_attributi_lang` (`id_record`, `id_lang`, `name`, `title`) VALUES ('.$id_record.', '.setting('Lingua').', \''.post('nome').'\', \''.post('titolo').'\')');
|
||||||
|
|
||||||
flash()->info(tr('Nuovo attributo creato correttamente!'));
|
flash()->info(tr('Nuovo attributo creato correttamente!'));
|
||||||
} else {
|
} else {
|
||||||
flash()->error(tr('Attributo esistente con lo stesso nome!'));
|
flash()->error(tr('Attributo esistente con lo stesso nome!'));
|
||||||
@ -26,7 +43,7 @@ switch (filter('op')) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
$attributo->titolo = post('titolo');
|
|
||||||
$attributo->save();
|
$attributo->save();
|
||||||
|
|
||||||
flash()->info(tr('Attributo aggiornato correttamente!'));
|
flash()->info(tr('Attributo aggiornato correttamente!'));
|
||||||
|
@ -1,4 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
include_once __DIR__.'/init.php';
|
include_once __DIR__.'/init.php';
|
||||||
|
|
||||||
|
@ -1,4 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
@ -15,11 +33,11 @@ echo '
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "span", "label": "'.tr('Nome').'", "name": "nome", "value": "'.$attributo->nome.'", "help": "'.tr("Nome univoco dell'attributo").'" ]}
|
{[ "type": "span", "label": "'.tr('Nome').'", "name": "nome", "value": "'.$attributo->name.'", "help": "'.tr("Nome univoco dell'attributo").'" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "value": "'.$attributo->titolo.'", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
|
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "value": "'.$attributo->title.'", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,9 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
use Modules\AttributiCombinazioni\ValoreAttributo;
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
|
use Modules\AttributiCombinazioni\ValoreAttributo;
|
||||||
|
|
||||||
$id_valore = filter('id_valore');
|
$id_valore = filter('id_valore');
|
||||||
$testo_valore = '';
|
$testo_valore = '';
|
||||||
if (!empty($id_valore)) {
|
if (!empty($id_valore)) {
|
||||||
|
@ -1,10 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
use Modules\AttributiCombinazioni\Attributo;
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
if (!empty($id_record)) {
|
use Modules\AttributiCombinazioni\Attributo;
|
||||||
|
|
||||||
|
if (isset($id_record)) {
|
||||||
$attributo = Attributo::find($id_record);
|
$attributo = Attributo::find($id_record);
|
||||||
|
|
||||||
$record = $attributo->toArray();
|
$record = $attributo->toArray();
|
||||||
|
@ -18,4 +18,49 @@ class Attributo extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(ValoreAttributo::class, 'id_attributo');
|
return $this->hasMany(ValoreAttributo::class, 'id_attributo');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna l'attributo name dell'attributo.
|
||||||
|
*
|
||||||
|
* @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'attributo title dell'attributo.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTitleAttribute()
|
||||||
|
{
|
||||||
|
return database()->table($this->table.'_lang')
|
||||||
|
->select('title')
|
||||||
|
->where('id_record', '=', $this->id)
|
||||||
|
->where('id_lang', '=', setting('Lingua'))
|
||||||
|
->first()->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna l'id dell'attributo 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ $attributi = $combinazione->attributi;
|
|||||||
foreach ($attributi as $key => $attributo) {
|
foreach ($attributi as $key => $attributo) {
|
||||||
echo '
|
echo '
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{[ "type": "select", "label": "'.$attributo->nome.'", "name": "attributo['.$key.']", "values": "query=SELECT id, nome AS descrizione FROM mg_valori_attributi WHERE id_attributo = '.prepare($attributo->id).' AND deleted_at IS NULL", "required": 1 ]}
|
{[ "type": "select", "label": "'.$attributo->name.'", "name": "attributo['.$key.']", "values": "query=SELECT id, nome AS descrizione FROM mg_valori_attributi WHERE id_attributo = '.prepare($attributo->id).' AND deleted_at IS NULL", "required": 1 ]}
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ echo '
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "select", "label": "'.tr('Attributi').'", "name": "attributi[]", "values": "query=SELECT id, nome AS descrizione FROM mg_attributi WHERE deleted_at IS NULL", "required": 1, "multiple": 1, "help": "'.tr('Attributi abilitati per la combinazione corrente').'" ]}
|
{[ "type": "select", "label": "'.tr('Attributi').'", "name": "attributi[]", "values": "query=SELECT `mg_attributi`.`id`, `mg_attributi_lang`.`name` AS descrizione FROM `mg_attributi` LEFT JOIN `mg_attributi_lang` ON (`mg_attributi_lang`.`id_record` = `mg_attributi`.`id` AND `mg_attributi_lang`.`id_lang` = '.setting('Lingua').') WHERE `deleted_at` IS NULL", "required": 1, "multiple": 1, "help": "'.tr('Attributi abilitati per la combinazione corrente').'" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ foreach ($attributi as $key => $attributo) {
|
|||||||
$value = $dbo->fetchOne('SELECT mg_valori_attributi.id AS valore FROM mg_valori_attributi LEFT JOIN mg_articolo_attributo ON mg_articolo_attributo.id_valore=mg_valori_attributi.id WHERE id_articolo='.prepare(get('id_articolo')).' AND id_attributo='.prepare($attributo->id).' AND deleted_at IS NULL')['valore'];
|
$value = $dbo->fetchOne('SELECT mg_valori_attributi.id AS valore FROM mg_valori_attributi LEFT JOIN mg_articolo_attributo ON mg_articolo_attributo.id_valore=mg_valori_attributi.id WHERE id_articolo='.prepare(get('id_articolo')).' AND id_attributo='.prepare($attributo->id).' AND deleted_at IS NULL')['valore'];
|
||||||
echo '
|
echo '
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{[ "type": "select", "label": "'.$attributo->nome.'", "name": "attributo['.$key.']", "values": "query=SELECT id, nome AS descrizione FROM mg_valori_attributi WHERE id_attributo = '.prepare($attributo->id).' AND deleted_at IS NULL", "value": "'.$value.'", "required": 1 ]}
|
{[ "type": "select", "label": "'.$attributo->name.'", "name": "attributo['.$key.']", "values": "query=SELECT id, nome AS descrizione FROM mg_valori_attributi WHERE id_attributo = '.prepare($attributo->id).' AND deleted_at IS NULL", "value": "'.$value.'", "required": 1 ]}
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
|
@ -42,7 +42,7 @@ echo '
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "select", "label": "'.tr('Attributi').'", "name": "attributi[]", "value": "'.implode(',', $combinazione->attributi->pluck('id')->all()).'", "values": "query=SELECT id, nome AS descrizione FROM mg_attributi WHERE deleted_at IS NULL", "required": 1, "multiple": 1, "help": "'.tr('Attributi abilitati per la combinazione corrente').'" ]}
|
{[ "type": "select", "label": "'.tr('Attributi').'", "name": "attributi[]", "value": "'.implode(',', $combinazione->attributi->pluck('id')->all()).'", "values": "query=SELECT `mg_attributi`.`id`, `mg_attributi_lang`.`name` AS descrizione FROM `mg_attributi` LEFT JOIN `mg_attributi_lang` ON (`mg_attributi_lang`.`id_record` = `mg_attributi`.`id` AND `mg_attributi_lang`.`id_lang` = '.setting('Lingua').') WHERE `deleted_at` IS NULL", "required": 1, "multiple": 1, "help": "'.tr('Attributi abilitati per la combinazione corrente').'" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1425,6 +1425,8 @@ INSERT INTO `mg_articoli_lang` (`id`, `id_lang`, `id_record`, `name`) SELECT NUL
|
|||||||
ALTER TABLE `mg_articoli`
|
ALTER TABLE `mg_articoli`
|
||||||
DROP `descrizione`;
|
DROP `descrizione`;
|
||||||
|
|
||||||
|
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
|
-- Allineamento vista Articoli
|
||||||
UPDATE `zz_modules` SET `options` = "
|
UPDATE `zz_modules` SET `options` = "
|
||||||
SELECT
|
SELECT
|
||||||
@ -1447,3 +1449,51 @@ HAVING
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
`mg_articoli_lang`.`name`" WHERE `name` = 'Articoli';
|
`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';
|
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
|
||||||
|
CREATE TABLE IF NOT EXISTS `mg_attributi_lang` (
|
||||||
|
`id` int NOT NULL,
|
||||||
|
`id_lang` int NOT NULL,
|
||||||
|
`id_record` int NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`title` VARCHAR(255) NOT NULL
|
||||||
|
);
|
||||||
|
ALTER TABLE `mg_attributi_lang`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
ALTER TABLE `mg_attributi_lang`
|
||||||
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
INSERT INTO `mg_attributi_lang` (`id`, `id_lang`, `id_record`, `name`, `title`) SELECT NULL, (SELECT `id` FROM `zz_langs` WHERE `iso_code` = 'it'), `id`, `nome`, `titolo` FROM `mg_attributi`;
|
||||||
|
|
||||||
|
ALTER TABLE `mg_attributi`
|
||||||
|
DROP `nome`,
|
||||||
|
DROP `titolo`;
|
||||||
|
|
||||||
|
ALTER TABLE `mg_attributi_lang` ADD CONSTRAINT `mg_attributi_lang_ibfk_1` FOREIGN KEY (`id_record`) REFERENCES `mg_attributi`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
|
||||||
|
|
||||||
|
-- Allineamento vista Attributi Combinazioni
|
||||||
|
UPDATE `zz_modules` SET `options` = "
|
||||||
|
SELECT
|
||||||
|
|select|
|
||||||
|
FROM
|
||||||
|
`mg_attributi`
|
||||||
|
LEFT JOIN `mg_attributi_lang` ON (`mg_attributi`.`id` = `mg_attributi_lang`.`id_record` AND `mg_attributi_lang`.|lang|)
|
||||||
|
WHERE
|
||||||
|
1=1 AND
|
||||||
|
`mg_attributi`.`deleted_at` IS NULL
|
||||||
|
HAVING
|
||||||
|
2=2" WHERE `name` = 'Attributi Combinazioni';
|
||||||
|
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`mg_attributi_lang`.`name`' WHERE `zz_modules`.`name` = 'Attributi Combinazioni' AND `zz_views`.`name` = 'Nome';
|
||||||
|
|
||||||
|
-- Allineamento vista Combinazioni
|
||||||
|
UPDATE `zz_modules` SET `options` = "
|
||||||
|
SELECT
|
||||||
|
|select|
|
||||||
|
FROM
|
||||||
|
`mg_combinazioni`
|
||||||
|
WHERE
|
||||||
|
1=1 AND
|
||||||
|
`mg_combinazioni`.`deleted_at` IS NULL
|
||||||
|
HAVING
|
||||||
|
2=2" WHERE `name` = 'Combinazioni';
|
||||||
|
@ -136,6 +136,7 @@ return [
|
|||||||
'my_impianti_interventi',
|
'my_impianti_interventi',
|
||||||
'mg_articolo_attributo',
|
'mg_articolo_attributo',
|
||||||
'mg_attributi',
|
'mg_attributi',
|
||||||
|
'mg_attributi_lang',
|
||||||
'mg_attributo_combinazione',
|
'mg_attributo_combinazione',
|
||||||
'mg_combinazioni',
|
'mg_combinazioni',
|
||||||
'mg_valori_attributi',
|
'mg_valori_attributi',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user