-- -- AGGIORNAMENTO A VERSIONE PRO -- -- FUNZIONI PER AGGIORNARE DAL DOCUMENTO IL PREZZO IN BANCA DATI ARTICOLO alter Table co_tipidocumento add `agg_prezzo_e` tinyint(1) NOT NULL DEFAULT '0'; alter Table co_tipidocumento add `agg_prezzo_u` tinyint(1) NOT NULL DEFAULT '0'; -- CREAZIONE TABELLA anticipi scadenzario CREATE TABLE IF NOT EXISTS `co_scadenziario_pagamenti` ( `id` int(11) NOT NULL AUTO_INCREMENT, `iddocumento` int(11) NOT NULL, `data_emissione` datetime NOT NULL, `ricevuto` decimal(12,4) DEFAULT NULL, `note` text NOT NULL, `idbanca` int(11) DEFAULT '0', `banca` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- CREAZIONE CAMPO PROFILAZIONE PER UTENTE alter Table zz_utenti add `profilo_skin` varchar(50) NOT NULL DEFAULT "blue"; alter Table zz_utenti add `vedo_avvisi` tinyint(1) NOT NULL DEFAULT '1'; alter Table zz_utenti add `vedo_news` tinyint(1) NOT NULL DEFAULT '0'; alter Table zz_utenti add `profilo_pannello` varchar(50) NOT NULL DEFAULT 'primary'; CREATE TABLE IF NOT EXISTS `zz_utenti_righe` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idutente` int(11) NOT NULL, `order` int(11) NOT NULL, `idpannello` int(11) NOT NULL, `dimensione` varchar(255) NOT NULL, `visibile` tinyint(1), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; CREATE TABLE IF NOT EXISTS `zz_pannello_righe` ( `id` int(11) NOT NULL AUTO_INCREMENT, `descrizione` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; INSERT INTO `zz_pannello_righe` (`descrizione`) VALUES ( 'Grafico'), ( 'Ultimi 10 Documenti in entrata'), ( 'Ultimi 10 Documenti in uscita'), ( 'Da incassare mese in corso'), ( 'Scadenzario Insoluti'), ( 'Ultimi 5 Articolo'); CREATE TABLE IF NOT EXISTS `zz_pannello_righe_dimensione` ( `id` int(11) NOT NULL AUTO_INCREMENT, `descrizione` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; INSERT INTO `zz_pannello_righe_dimensione` (`descrizione`) VALUES ( '1'), ( '2'), ( '3'), ( '4'), ( '5'), ( '6'), ( '7'), ( '8'), ( '9'), ( '10'), ( '11'), ( '12'); CREATE TABLE IF NOT EXISTS `zz_utenti_logo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `descrizione` varchar(255) NOT NULL, `immagine` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; INSERT INTO `zz_utenti_logo` (`descrizione`,`immagine`) VALUES ( 'GEST366','logo.png'); INSERT INTO `zz_modules` (`name`, `name2`, `module_dir`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `default_menu`, `enabled`, `type`, `new`, `moduli_add`, `mod_personale`) VALUES ('Logo', '', 'utenti_logo', 'custom', '', 'fa fa-th', '2.0.0', '2.0.0', 9, 36, 1, 0, 1, 'menu', 0, 1, 0); UPDATE `zz_modules` SET `parent`=( SELECT `id` FROM (SELECT `id` FROM `zz_modules` `m2` WHERE `name`='Strumenti') AS `m2`) WHERE `name` IN('Logo'); -- CREAZIONE MODULO WIZARD DOCUMENTI ANVANZATO CREATE TABLE IF NOT EXISTS `co_tipidocumento_wizard` ( `id` int(11) NOT NULL AUTO_INCREMENT, `descrizione` varchar(100) NOT NULL, `iddocumento_crea` int(11) NOT NULL, `iddocumento_stato_successivo` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; CREATE TABLE IF NOT EXISTS `co_tipidocumento_wizard_righe` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idwizard` int(11) NOT NULL, `idtipodocumento` int(11) NOT NULL, `id_stato_cerca` int(11) NOT NULL, `id_stato_inserisci` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; INSERT INTO `zz_modules` (`name`, `name2`, `module_dir`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `default_menu`, `enabled`, `type`, `new`,moduli_add) VALUES ('Documenti Wizard', '', 'documenti_wizard', 'SELECT |fields| FROM `co_tipidocumento_wizard` HAVING 1=1 order by `id`', '', 'fa fa-list-ol', '2.0.0', '2.0.0', 9, 0, 1, 0, 1, 'Menu', 0,1); UPDATE `zz_modules` SET `parent`=( SELECT `id` FROM (SELECT `id` FROM `zz_modules` `m2` WHERE `name`='Tabelle') AS `m2`) WHERE `name` IN('Documenti Wizard'); INSERT INTO `zz_viste` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `search_inside`, `order_by`, `enabled`, `summable`, `default`) VALUES ((SELECT id FROM zz_modules WHERE name = 'Documenti Wizard'), 'id', 'id', 1, 0, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Documenti Wizard'), 'Descrizione', 'descrizione', 2, 1, 0, '', '', 1, 0, 0); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Documenti Wizard') AND `name`='Descrizione')); INSERT INTO `zz_modules` (`name`, `name2`, `module_dir`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `default_menu`, `enabled`, `type`, `new`,moduli_add) VALUES ( 'Crea wizard', '', 'documenti_wizard_crea', 'custom', '', 'fa fa-th', '2.0.0', '2.0.0', 9, 33, 1, 0, 1, 'menu', 0,1 ); UPDATE `zz_modules` SET `parent`=( SELECT `id` FROM (SELECT `id` FROM `zz_modules` `m2` WHERE `name`='Documenti') AS `m2`) WHERE `name` IN('Crea wizard'); -- CREAZIONE TABELLE CALENDARIO CREATE TABLE IF NOT EXISTS `agenda_anagrafica` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idintervento` varchar(25) NOT NULL, `idtipoagenda` varchar(25) NOT NULL, `idtecnico` int(11) NOT NULL, `orario_inizio` datetime NOT NULL, `orario_fine` datetime NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, `idstatoagenda` varchar(10) NOT NULL DEFAULT '', `descrizione_att` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE IF NOT EXISTS `agenda_tipi` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idtipoagenda` varchar(25) NOT NULL, `descrizione` varchar(255) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL , PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE IF NOT EXISTS `agenda_stati` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idstatoagenda` varchar(10) NOT NULL, `descrizione` varchar(255) NOT NULL, `colore` varchar(7) NOT NULL DEFAULT '#FFFFFF', `default` tinyint(1) NOT NULL, `completato` tinyint(1) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, `v_default` tinyint(11) NOT NULL DEFAULT '0' , PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE IF NOT EXISTS `agenda` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idintervento` varchar(25) NOT NULL, `data_richiesta` datetime NOT NULL, `richiesta` text NOT NULL, `descrizione` text NOT NULL, `idtipoagenda` varchar(25) NOT NULL, `idanagrafica` int(11) NOT NULL, `idreferente` int(11) NOT NULL, `idstatoagenda` varchar(10) NOT NULL, `informazioniaggiuntive` text NOT NULL, `idsede` int(11) NOT NULL, `idclientefinale` int(11) NOT NULL, `info_sede` varchar(255) NOT NULL, `data_sla` date NOT NULL, `ora_sla` time NOT NULL, `sconto_incondizionato` decimal(12,4) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; alter Table agenda add componente_filename varchar(255) ; alter Table agenda add contenuto text; alter Table agenda add ass_idtipodocumento int(11) NOT NULL ; alter Table agenda add ass_iddocumento int(11) NOT NULL; alter Table agenda add ass_data_documento datetime NOT NULL; INSERT INTO `agenda_stati` (`idstatoagenda`, `descrizione`, `colore`) VALUES ('CALL', 'Chiamata', '#96c0ff'), ('OK', 'Completato', '#a3ff82'), ('WIP', 'In programmazione', '#ffc400'); INSERT INTO `agenda_tipi` (`idtipoagenda`, `descrizione`) VALUES ('T1', 'Tipologia 1'), ('T2', 'Tipologia 2'); INSERT INTO `zz_impostazioni` ( `nome`, `valore`, `tipo`, `editable`, `sezione`) VALUES ('Formato codice agenda', '#', 'string', 1, 'Agenda'); INSERT INTO `zz_modules` (`name`, `name2`, `module_dir`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `default_menu`, `enabled`, `type`, `new`, `moduli_add`, `mod_personale`) VALUES ('Calendar', '', 'agenda_calendar', 'custom', '', 'fa fa-dashboard', '2.0.1', '2.0.1', 1, 195, 1, 0, 1, 'menu', 0, 0, 0), ('Agenda', '', 'agenda', 'SELECT |fields| FROM (`agenda` INNER JOIN `an_anagrafiche` ON `agenda`.`idanagrafica`=`an_anagrafiche`.`idanagrafica`) LEFT OUTER JOIN `agenda_anagrafica` ON `agenda_anagrafica`.`idintervento`=`agenda`.`idintervento` GROUP BY `agenda`.`idintervento` HAVING 1=1 AND ( ( DATE_FORMAT( `orario_inizio`, \'%Y-%m-%d\' ) >= \'|period_start|\' AND DATE_FORMAT( `orario_fine`, \'%Y-%m-%d\' ) <= \'|period_end|\' ) OR ( DATE_FORMAT( `data_richiesta`, \'%Y-%m-%d\' ) >= \'|period_start|\' AND DATE_FORMAT( `data_richiesta`, \'%Y-%m-%d\' ) <= \'|period_end|\' ) ) ORDER BY IFNULL(`orario_fine`, `data_richiesta`) DESC', '', 'fa fa-wrench', '2.0.1', '2.0.1', 3, 0, 1, 0, 1, 'menu', 0, 0, 0), ('Stati Agenda', '', 'agenda_stati', 'SELECT |fields| FROM `agenda_stati` HAVING 1=1', '', 'fa fa-th', '2.0.1', '2.0.1', 5, 195, 1, 0, 1, 'menu', 0, 0, 1), ('Tipologia Agenda', '', 'agenda_tipi', 'SELECT |fields| FROM `agenda_tipi` HAVING 1=1', '', 'fa fa-ambulance', '2.0.1', '2.0.1', 6, 195, 1, 0, 1, 'menu', 0, 0, 1); UPDATE `zz_modules` SET `parent`=( SELECT `id` FROM (SELECT `id` FROM `zz_modules` `m2` WHERE `name`='Agenda') AS `m2`) WHERE `name` IN('Calendar','Stati Agenda','Tipologia Agenda'); INSERT INTO `zz_viste` ( `id_module`, `name`, `query`, `order`, `search`, `slow`, `search_inside`, `order_by`, `enabled`, `summable`, `default`) VALUES ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'id', 'agenda.idintervento', 1, 0, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Data Inizio', 'DATE_FORMAT( MIN(orario_inizio), \'%d/%m/%Y %H:%i\')', 4, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Data Fine', 'DATE_FORMAT(MAX(orario_fine), \'%d/%m/%Y %H:%i\')', 5, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Data', 'DATE_FORMAT(data_richiesta, \'%d/%m/%Y\')', 8, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Numero', 'agenda.idintervento', 2, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Anagrafica', '(SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=agenda.idanagrafica)', 7, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'orario_inizio', 'orario_inizio', 5, 0, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'orario_fine', 'orario_fine', 6, 1, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Operatore', '(SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=agenda_anagrafica.idtecnico)', 9, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Stato', '(SELECT descrizione FROM agenda_stati WHERE agenda_stati.idstatoagenda=agenda.idstatoagenda)', 10, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'Tipologia', '(SELECT descrizione FROM agenda_tipi WHERE agenda_tipi.idtipoagenda=agenda.idtipoagenda)', 11, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Agenda'), 'data_richiesta', 'data_richiesta', 12, 1, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Stati Agenda'), 'id', 'idstatoagenda', 1, 1, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Stati Agenda'), 'Codice', 'idstatoagenda', 2, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Stati Agenda'), 'Descrizione', 'descrizione', 3, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Tipologia Agenda'), 'id', 'id', 1, 0, 0, '', '', 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Tipologia Agenda'), 'Codice', 'idtipoagenda', 2, 1, 0, '', '', 1, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Tipologia Agenda'), 'Descrizione', 'descrizione', 3, 1, 0, '', '', 1, 0, 0); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Stati Agenda') AND `name`='Descrizione')); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Codice')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Descrizione')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Tipologia Agenda') AND `name`='Descrizione')); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data Fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Data')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Numero')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Numero')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Numero')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Numero')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Anagrafica')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Anagrafica')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Anagrafica')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Anagrafica')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_inizio')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='orario_fine')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Operatore')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Operatore')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Operatore')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Operatore')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Stato')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Stato')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Stato')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Stato')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Tipologia')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Tipologia')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Tipologia')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='Tipologia')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='data_richiesta')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='data_richiesta')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='data_richiesta')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Agenda') AND `name`='data_richiesta')); -- CREAZIONE TABELLE PROSPECT CREATE TABLE IF NOT EXISTS `an_anagrafiche_prospect` ( `id` int(11) NOT NULL AUTO_INCREMENT, `codice` varchar(20) NOT NULL, `ragione_sociale` varchar(255) NOT NULL, `piva` varchar(15) NOT NULL, `codice_fiscale` varchar(16) NOT NULL, `indirizzo` varchar(255) NOT NULL, `citta` varchar(255) NOT NULL, `cap` varchar(10) NOT NULL, `provincia` varchar(2) NOT NULL, `id_nazione` int(11) NOT NULL, `telefono` varchar(50) NOT NULL, `fax` varchar(50) NOT NULL, `cellulare` varchar(50) NOT NULL, `email` varchar(255) NOT NULL, `sitoweb` varchar(255) NOT NULL, `note` varchar(255) NOT NULL, `deleted` tinyint(1) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; alter Table an_anagrafiche_prospect add `componente_filename` varchar(255) DEFAULT NULL; alter Table an_anagrafiche_prospect add `contenuto` text; alter Table an_anagrafiche_prospect add `nome` varchar(255) DEFAULT NULL; alter Table an_anagrafiche_prospect add `cognome` varchar(255) DEFAULT NULL; alter Table an_anagrafiche_prospect add `id_anagrafica` int(11) NOT NULL DEFAULT '0'; alter Table an_anagrafiche add prospect tinyint(1) NOT NULL DEFAULT '0'; alter Table an_anagrafiche add da_prospect tinyint(1) NOT NULL DEFAULT '0'; alter Table an_anagrafiche_prospect add da_prospect tinyint(1) NOT NULL DEFAULT '0'; INSERT INTO `zz_modules` (`name`, `name2`, `module_dir`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `default_menu`, `enabled`, `type`, `new`, `moduli_add`, `mod_personale`) VALUES ('Prospect', '', 'anagrafiche_prospect', 'SELECT |fields| FROM `an_anagrafiche_prospect` HAVING 1=1 AND `deleted`=0 ORDER BY `ragione_sociale`', '', 'fa fa-users', '2.4.0', '2.4.0', 1, 0, 1, 0, 1, 'menu', 0, 0, 0); UPDATE `zz_modules` SET `parent`=( SELECT `id` FROM (SELECT `id` FROM `zz_modules` `m2` WHERE `name`='Anagrafiche') AS `m2`) WHERE `name` IN('Prospect'); INSERT INTO `zz_viste` ( `id_module`, `name`, `query`, `order`, `search`, `slow`, `search_inside`, `order_by`, `enabled`, `summable`, `default`, `allineamento`, `grassetto`, `capo_caratteri`) VALUES ((SELECT id FROM zz_modules WHERE name = 'Prospect'), 'id', 'id', 1, 1, 0, '', '', 0, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Prospect'),'Ragione sociale', 'ragione_sociale', 2, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Prospect'), 'Città', 'citta', 3, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Prospect'), 'Telefono', 'telefono', 4, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Prospect'), 'deleted', 'deleted', 5, 1, 0, '', '', 0, 0, 0, 0, 0, 0); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Ragione sociale')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Ragione sociale')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Ragione sociale')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Ragione sociale')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Città')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Città')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Città')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Città')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Telefono')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Telefono')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Telefono')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Telefono')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='deleted')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='deleted')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='deleted')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='deleted')); INSERT INTO `zz_impostazioni` ( `nome`, `valore`, `tipo`, `editable`, `sezione`) VALUES ('Formato codice prospect', 'PR-########', 'string', 1, 'Anagrafiche'); INSERT INTO `zz_viste` ( `id_module`, `name`, `query`, `order`, `search`, `slow`, `search_inside`, `order_by`, `enabled`, `summable`, `default`, `allineamento`, `grassetto`, `capo_caratteri`) VALUES ((SELECT id FROM zz_modules WHERE name = 'Prospect'), 'Nome', 'nome', 6, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Prospect'), 'Cognome', 'cognome', 7, 1, 0, '', '', 1, 0, 0, 0, 0, 0); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Nome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Nome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Nome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Nome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Cognome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Cognome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Cognome')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Prospect') AND `name`='Cognome')); CREATE TABLE IF NOT EXISTS `mg_articoli_prospect` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idarticolo` int(11) NOT NULL, `idprospect` int(11) NOT NULL, `descrizione` text NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- CAMPI PERSONALIZZABILI alter Table zz_modules add `campi_personalizzati` tinyint(1) NOT NULL DEFAULT '0'; alter Table zz_modules add `vedi_personalizzati` tinyint(1) NOT NULL DEFAULT '0'; INSERT INTO `zz_modules` (`name`, `name2`, `module_dir`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `default_menu`, `enabled`, `type`, `new`, `moduli_add`, `mod_personale`, `campi_personalizzati`) VALUES ('Campi Personalizzati', '', 'campi_personalizzati', 'SELECT |fields| FROM `zz_modules` HAVING 1=1 and vedi_personalizzati=1 ORDER BY `name`, `name2` ASC', '', 'fa fa-gears', '2.0.0', '2.0.0', 0, 36, 0, 0, 1, 'menu', 0, 0, 0, 0); UPDATE `zz_modules` SET `parent`=( SELECT `id` FROM (SELECT `id` FROM `zz_modules` `m2` WHERE `name`='Strumenti') AS `m2`) WHERE `name` IN('Campi Personalizzati'); UPDATE `zz_modules` SET vedi_personalizzati=1 WHERE `module_dir` IN('anagrafiche','articoli','documenti'); UPDATE `zz_modules` SET vedi_personalizzati=1 WHERE `id` ='14'; UPDATE `zz_modules` SET vedi_personalizzati=1 WHERE `module_dir` IN('anagrafiche_prospect','anagrafiche_sedi','rubrica','agenda'); INSERT INTO `zz_viste` ( `id_module`, `name`, `query`, `order`, `search`, `slow`, `search_inside`, `order_by`, `enabled`, `summable`, `default`, `allineamento`, `grassetto`, `capo_caratteri`) VALUES ((SELECT id FROM zz_modules WHERE name = 'Campi Personalizzati'), 'id', 'id', 1, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Campi Personalizzati'), 'Voce di Menu', 'name', 2, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Campi Personalizzati'), 'Nome Secondario', 'name2', 3, 1, 0, '', '', 1, 0, 0, 0, 0, 0), ((SELECT id FROM zz_modules WHERE name = 'Campi Personalizzati'), 'vedi_personalizzati', 'vedi_personalizzati', 4, 1, 0, '', '', 0, 0, 0, 0, 0, 0); INSERT INTO `zz_gruppi_viste` (`id_gruppo`, `id_vista`) VALUES ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='id')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='vedi_personalizzati')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='vedi_personalizzati')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='vedi_personalizzati')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='vedi_personalizzati')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Voce di Menu')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Voce di Menu')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Voce di Menu')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Voce di Menu')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Amministratori'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Nome Secondario')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Tecnici'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Nome Secondario')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Agenti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Nome Secondario')), ((SELECT `id` FROM `zz_gruppi` WHERE `nome`='Clienti'), (SELECT `id` FROM `zz_viste` WHERE id_module = (SELECT zz_modules.id FROM zz_modules WHERE zz_modules.name = 'Campi Personalizzati') AND `name`='Nome Secondario')); CREATE TABLE IF NOT EXISTS `zz_campi_add` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_module` int(11) NOT NULL, `id_label` varchar(255) NOT NULL, `id_campo` varchar(255) NOT NULL, `dimensione` varchar(255) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; alter Table zz_campi_add add `deleted` tinyint(1) NOT NULL DEFAULT '0'; CREATE TABLE IF NOT EXISTS `zz_campi_val` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_campo` varchar(255) NOT NULL, `id_module` varchar(255) NOT NULL, `id_record` varchar(255) NOT NULL, `valore` varchar(255) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_by` int(11) NOT NULL, `created_by` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;