UPDATE `gaz_config` SET `cvalue` = '91' WHERE `id` =2;
ALTER TABLE `gaz_admin` CHANGE `enterprise_id` `company_id` INT NOT NULL;
ALTER TABLE `gaz_admin_module` CHANGE `enterprise_id` `company_id` INT NOT NULL;
UPDATE `gaz_menu_script` SET `link` = 'create_new_company.php' WHERE `link` = 'create_new_enterprise.php';
INSERT INTO `gaz_menu_module` SELECT MAX(id)+1, 8, 'report_anagra.php', '', '', 7, '', 8  FROM `gaz_menu_module`;
INSERT INTO `gaz_menu_module` SELECT MAX(id)+1, 5, 'report_ragstat.php', '', '', 9, '', 9  FROM `gaz_menu_module`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, (SELECT MAX(id) FROM `gaz_menu_module`), 'admin_ragstat.php', '', '', '12', '', '5'  FROM `gaz_menu_script`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, 7, 'report_destinazioni.php', '', '', 33, '', 4  FROM `gaz_menu_script`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, 7, 'admin_destinazioni.php', '', '', 34, '', 5  FROM `gaz_menu_script`;
INSERT INTO `gaz_menu_module` SELECT MAX(id)+1, 4, 'select_situazione_contabile.php', '', '', 7, '', 7  FROM `gaz_menu_module`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, (SELECT MAX(id) FROM `gaz_menu_module`), 'select_situazione_contabile.php', '', '', 6, '', 1  FROM `gaz_menu_script`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, 1, 'admin_docven.php?Insert&tipdoc=VRI', '', '', 35, '', 3 FROM `gaz_menu_script`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, 49, 'backup.php?external', '', '', 8, '', 2  FROM `gaz_menu_script`;
INSERT INTO `gaz_menu_script` SELECT MAX(id)+1, 49, 'backup.php?internal', '', '', 9, '', 1  FROM `gaz_menu_script`;
UPDATE `gaz_menu_module` SET `link` = 'report_backup.php' WHERE `link` = 'backup.php' ;
UPDATE `gaz_menu_script` SET `weight` = 5 WHERE `link` = 'accounting_documents.php?type=VRI';
CREATE TABLE `gaz_destina` (`codice` INT NOT NULL AUTO_INCREMENT,`unita_locale1` VARCHAR(50) NOT NULL DEFAULT  '',`unita_locale2` VARCHAR(50) NOT NULL DEFAULT  '',`indspe` VARCHAR(50) NOT NULL DEFAULT  '',`capspe` VARCHAR(10) NOT NULL DEFAULT  '',`citspe` VARCHAR(50) NOT NULL DEFAULT  '',`prospe` CHAR(2) NOT NULL DEFAULT  '',`country` VARCHAR(3) NOT NULL,`latitude` decimal(8,5) NOT NULL,`longitude` decimal(8,5) NOT NULL,`telefo` VARCHAR(50) NOT NULL DEFAULT  '',`fax` VARCHAR(32) NOT NULL DEFAULT  '',`cell` VARCHAR(32) NOT NULL DEFAULT  '',`e_mail` VARCHAR(50) NOT NULL DEFAULT  '',`annota` VARCHAR(50) NOT NULL DEFAULT  '',`id_anagra` INT NOT NULL ,PRIMARY KEY (`codice`)) ENGINE=MyISAM;
ALTER TABLE `gaz_admin` ADD `skin` VARCHAR(60) NOT NULL DEFAULT 'DEFAULT.css' AFTER `style`;
CREATE TABLE `gaz_menu_usage` ( `adminid` VARCHAR(30) NOT NULL, `company_id` INT NOT NULL, `transl_ref` VARCHAR(50) NOT NULL, `link` VARCHAR(255) NOT NULL, `click` INT DEFAULT NULL, `last_use` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=MyISAM;
INSERT INTO `gaz_config` (`description`, `variable`, `cvalue`) VALUES ('Last backup', 'last_backup', DATE_FORMAT(NOW(),'%Y-%m-%d'));
INSERT INTO `gaz_config` (`description`, `variable`, `cvalue`) VALUES ('Where to send backup file (external or internal )', 'backup_mode', 'external');
-- START_WHILE ( questo e' un tag che serve per istruire install.php ad INIZIARE ad eseguire le query seguenti su tutte le aziende dell'installazione)
ALTER TABLE `gaz_XXXaliiva` ADD `taxstamp` INT NOT NULL AFTER `aliquo`;
UPDATE `gaz_XXXaliiva` SET `taxstamp` = '1' WHERE `aliquo` <= 0.1;
CREATE TABLE `gaz_XXXragstat` ( `codice` CHAR(15) NOT NULL, `descri` VARCHAR(50) NOT NULL DEFAULT '', `image` blob NOT NULL, `web_url` VARCHAR(255) NOT NULL, `ricarico` decimal(4,1) NOT NULL, `annota` VARCHAR(50) DEFAULT NULL, `adminid` VARCHAR(20) NOT NULL DEFAULT '', `last_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (codice)) ENGINE=MyISAM;
ALTER TABLE `gaz_XXXartico` ADD `ragstat` CHAR(15) NOT NULL AFTER `catmer`;
ALTER TABLE `gaz_XXXartico` ADD KEY (`ragstat`);
ALTER TABLE `gaz_XXXartico` ADD `clfoco` CHAR(15) DEFAULT NULL;
ALTER TABLE `gaz_XXXartico` ADD KEY (`clfoco`);
ALTER TABLE `gaz_XXXartico` ADD `sconto` decimal(6,3) DEFAULT '0.0000'  AFTER `preve3`;
ALTER TABLE `gaz_XXXrigdoc` MODIFY COLUMN `sconto` decimal(6,3);
ALTER TABLE `gaz_XXXtesdoc` ADD `ddt_type` CHAR(1) NOT NULL AFTER `tipdoc`;
UPDATE `gaz_XXXtesdoc` SET `ddt_type` = 'T' WHERE (`tipdoc` = 'DDT' OR `tipdoc` = 'FAD');
ALTER TABLE `gaz_XXXtesdoc` ADD `id_doc_ritorno` INT NOT NULL DEFAULT 0 AFTER `ddt_type`;
ALTER TABLE `gaz_XXXtesdoc` ADD `data_ordine` DATE DEFAULT null AFTER `datemi`;
ALTER TABLE `gaz_XXXtesdoc` ADD `ragbol` INT NOT NULL DEFAULT 0 AFTER `pagame`;
CREATE TABLE IF NOT EXISTS `gaz_XXXassist` ( `id` INT NOT NULL AUTO_INCREMENT, `codice` INT NOT NULL, `utente` VARCHAR(50) NOT NULL, `data` DATE NOT NULL, `tecnico` VARCHAR(50) NOT NULL, `oggetto` VARCHAR(80) NOT NULL, `descrizione` TEXT NOT NULL, `clfoco` INT NOT NULL, `ore` decimal(6,2) NOT NULL, `stato` VARCHAR(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM;
ALTER TABLE `gaz_XXXassist` ADD `info_agg` VARCHAR(80) NULL AFTER `descrizione`;
ALTER TABLE `gaz_XXXstaff` ADD `Codice_CCNL` VARCHAR(30) NOT NULL;
-- STOP_WHILE ( questo e' un tag che serve per istruire install.php a SMETTERE di eseguire le query su tutte le aziende dell'installazione)