diff --git a/ajax_dataload.php b/ajax_dataload.php index 8c4bd9bc1..f9c95ce8d 100644 --- a/ajax_dataload.php +++ b/ajax_dataload.php @@ -44,12 +44,17 @@ if (!empty($result_query) && $result_query != 'menu' && $result_query != 'custom $search_filters[] = str_replace('|search|', prepare('%'.$piece.'%'), $total['search_inside'][$i]); } } else { - // Per le icone cerco per il campo icon_title - if (preg_match('/^icon_(.+?)$/', $total['search_inside'][$i], $m)) { - $total['search_inside'][$i] = 'icon_title_'.$m[1]; + // Per le icone cerco nel campo icon_title + if (preg_match('/^icon_(.+?)$/', $total['fields'][$i], $m)) { + $total['search_inside'][$i] = '`icon_title_'.$m[1].'`'; } - $search_filters[] = '`'.$total['search_inside'][$i].'` LIKE '.prepare('%'.trim($columns[$i]['search']['value'].'%')); + // Per i colori cerco nel campo color_title + elseif (preg_match('/^color_(.+?)$/', $total['fields'][$i], $m)) { + $total['search_inside'][$i] = '`color_title_'.$m[1].'`'; + } + + $search_filters[] = $total['search_inside'][$i].' LIKE '.prepare('%'.trim($columns[$i]['search']['value'].'%')); } } } diff --git a/include/init/init.php b/include/init/init.php index 436e64a9c..764596bcf 100644 --- a/include/init/init.php +++ b/include/init/init.php @@ -9,8 +9,7 @@ if (Update::isUpdateAvailable() || !$dbo->isInstalled()) { $has_azienda = $dbo->fetchNum("SELECT `an_anagrafiche`.`idanagrafica` FROM `an_anagrafiche` LEFT JOIN `an_tipianagrafiche_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` LEFT JOIN `an_tipianagrafiche` ON `an_tipianagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` -WHERE `an_tipianagrafiche`.`descrizione` = 'Azienda' AND `an_anagrafiche`.`deleted` = 0") != 0; - +WHERE `an_tipianagrafiche`.`descrizione` = 'Azienda' AND `an_anagrafiche`.`deleted_at` IS NULL") != 0; $has_user = $dbo->fetchNum('SELECT `id` FROM `zz_users`') != 0; $settings = [ diff --git a/modules/anagrafiche/actions.php b/modules/anagrafiche/actions.php index a281a98d0..ca0b31b9c 100644 --- a/modules/anagrafiche/actions.php +++ b/modules/anagrafiche/actions.php @@ -259,7 +259,7 @@ switch (post('op')) { case 'delete': // Se l'anagrafica non è l'azienda principale, la disattivo if (!in_array($id_azienda, $tipi_anagrafica)) { - $dbo->query('UPDATE an_anagrafiche SET deleted = 1 WHERE idanagrafica = '.prepare($id_record).Modules::getAdditionalsQuery($id_module)); + $dbo->query('UPDATE an_anagrafiche SET deleted_at = NOW() WHERE idanagrafica = '.prepare($id_record).Modules::getAdditionalsQuery($id_module)); // Se l'anagrafica è collegata ad un utente lo disabilito $dbo->query('UPDATE zz_users SET enabled = 0 WHERE idanagrafica = '.prepare($id_record).Modules::getAdditionalsQuery($id_module)); diff --git a/modules/anagrafiche/add.php b/modules/anagrafiche/add.php index 7d67051c7..3f5bdc9d5 100644 --- a/modules/anagrafiche/add.php +++ b/modules/anagrafiche/add.php @@ -18,7 +18,7 @@ echo '
'.tr('Non sono presenti anagrafiche di tipo "Tecnico"').'
'; } - -echo ' - - -'.tr('Impianti', [], ['upper' => true]).'
+'.implode(', ', $list).'
'; +} +echo ''.tr('Il tutto S.E. & O.').'
'.tr("In attesa di un Vostro Cortese riscontro, colgo l'occasione per porgere Cordiali Saluti").'
'; +} -//Firma -echo '
lì, ___________________________
diff --git a/templates/contratti/init.php b/templates/contratti/init.php
index 8f3476185..c9c798665 100644
--- a/templates/contratti/init.php
+++ b/templates/contratti/init.php
@@ -5,7 +5,7 @@ include_once __DIR__.'/../../core.php';
$module_name = 'Contratti';
// Lettura info fattura
-$records = $dbo->fetchArray('SELECT *, co_contratti.descrizione AS desc_contratto, (SELECT orario_inizio FROM in_interventi_tecnici WHERE idintervento=in_interventi.id LIMIT 0,1) AS data, co_contratti.descrizione AS `cdescrizione`, co_contratti.idanagrafica AS `idanagrafica`, co_contratti.costo_orario AS costo_orario , co_contratti.costo_km AS costo_km FROM co_contratti LEFT OUTER JOIN (co_contratti_promemoria LEFT OUTER JOIN in_interventi ON co_contratti_promemoria.idintervento=in_interventi.id) ON co_contratti.id=co_contratti_promemoria.idcontratto WHERE co_contratti.id='.prepare($id_record));
+$records = $dbo->fetchArray('SELECT *, co_contratti.descrizione AS desc_contratto, (SELECT orario_inizio FROM in_interventi_tecnici WHERE idintervento=in_interventi.id LIMIT 0,1) AS data, (SELECT fatturabile FROM co_staticontratti WHERE id=idstato) AS fatturabile, (SELECT GROUP_CONCAT(my_impianti_contratti.idimpianto) FROM my_impianti_contratti WHERE idcontratto = co_contratti.id) AS idimpianti, co_contratti.descrizione AS `cdescrizione`, co_contratti.idanagrafica AS `idanagrafica`, co_contratti.costo_orario AS costo_orario , co_contratti.costo_km AS costo_km FROM co_contratti LEFT OUTER JOIN (co_contratti_promemoria LEFT OUTER JOIN in_interventi ON co_contratti_promemoria.idintervento=in_interventi.id) ON co_contratti.id=co_contratti_promemoria.idcontratto WHERE co_contratti.id='.prepare($id_record));
$id_cliente = $records[0]['idanagrafica'];
$id_sede = $records[0]['idsede'];
diff --git a/templates/ddt/body.php b/templates/ddt/body.php
index 06f21761a..2dc34bf69 100644
--- a/templates/ddt/body.php
+++ b/templates/ddt/body.php
@@ -46,7 +46,7 @@ $rs_gen = $dbo->fetchArray("SELECT *,
(SELECT `percentuale` FROM `co_iva` WHERE `id` = `dt_righe_ddt`.`idiva`) AS perc_iva,
IFNULL((SELECT peso_lordo FROM mg_articoli WHERE id=idarticolo),0) * qta AS peso_lordo,
IFNULL((SELECT volume FROM mg_articoli WHERE id=idarticolo),0) * qta AS volume
-FROM `dt_righe_ddt` WHERE idddt=".prepare($id_record));
+FROM `dt_righe_ddt` WHERE idddt=".prepare($id_record).' ORDER BY `order`');
foreach ($rs_gen as $r) {
$count = 0;
$count += ceil(strlen($r['descrizione']) / $autofill['words']);
diff --git a/update/2_3.php b/update/2_3.php
index 19b3390f2..abdbd50bb 100644
--- a/update/2_3.php
+++ b/update/2_3.php
@@ -1,26 +1,5 @@
fetchArray('SELECT `id` FROM `zz_groups`');
-$results = $database->fetchArray('SELECT `id` FROM `zz_views` WHERE `id` NOT IN (SELECT `id_vista` FROM `zz_group_view`)');
-
-$array = [];
-foreach ($results as $result) {
- foreach ($gruppi as $gruppo) {
- $array[] = [
- 'id_gruppo' => $gruppo['id'],
- 'id_vista' => $result['id'],
- ];
- }
-}
-if (!empty($array)) {
- $database->insert('zz_group_view', $array);
-}
-
/*
* Fix
*/
diff --git a/update/2_4.php b/update/2_4.php
index 8c0ed81e1..690ebb573 100644
--- a/update/2_4.php
+++ b/update/2_4.php
@@ -1,26 +1,5 @@
fetchArray('SELECT `id` FROM `zz_groups`');
-$results = $database->fetchArray('SELECT `id` FROM `zz_views` WHERE `id` NOT IN (SELECT `id_vista` FROM `zz_group_view`)');
-
-$array = [];
-foreach ($results as $result) {
- foreach ($gruppi as $gruppo) {
- $array[] = [
- 'id_gruppo' => $gruppo['id'],
- 'id_vista' => $result['id'],
- ];
- }
-}
-if (!empty($array)) {
- $database->insert('zz_group_view', $array);
-}
-
/*
* Rimozione file e cartelle deprecati
*/
diff --git a/update/2_4.sql b/update/2_4.sql
index 81394ca96..bbe9660b9 100644
--- a/update/2_4.sql
+++ b/update/2_4.sql
@@ -196,7 +196,8 @@ UPDATE `co_documenti` SET `id_segment`='2' WHERE `idtipodocumento` IN (SELECT `i
-- Innesto modulo segmenti sotto "Strumenti"
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES
-(NULL, 'Segmenti', 'Segmenti', 'segmenti', '{ "main_query": [ { "type": "table", "fields": "id, Nome, Modulo, Maschera, Note, Predefinito", "query": "SELECT `id`, (IF(predefined=1, ''Sì'', ''No'')) AS `Predefinito`, `name` AS `Nome`, (SELECT name FROM zz_modules WHERE id = zz_segments.id_module) AS Modulo, `pattern` AS `Maschera`, `note` AS `Note` FROM `zz_segments` HAVING 2=2 ORDER BY name, id_module"} ]}', '', 'fa fa-database', '2.4', '2.4', 1, (SELECT `id` FROM `zz_modules` `m` WHERE `name` = 'Strumenti'), 1, 1);
+(NULL, 'Segmenti', 'Segmenti', 'segmenti', '{ "main_query": [ { "type": "table", "fields": "id, Nome, Modulo, Maschera, Note, Predefinito", "query": "SELECT `id`, (IF(predefined=1, ''Sì'', ''No'')) AS `Predefinito`, `name` AS `Nome`, (SELECT name FROM zz_modules WHERE id = zz_segments.id_module) AS Modulo, `pattern` AS `Maschera`, `note` AS `Note` FROM `zz_segments` HAVING 2=2 ORDER BY name, id_module"} ]}', '', 'fa fa-database', '2.4', '2.4', 1, NULL, 1, 1);
+UPDATE `zz_modules` `t1` INNER JOIN `zz_modules` `t2` ON (`t1`.`name` = 'Segmenti' AND `t2`.`name` = 'Strumenti') SET `t1`.`parent` = `t2`.`id`;
-- Aggiorno widget Fatturato con i sezionali
UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS(" ", REPLACE(REPLACE(REPLACE(FORMAT(SUM((SELECT SUM(subtotale+iva-sconto) FROM co_righe_documenti WHERE iddocumento=co_documenti.id)+iva_rivalsainps+rivalsainps+bollo-ritenutaacconto), 2), ",", "#"), ".", ","), "#", "."), "€") AS dato FROM co_documenti WHERE idtipodocumento IN (SELECT id FROM co_tipidocumento WHERE dir="entrata") |segment| AND data >= "|period_start|" AND data <= "|period_end|" AND 1=1' WHERE `zz_widgets`.`name` = 'Fatturato';
@@ -314,19 +315,14 @@ CREATE TABLE IF NOT EXISTS `co_banche` (
) ENGINE=InnoDB;
-- Innesto modulo per gestione banche
-INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Banche', 'Banche', 'banche', 'SELECT |select| FROM `co_banche` WHERE 1=1 AND deleted = 0 GROUP BY `nome` HAVING 2=2', '', 'fa fa-university', '2.4', '2.4', '1', (SELECT `id` FROM `zz_modules` m WHERE `name` = 'Tabelle'), '1', '1');
+INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Banche', 'Banche', 'banche', 'SELECT |select| FROM `co_banche` WHERE 1=1 AND deleted = 0 GROUP BY `nome` HAVING 2=2', '', 'fa fa-university', '2.4', '2.4', '1', NULL, '1', '1');
+UPDATE `zz_modules` `t1` INNER JOIN `zz_modules` `t2` ON (`t1`.`name` = 'Banche' AND `t2`.`name` = 'Tabelle') SET `t1`.`parent` = `t2`.`id`;
-INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `enabled`, `summable`, `default`) VALUES
-(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'id', 'co_banche.id', 0, 0, 0, 0, '', '', 1, 0, 0),
-(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'Nome', 'co_banche.nome', 0, 0, 0, 0, '', '', 1, 0, 0),
-(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'Filiale', 'co_banche.filiale', 0, 0, 0, 0, '', '', 1, 0, 0),
-(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'IBAN', 'co_banche.iban', 0, 0, 0, 0, '', '', 1, 0, 0);
-
-INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) VALUES
-((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'id')),
-((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'Nome')),
-((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'Filiale')),
-((SELECT `id` FROM `zz_groups` WHERE `nome` = 'Amministratori'), (SELECT `id` FROM `zz_views` WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'IBAN'));
+INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `enabled`, `summable`, `default`) VALUES
+(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'id', 'co_banche.id', 0, 0, 0, 0, 1, 0, 0),
+(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'Nome', 'co_banche.nome', 0, 0, 0, 0, 1, 0, 0),
+(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'Filiale', 'co_banche.filiale', 0, 0, 0, 0, 1, 0, 0),
+(NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche'), 'IBAN', 'co_banche.iban', 0, 0, 0, 0, 1, 0, 0);
-- Aggiungo campi in an_anagrafiche con riferimento banche
ALTER TABLE `an_anagrafiche` ADD `idbanca_vendite` INT(11) NOT NULL AFTER `idconto_cliente`, ADD `idbanca_acquisti` INT(11) NOT NULL AFTER `idbanca_vendite`;
diff --git a/update/2_4_1.php b/update/2_4_1.php
index 19b81978b..050a5f819 100644
--- a/update/2_4_1.php
+++ b/update/2_4_1.php
@@ -1,26 +1,5 @@
fetchArray('SELECT `id` FROM `zz_groups`');
-$results = $database->fetchArray('SELECT `id` FROM `zz_views` WHERE `id` NOT IN (SELECT `id_vista` FROM `zz_group_view`)');
-
-$array = [];
-foreach ($results as $result) {
- foreach ($gruppi as $gruppo) {
- $array[] = [
- 'id_gruppo' => $gruppo['id'],
- 'id_vista' => $result['id'],
- ];
- }
-}
-if (!empty($array)) {
- $database->insert('zz_group_view', $array);
-}
-
// Script per aggiornare le date dei movimenti con le date dei documenti
$rs = $dbo->fetchArray('SELECT * FROM mg_movimenti');
diff --git a/update/2_4_1.sql b/update/2_4_1.sql
index c6db458ef..a49adef3c 100644
--- a/update/2_4_1.sql
+++ b/update/2_4_1.sql
@@ -53,16 +53,6 @@ UPDATE `zz_modules` `t1` INNER JOIN `zz_modules` `t2` ON (`t1`.`name` = 'Modelli
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `enabled`, `summable`, `default`) VALUES (NULL, (SELECT id FROM zz_modules WHERE name='Modelli prima nota'), 'id', 'co_movimenti_modelli.id', '0', '1', '0', '0', NULL, NULL, '0', '0', '1');
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `enabled`, `summable`, `default`) VALUES (NULL, (SELECT id FROM zz_modules WHERE name='Modelli prima nota'), 'Causale predefinita', 'co_movimenti_modelli.descrizione', '1', '1', '0', '0', NULL, NULL, '1', '0', '1');
-INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) VALUES
-(1, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='id' )),
-(1, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='Causale predefinita' )),
-(2, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='id' )),
-(2, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='Causale predefinita' )),
-(3, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='id' )),
-(3, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='Causale predefinita' )),
-(4, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='id' )),
-(4, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Modelli prima nota') AND name='Causale predefinita' ));
-
-- Widget per stampa calendario
INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`, `query`, `bgcolor`, `icon`, `print_link`, `more_link`, `more_link_type`, `php_include`, `text`, `enabled`, `order`, `help` ) VALUES (NULL, 'Stampa calendario', 'print', '1', 'controller_top', 'col-md-12', NULL, '#4ccc4c', 'fa fa-print', '', './modules/dashboard/widgets/stampa_calendario.dashboard.php', 'popup', '', 'Stampa calendario', '1', '7', NULL);
@@ -145,22 +135,10 @@ UPDATE `zz_views` SET `query` = 'CONCAT(mg_movimenti.qta,'' '', (SELECT um FROM
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `enabled`, `default`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Movimenti'), 'Data', 'mg_movimenti.data', 5, 1, 0, 1, 1, 1);
-INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) VALUES
-(1, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Movimenti') AND name='Data' )),
-(2, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Movimenti') AND name='Data' )),
-(3, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Movimenti') AND name='Data' )),
-(4, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Movimenti') AND name='Data' ));
-
-- Aggiungo colonna impianti per i contratti
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `enabled`, `default`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Contratti'), 'Impianti', '(SELECT IF(nome = '''', GROUP_CONCAT(matricola SEPARATOR '' ''), GROUP_CONCAT(matricola, '' - '', nome SEPARATOR '' '')) FROM my_impianti INNER JOIN my_impianti_contratti ON my_impianti.id = my_impianti_contratti.idimpianto WHERE my_impianti_contratti.idcontratto = co_contratti.id)', 4, 1, 0, 0, 0, 1); -INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) VALUES -(1, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Contratti') AND name='Impianti' )), -(2, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Contratti') AND name='Impianti' )), -(3, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Contratti') AND name='Impianti' )), -(4, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Contratti') AND name='Impianti' )); - -- Tempo standard per attività ALTER TABLE `in_tipiintervento` ADD `tempo_standard` DECIMAL(10,2) NULL AFTER `costo_diritto_chiamata_tecnico`; @@ -239,12 +217,6 @@ UPDATE `or_righe_ordini` SET `abilita_serial` = 0 WHERE `idarticolo` NOT IN (SEL INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `enabled`, `default`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Preventivi'), 'idanagrafica', 'co_preventivi.idanagrafica', 0, 0, 0, 0, 0, 1); -INSERT INTO `zz_group_view` (`id_gruppo`, `id_vista`) VALUES -(1, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Preventivi') AND name='idanagrafica' )), -(2, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Preventivi') AND name='idanagrafica' )), -(3, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Preventivi') AND name='idanagrafica' )), -(4, (SELECT id FROM `zz_views` WHERE id_module=(SELECT id FROM zz_modules WHERE name='Preventivi') AND name='idanagrafica' )); - -- Fix name, title e order stampa ordine fornitore senza costi UPDATE `zz_prints` SET `name` = 'Ordine fornitore (senza costi)', `title` = 'Ordine fornitore (senza costi)', `order` = 1 WHERE `zz_prints`.`name` = 'Ordine fornitore' AND options = '{"pricing":false}' AND `zz_prints`.`id_module` = (SELECT id FROM zz_modules WHERE name='Ordini fornitore') ; -- Stampa ordine fornitore con costi costi @@ -393,4 +365,89 @@ UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS(\" \", REPLACE(REPLACE(REPLA INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `enabled`, `default`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita'), 'Tipo', 'co_tipidocumento.descrizione', 4, 1, 0, 1, 1); INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `enabled`, `default`) VALUES -((SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di acquisto'), 'Tipo', 'co_tipidocumento.descrizione', 4, 1, 0, 1, 1); +((SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di acquisto'), 'Tipo', +'co_tipidocumento.descrizione', 4, 1, 0, 1, 1); + +-- Aggiunta di alcuni filtri di base +INSERT INTO `zz_group_module` (`id`, `idgruppo`, `idmodule`, `name`, `clause`, `position`, `enabled`, `default`) VALUES +(NULL, (SELECT `id` FROM `zz_groups` WHERE `nome` = 'Clienti'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di vendita'), 'Mostra ddt di vendita ai clienti coinvolti', 'dt_ddt.idanagrafica=|idanagrafica|', 'WHR', '0', '1'), +(NULL, (SELECT `id` FROM `zz_groups` WHERE `nome` = 'Clienti'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ordini cliente'), 'Mostra ordini cliente ai clienti coinvolti', 'or_ordini.idanagrafica=|idanagrafica|', 'WHR', '0', '1'), +(NULL, (SELECT `id` FROM `zz_groups` WHERE `nome` = 'Clienti'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita'), 'Mostra fatture di vendita ai clienti coinvolti', 'co_documenti.idanagrafica=|idanagrafica|', 'WHR', '0', '1'); + +-- Sostituzione deleted con deleted_at +ALTER TABLE `co_banche` ADD `deleted_at` timestamp NULL DEFAULT NULL; +UPDATE `co_banche` SET `deleted_at` = NOW() WHERE `deleted` = 1; +ALTER TABLE `co_banche` DROP `deleted`; + +ALTER TABLE `an_anagrafiche` ADD `deleted_at` timestamp NULL DEFAULT NULL; +UPDATE `an_anagrafiche` SET `deleted_at` = NOW() WHERE `deleted` = 1; +ALTER TABLE `an_anagrafiche` DROP `deleted`; + +ALTER TABLE `in_statiintervento` ADD `deleted_at` timestamp NULL DEFAULT NULL; +UPDATE `in_statiintervento` SET `deleted_at` = NOW() WHERE `deleted` = 1; +ALTER TABLE `in_statiintervento` DROP `deleted`; + +ALTER TABLE `zz_emails` ADD `deleted_at` timestamp NULL DEFAULT NULL; +UPDATE `zz_emails` SET `deleted_at` = NOW() WHERE `deleted` = 1; +ALTER TABLE `zz_emails` DROP `deleted`; + +ALTER TABLE `zz_smtp` ADD `deleted_at` timestamp NULL DEFAULT NULL; +UPDATE `zz_smtp` SET `deleted_at` = NOW() WHERE `deleted` = 1; +ALTER TABLE `zz_smtp` DROP `deleted`; + +ALTER TABLE `in_interventi` ADD `deleted_at` timestamp NULL DEFAULT NULL; +UPDATE `in_interventi` SET `deleted_at` = NOW() WHERE `deleted` = 1; +ALTER TABLE `in_interventi` DROP `deleted`; + +UPDATE `zz_widgets` SET `query` = REPLACE( + REPLACE( + REPLACE(`query`, 'deleted=0', '`deleted_at` IS NULL') + , 'deleted = 0', '`deleted_at` IS NULL') +, '`deleted` = 0', '`deleted_at` IS NULL'); +UPDATE `zz_modules` SET `options` = REPLACE( + REPLACE( + REPLACE(`options`, 'deleted=0', '`deleted_at` IS NULL') + , 'deleted = 0', '`deleted_at` IS NULL') +, '`deleted` = 0', '`deleted_at` IS NULL'), `options2` = REPLACE( + REPLACE( + REPLACE(`options2`, 'deleted=0', '`deleted_at` IS NULL') + , 'deleted = 0', '`deleted_at` IS NULL') +, '`deleted` = 0', '`deleted_at` IS NULL'); +UPDATE `zz_group_module` SET `clause` = REPLACE( + REPLACE( + REPLACE(`clause`, 'deleted=0', '`deleted_at` IS NULL') + , 'deleted = 0', '`deleted_at` IS NULL') +, '`deleted` = 0', '`deleted_at` IS NULL'); +UPDATE `zz_views` SET `query` = REPLACE( + REPLACE( + REPLACE(`query`, 'deleted=0', '`deleted_at` IS NULL') + , 'deleted = 0', '`deleted_at` IS NULL') +, '`deleted` = 0', '`deleted_at` IS NULL'); + +UPDATE `zz_widgets` SET `query` = REPLACE( + REPLACE( + REPLACE(`query`, 'deleted=1', '`deleted_at` IS NOT NULL') + , 'deleted = 1', '`deleted_at` IS NOT NULL') +, '`deleted` = 1', '`deleted_at` IS NOT NULL'); +UPDATE `zz_modules` SET `options` = REPLACE( + REPLACE( + REPLACE(`options`, 'deleted=1', '`deleted_at` IS NOT NULL') + , 'deleted = 1', '`deleted_at` IS NOT NULL') +, '`deleted` = 1', '`deleted_at` IS NOT NULL'), `options2` = REPLACE( + REPLACE( + REPLACE(`options2`, 'deleted=1', '`deleted_at` IS NOT NULL') + , 'deleted = 1', '`deleted_at` IS NOT NULL') +, '`deleted` = 1', '`deleted_at` IS NOT NULL'); +UPDATE `zz_group_module` SET `clause` = REPLACE( + REPLACE( + REPLACE(`clause`, 'deleted=1', '`deleted_at` IS NOT NULL') + , 'deleted = 1', '`deleted_at` IS NOT NULL') +, '`deleted` = 1', '`deleted_at` IS NOT NULL'); +UPDATE `zz_views` SET `query` = REPLACE( + REPLACE( + REPLACE(`query`, 'deleted=1', '`deleted_at` IS NOT NULL') + , 'deleted = 1', '`deleted_at` IS NOT NULL') +, '`deleted` = 1', '`deleted_at` IS NOT NULL'); + +-- Fix id delle Banche +UPDATE `zz_views` SET `enabled` = 0 WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Banche') AND `name` = 'id'; |