Fix: sql bad use.

Qual: Incrase sql syntax test by phpunit to migration scripts. 
Qual: Removed old migration script before 3.0.0
This commit is contained in:
Laurent Destailleur 2014-08-14 00:09:09 +02:00
parent e424ae5b86
commit e3f96802fb
12 changed files with 26 additions and 3951 deletions

View File

@ -1,958 +0,0 @@
--
-- Attention a l ordre des requetes.
-- Ce fichier doit etre charge sur une version 2.0.0
-- sans AUCUNE erreur ni warning
--
create table llx_paiementfourn_facturefourn
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_paiementfourn INT(11) DEFAULT NULL,
fk_facturefourn INT(11) DEFAULT NULL,
amount DOUBLE DEFAULT '0'
) TYPE=innodb;
ALTER TABLE llx_paiementfourn_facturefourn ADD INDEX idx_paiementfourn_facturefourn_fk_facture(fk_facturefourn);
ALTER TABLE llx_paiementfourn_facturefourn ADD INDEX idx_paiementfourn_facturefourn_fk_paiement(fk_paiementfourn);
drop table if exists llx_commande_model_pdf;
drop table if exists llx_commande_fournisseur_model_pdf;
alter table llx_commande add column note_public text after note;
alter table llx_contrat add column note text;
alter table llx_contrat add column note_public text after note;
alter table llx_facture add column note_public text after note;
alter table llx_facture add column remise_absolue real DEFAULT 0 after remise_percent;
alter table llx_facture add column close_code varchar(16) after remise;
alter table llx_facture add column close_note varchar(128) after close_code;
alter table llx_facture modify close_code varchar(16);
alter table llx_propal add column note_public text after note;
alter table llx_propal add column remise_absolue real DEFAULT 0 after remise_percent;
alter table llx_commande add column remise_absolue real DEFAULT 0 after remise_percent;
ALTER TABLE llx_societe add mode_reglement tinyint;
ALTER TABLE llx_societe add cond_reglement tinyint;
ALTER TABLE llx_societe add tva_assuj tinyint DEFAULT '1';
ALTER TABLE llx_societe add email varchar(128) after url;
ALTER TABLE llx_societe change active statut tinyint DEFAULT 0;
ALTER TABLE llx_societe modify mode_reglement tinyint NULL;
ALTER TABLE llx_societe modify cond_reglement tinyint NULL;
ALTER TABLE llx_societe modify cond_reglement tinyint NULL;
ALTER TABLE llx_societe modify fk_stcomm tinyint DEFAULT 0;
ALTER TABLE llx_societe modify services tinyint DEFAULT 0;
ALTER TABLE llx_societe modify client tinyint DEFAULT 0;
ALTER TABLE llx_societe modify fournisseur tinyint DEFAULT 0;
ALTER TABLE llx_societe add customer_bad tinyint DEFAULT 0 after fournisseur;
ALTER TABLE llx_societe add customer_rate real DEFAULT 0 after customer_bad;
ALTER TABLE llx_societe add supplier_rate real DEFAULT 0 after customer_rate;
ALTER TABLE llx_societe modify siren varchar(16);
ALTER TABLE llx_societe modify siret varchar(16);
ALTER TABLE llx_societe modify ape varchar(16);
ALTER TABLE llx_societe add idprof4 varchar(16) after ape;
ALTER TABLE llx_societe drop column id;
ALTER TABLE llx_societe modify parent integer;
UPDATE llx_societe set parent = null where parent = 0;
ALTER TABLE llx_product ADD COLUMN stock_loc VARCHAR(10) DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN gencode VARCHAR(255) DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN weight float DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN weight_units tinyint DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN canvas varchar(15) DEFAULT '';
ALTER TABLE llx_stock_mouvement ADD COLUMN price FLOAT(13,4) DEFAULT 0;
insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (6,'PROFORMA', 6,1, 'Proforma','R<EFBFBD>glement avant livraison',0,0);
alter table llx_cond_reglement add (decalage smallint(6) default 0);
alter table llx_commande add fk_cond_reglement integer DEFAULT NULL;
alter table llx_commande add fk_mode_reglement integer DEFAULT NULL;
alter table llx_categorie drop column fk_statut;
alter table llx_categorie add visible tinyint DEFAULT 1 NOT NULL;
ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label);
alter table llx_c_actioncomm add module varchar(16) DEFAULT NULL after libelle;
delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,50);
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 1, 'AC_TEL', 'system', 'Appel Téléphonique' ,NULL);
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 2, 'AC_FAX', 'system', 'Envoi Fax' ,NULL);
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition' ,'propal');
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 4, 'AC_EMAIL','system', 'Envoi Email' ,NULL);
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 5, 'AC_RDV', 'system', 'Rendez-vous' ,NULL);
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 8, 'AC_COM', 'system', 'Envoi Commande' ,'order');
insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 9, 'AC_FAC', 'system', 'Envoi Facture' ,'invoice');
insert into llx_c_actioncomm (id, code, type, libelle, module) values (50, 'AC_OTH', 'system', 'Autre' ,NULL);
alter table llx_actioncomm modify datea datetime;
alter table llx_actioncomm add column datec datetime after id;
alter table llx_actioncomm add column datep datetime after datec;
alter table llx_actioncomm add column datep2 datetime after datep;
alter table llx_actioncomm add column datea2 datetime after datea;
alter table llx_actioncomm add column tms timestamp after datea2;
alter table llx_actioncomm add column fk_commande integer after propalrowid;
alter table llx_actioncomm add column fk_parent integer NOT NULL default 0 after fk_contact;
alter table llx_actioncomm add column durationp real after percent;
alter table llx_actioncomm add column durationa real after durationp;
alter table llx_actioncomm add column fk_projet integer after label;
alter table llx_actioncomm add column punctual smallint NOT NULL default 1 after priority;
update llx_actioncomm set datec = datea where datec is null;
update llx_actioncomm set datep = datea where datep is null AND percent < 100;
update llx_actioncomm set datep = datec where datea is null AND datep is null AND percent < 100;
update llx_actioncomm set datea = datec where datea is null AND datep is null AND percent = 100;
update llx_actioncomm set fk_action = '8' where fk_action = '3' and label = 'Envoi commande par mail';
drop table if exists llx_expedition_model_pdf;
create table llx_product_det
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_product integer DEFAULT 0 NOT NULL,
lang varchar(5) DEFAULT 0 NOT NULL,
label varchar(255) NOT NULL,
description text,
note text
)ENGINE=innodb;
ALTER TABLE `llx_propal` ADD `date_livraison` DATE;
ALTER TABLE `llx_commande` ADD `date_livraison` DATE;
update llx_commande set date_livraison = null where date_livraison = '0000-00-00';
update llx_commande set date_livraison = null where date_livraison = '1970-01-01';
ALTER TABLE llx_facture_fourn DROP INDEX facnumber;
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc);
ALTER TABLE llx_facture_fourn ADD note_public text after note;
alter table llx_facture_fourn add column `type` smallint DEFAULT 0 NOT NULL after facnumber;
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn);
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid);
ALTER TABLE llx_facturedet ADD COLUMN fk_remise_except integer NULL AFTER remise;
ALTER TABLE llx_facturedet ADD COLUMN total_ht real AFTER price;
ALTER TABLE llx_facturedet ADD COLUMN total_tva real AFTER total_ht;
ALTER TABLE llx_facturedet ADD COLUMN total_ttc real AFTER total_tva;
ALTER TABLE llx_facturedet ADD COLUMN info_bits integer DEFAULT 0 AFTER date_end;
ALTER TABLE llx_facturedet modify fk_product integer NULL;
UPDATE llx_facturedet SET info_bits=0 where (fk_remise_except IS NULL OR fk_remise_except = 0);
UPDATE llx_facturedet SET fk_product=NULL where fk_product=0;
ALTER TABLE llx_propaldet ADD COLUMN total_ht real AFTER price;
ALTER TABLE llx_propaldet ADD COLUMN total_tva real AFTER total_ht;
ALTER TABLE llx_propaldet ADD COLUMN total_ttc real AFTER total_tva;
ALTER TABLE llx_propaldet ADD COLUMN info_bits integer DEFAULT 0 AFTER total_ttc;
ALTER TABLE llx_commandedet ADD COLUMN total_ht real AFTER price;
ALTER TABLE llx_commandedet ADD COLUMN total_tva real AFTER total_ht;
ALTER TABLE llx_commandedet ADD COLUMN total_ttc real AFTER total_tva;
ALTER TABLE llx_commandedet ADD COLUMN info_bits integer DEFAULT 0 AFTER total_ttc;
ALTER TABLE llx_contratdet ADD COLUMN total_ht real AFTER price_ht;
ALTER TABLE llx_contratdet ADD COLUMN total_tva real AFTER total_ht;
ALTER TABLE llx_contratdet ADD COLUMN total_ttc real AFTER total_tva;
ALTER TABLE llx_contratdet ADD COLUMN info_bits integer DEFAULT 0 AFTER total_ttc;
ALTER TABLE llx_commande ADD INDEX idx_commande_fk_soc (fk_soc);
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_commande_fournisseur ADD INDEX idx_commande_fournisseur_fk_soc (fk_soc);
ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
alter table llx_commande_fournisseur add note_public text after note;
drop table if exists llx_avoir_model_pdf;
drop table if exists llx_soc_recontact;
update llx_const set name='PRODUIT_DESC_IN_FORM' where name='FORM_ADD_PROD_DESC';
update llx_const set name='PRODUIT_CHANGE_PROD_DESC' where name='CHANGE_PROD_DESC';
update llx_const set name='COMMANDE_ADD_PROD_DESC' where name='COM_ADD_PROD_DESC';
update llx_const set name='PROPALE_ADD_PROD_DESC' where name='PROP_ADD_PROD_DESC';
update llx_const set name='DON_FORM' where name='DONS_FORM';
update llx_const set name='MAIN_SIZE_LISTE_LIMIT' where name='SIZE_LISTE_LIMIT';
update llx_const set name='SOCIETE_FISCAL_MONTH_START' where name='FISCAL_MONTH_START';
update llx_const set visible=0 where name='FACTURE_DISABLE_RECUR';
update llx_const set visible=0 where name='MAILING_EMAIL_FROM';
update llx_const set visible=1 where name='PRODUIT_CONFIRM_DELETE_LINE';
update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_MAIL_FROM';
update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_EMAIL_FROM';
update llx_const set value=2048, visible=0 where name='MAIN_UPLOAD_DOC' and value=1;
delete from llx_const where name = 'SIZE_LISTE_LIMIT';
insert into llx_const(name,value,type,visible,note) values('MAIN_SHOW_DEVELOPMENT_MODULES','0','yesno',1,'Make development modules visible');
delete from llx_const where name in ('OSC_CATALOG_URL','OSC_LANGUAGE_ID');
update llx_const set visible=0 where name like 'OSC_DB_%';
alter table llx_paiementfourn add statut smallint(6) NOT NULL DEFAULT 0;
alter table llx_bank_url add column type enum("company","payment","member","subscription","donation","sc","payment_sc");
update llx_bank_url set type=null where type='';
alter table llx_bank_url modify type enum("company","payment","member","subscription","donation","sc","payment_sc") NOT NULL;
update llx_bank_url set type = 'payment_supplier' where label = '(paiement)' and type='payment' and url like '%/fourn/%';
alter table llx_bank_url drop index fk_bank;
alter table llx_bank_url drop index fk_bank_2;
alter table llx_bank_url drop index fk_bank_3;
alter table llx_bank_url drop index fk_bank_4;
alter table llx_bank_url drop index fk_bank_5;
alter table llx_bank_url drop index fk_bank_6;
alter table llx_bank_url drop index fk_bank_7;
alter table llx_bank_url drop index fk_bank_8;
alter table llx_bank_url drop index fk_bank_9;
ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank,type);
create table llx_societe_adresse_livraison
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime,
tms timestamp,
fk_societe integer DEFAULT 0,
nom varchar(60),
address varchar(255),
cp varchar(10),
ville varchar(50),
fk_departement integer DEFAULT 0,
fk_pays integer DEFAULT 0,
note text,
fk_user_creat integer,
fk_user_modif integer
)ENGINE=innodb;
alter table llx_societe_adresse_livraison add column label varchar(30) after tms;
alter table llx_propal add column fk_adresse_livraison integer after date_livraison;
alter table llx_commande add column fk_adresse_livraison integer after date_livraison;
alter table llx_c_pays modify libelle varchar(50) NOT NULL;
SET FOREIGN_KEY_CHECKS = 0;
delete from llx_c_pays;
SET FOREIGN_KEY_CHECKS = 1;
insert into llx_c_pays (rowid,code,libelle) values (0, '' , '-' );
insert into llx_c_pays (rowid,code,libelle) values (1, 'FR', 'France' );
insert into llx_c_pays (rowid,code,libelle) values (2, 'BE', 'Belgique' );
insert into llx_c_pays (rowid,code,libelle) values (3, 'IT', 'Italie' );
insert into llx_c_pays (rowid,code,libelle) values (4, 'ES', 'Espagne' );
insert into llx_c_pays (rowid,code,libelle) values (5, 'DE', 'Allemagne' );
insert into llx_c_pays (rowid,code,libelle) values (6, 'CH', 'Suisse' );
insert into llx_c_pays (rowid,code,libelle) values (7, 'GB', 'Royaume uni' );
insert into llx_c_pays (rowid,code,libelle) values (8, 'IE', 'Irlande' );
insert into llx_c_pays (rowid,code,libelle) values (9, 'CN', 'Chine' );
insert into llx_c_pays (rowid,code,libelle) values (10, 'TN', 'Tunisie' );
insert into llx_c_pays (rowid,code,libelle) values (11, 'US', 'Etats Unis' );
insert into llx_c_pays (rowid,code,libelle) values (12, 'MA', 'Maroc' );
insert into llx_c_pays (rowid,code,libelle) values (13, 'DZ', 'Algérie' );
insert into llx_c_pays (rowid,code,libelle) values (14, 'CA', 'Canada' );
insert into llx_c_pays (rowid,code,libelle) values (15, 'TG', 'Togo' );
insert into llx_c_pays (rowid,code,libelle) values (16, 'GA', 'Gabon' );
insert into llx_c_pays (rowid,code,libelle) values (17, 'NL', 'Pays Bas' );
insert into llx_c_pays (rowid,code,libelle) values (18, 'HU', 'Hongrie' );
insert into llx_c_pays (rowid,code,libelle) values (19, 'RU', 'Russie' );
insert into llx_c_pays (rowid,code,libelle) values (20, 'SE', 'Suède' );
insert into llx_c_pays (rowid,code,libelle) values (21, 'CI', 'Côte d\'Ivoire' );
insert into llx_c_pays (rowid,code,libelle) values (22, 'SN', 'Sénégal' );
insert into llx_c_pays (rowid,code,libelle) values (23, 'AR', 'Argentine' );
insert into llx_c_pays (rowid,code,libelle) values (24, 'CM', 'Cameroun' );
insert into llx_c_pays (rowid,code,libelle) values (25, 'PT', 'Portugal' );
insert into llx_c_pays (rowid,code,libelle) values (26, 'SA', 'Arabie Saoudite');
insert into llx_c_pays (rowid,code,libelle) values (27, 'MC', 'Monaco' );
insert into llx_c_pays (rowid,code,libelle) values (28, 'AU', 'Australie' );
insert into llx_c_pays (rowid,code,libelle) values (29, 'SG', 'Singapoure' );
insert into llx_c_pays (rowid,code,libelle) values (30, 'AF', 'Afghanistan' );
insert into llx_c_pays (rowid,code,libelle) values (31, 'AX', 'Iles Aland' );
insert into llx_c_pays (rowid,code,libelle) values (32, 'AL', 'Albanie' );
insert into llx_c_pays (rowid,code,libelle) values (33, 'AS', 'Samoa américaines');
insert into llx_c_pays (rowid,code,libelle) values (34, 'AD', 'Andorre' );
insert into llx_c_pays (rowid,code,libelle) values (35, 'AO', 'Angola' );
insert into llx_c_pays (rowid,code,libelle) values (36, 'AI', 'Anguilla' );
insert into llx_c_pays (rowid,code,libelle) values (37, 'AQ', 'Antarctique' );
insert into llx_c_pays (rowid,code,libelle) values (38, 'AG', 'Antigua-et-Barbuda');
insert into llx_c_pays (rowid,code,libelle) values (39, 'AM', 'Arménie' );
insert into llx_c_pays (rowid,code,libelle) values (40, 'AW', 'Aruba' );
insert into llx_c_pays (rowid,code,libelle) values (41, 'AT', 'Autriche' );
insert into llx_c_pays (rowid,code,libelle) values (42, 'AZ', 'Azerbaïdjan' );
insert into llx_c_pays (rowid,code,libelle) values (43, 'BS', 'Bahamas' );
insert into llx_c_pays (rowid,code,libelle) values (44, 'BH', 'Bahreïn' );
insert into llx_c_pays (rowid,code,libelle) values (45, 'BD', 'Bangladesh' );
insert into llx_c_pays (rowid,code,libelle) values (46, 'BB', 'Barbade' );
insert into llx_c_pays (rowid,code,libelle) values (47, 'BY', 'Biélorussie' );
insert into llx_c_pays (rowid,code,libelle) values (48, 'BZ', 'Belize' );
insert into llx_c_pays (rowid,code,libelle) values (49, 'BJ', 'Bénin' );
insert into llx_c_pays (rowid,code,libelle) values (50, 'BM', 'Bermudes' );
insert into llx_c_pays (rowid,code,libelle) values (51, 'BT', 'Bhoutan' );
insert into llx_c_pays (rowid,code,libelle) values (52, 'BO', 'Bolivie' );
insert into llx_c_pays (rowid,code,libelle) values (53, 'BA', 'Bosnie-Herzégovine');
insert into llx_c_pays (rowid,code,libelle) values (54, 'BW', 'Botswana' );
insert into llx_c_pays (rowid,code,libelle) values (55, 'BV', 'Ile Bouvet' );
insert into llx_c_pays (rowid,code,libelle) values (56, 'BR', 'Brésil' );
insert into llx_c_pays (rowid,code,libelle) values (57, 'IO', 'Territoire britannique de l\'Océan Indien');
insert into llx_c_pays (rowid,code,libelle) values (58, 'BN', 'Brunei' );
insert into llx_c_pays (rowid,code,libelle) values (59, 'BG', 'Bulgarie' );
insert into llx_c_pays (rowid,code,libelle) values (60, 'BF', 'Burkina Faso' );
insert into llx_c_pays (rowid,code,libelle) values (61, 'BI', 'Burundi' );
insert into llx_c_pays (rowid,code,libelle) values (62, 'KH', 'Cambodge' );
insert into llx_c_pays (rowid,code,libelle) values (63, 'CV', 'Cap-Vert' );
insert into llx_c_pays (rowid,code,libelle) values (64, 'KY', 'Iles Cayman' );
insert into llx_c_pays (rowid,code,libelle) values (65, 'CF', 'République centrafricaine');
insert into llx_c_pays (rowid,code,libelle) values (66, 'TD', 'Tchad' );
insert into llx_c_pays (rowid,code,libelle) values (67, 'CL', 'Chili' );
insert into llx_c_pays (rowid,code,libelle) values (68, 'CX', 'Ile Christmas' );
insert into llx_c_pays (rowid,code,libelle) values (69, 'CC', 'Iles des Cocos (Keeling)');
insert into llx_c_pays (rowid,code,libelle) values (70, 'CO', 'Colombie' );
insert into llx_c_pays (rowid,code,libelle) values (71, 'KM', 'Comores' );
insert into llx_c_pays (rowid,code,libelle) values (72, 'CG', 'Congo' );
insert into llx_c_pays (rowid,code,libelle) values (73, 'CD', 'République démocratique du Congo');
insert into llx_c_pays (rowid,code,libelle) values (74, 'CK', 'Iles Cook' );
insert into llx_c_pays (rowid,code,libelle) values (75, 'CR', 'Costa Rica' );
insert into llx_c_pays (rowid,code,libelle) values (76, 'HR', 'Croatie' );
insert into llx_c_pays (rowid,code,libelle) values (77, 'CU', 'Cuba' );
insert into llx_c_pays (rowid,code,libelle) values (78, 'CY', 'Chypre' );
insert into llx_c_pays (rowid,code,libelle) values (79, 'CZ', 'République Tchèque');
insert into llx_c_pays (rowid,code,libelle) values (80, 'DK', 'Danemark' );
insert into llx_c_pays (rowid,code,libelle) values (81, 'DJ', 'Djibouti' );
insert into llx_c_pays (rowid,code,libelle) values (82, 'DM', 'Dominique' );
insert into llx_c_pays (rowid,code,libelle) values (83, 'DO', 'République Dominicaine');
insert into llx_c_pays (rowid,code,libelle) values (84, 'EC', 'Equateur' );
insert into llx_c_pays (rowid,code,libelle) values (85, 'EG', 'Egypte' );
insert into llx_c_pays (rowid,code,libelle) values (86, 'SV', 'Salvador' );
insert into llx_c_pays (rowid,code,libelle) values (87, 'GQ', 'Guinée Equatoriale');
insert into llx_c_pays (rowid,code,libelle) values (88, 'ER', 'Erythrée' );
insert into llx_c_pays (rowid,code,libelle) values (89, 'EE', 'Estonie' );
insert into llx_c_pays (rowid,code,libelle) values (90, 'ET', 'Ethiopie' );
insert into llx_c_pays (rowid,code,libelle) values (91, 'FK', 'Iles Falkland' );
insert into llx_c_pays (rowid,code,libelle) values (92, 'FO', 'Iles Féroé' );
insert into llx_c_pays (rowid,code,libelle) values (93, 'FJ', 'Iles Fidji' );
insert into llx_c_pays (rowid,code,libelle) values (94, 'FI', 'Finlande' );
insert into llx_c_pays (rowid,code,libelle) values (95, 'GF', 'Guyane française');
insert into llx_c_pays (rowid,code,libelle) values (96, 'PF', 'Polynésie française');
insert into llx_c_pays (rowid,code,libelle) values (97, 'TF', 'Terres australes françaises');
insert into llx_c_pays (rowid,code,libelle) values (98, 'GM', 'Gambie' );
insert into llx_c_pays (rowid,code,libelle) values (99, 'GE', 'Géorgie' );
insert into llx_c_pays (rowid,code,libelle) values (100, 'GH', 'Ghana' );
insert into llx_c_pays (rowid,code,libelle) values (101, 'GI', 'Gibraltar' );
insert into llx_c_pays (rowid,code,libelle) values (102, 'GR', 'Grèce' );
insert into llx_c_pays (rowid,code,libelle) values (103, 'GL', 'Groenland' );
insert into llx_c_pays (rowid,code,libelle) values (104, 'GD', 'Grenade' );
insert into llx_c_pays (rowid,code,libelle) values (105, 'GP', 'Guadeloupe' );
insert into llx_c_pays (rowid,code,libelle) values (106, 'GU', 'Guam' );
insert into llx_c_pays (rowid,code,libelle) values (107, 'GT', 'Guatemala' );
insert into llx_c_pays (rowid,code,libelle) values (108, 'GN', 'Guinée' );
insert into llx_c_pays (rowid,code,libelle) values (109, 'GW', 'Guinée-Bissao' );
insert into llx_c_pays (rowid,code,libelle) values (110, 'GY', 'Guyana' );
insert into llx_c_pays (rowid,code,libelle) values (111, 'HT', 'Haïti' );
insert into llx_c_pays (rowid,code,libelle) values (112, 'HM', 'Iles Heard et McDonald');
insert into llx_c_pays (rowid,code,libelle) values (113, 'VA', 'Saint-Siège (Vatican)');
insert into llx_c_pays (rowid,code,libelle) values (114, 'HN', 'Honduras' );
insert into llx_c_pays (rowid,code,libelle) values (115, 'HK', 'Hong Kong' );
insert into llx_c_pays (rowid,code,libelle) values (116, 'IS', 'Islande' );
insert into llx_c_pays (rowid,code,libelle) values (117, 'IN', 'Inde' );
insert into llx_c_pays (rowid,code,libelle) values (118, 'ID', 'Indonésie' );
insert into llx_c_pays (rowid,code,libelle) values (119, 'IR', 'Iran' );
insert into llx_c_pays (rowid,code,libelle) values (120, 'IQ', 'Iraq' );
insert into llx_c_pays (rowid,code,libelle) values (121, 'IL', 'Israël' );
insert into llx_c_pays (rowid,code,libelle) values (122, 'JM', 'Jamaïque' );
insert into llx_c_pays (rowid,code,libelle) values (123, 'JP', 'Japon' );
insert into llx_c_pays (rowid,code,libelle) values (124, 'JO', 'Jordanie' );
insert into llx_c_pays (rowid,code,libelle) values (125, 'KZ', 'Kazakhstan' );
insert into llx_c_pays (rowid,code,libelle) values (126, 'KE', 'Kenya' );
insert into llx_c_pays (rowid,code,libelle) values (127, 'KI', 'Kiribati' );
insert into llx_c_pays (rowid,code,libelle) values (128, 'KP', 'Corée du Nord' );
insert into llx_c_pays (rowid,code,libelle) values (129, 'KR', 'Corée du Sud' );
insert into llx_c_pays (rowid,code,libelle) values (130, 'KW', 'Koweït' );
insert into llx_c_pays (rowid,code,libelle) values (131, 'KG', 'Kirghizistan' );
insert into llx_c_pays (rowid,code,libelle) values (132, 'LA', 'Laos' );
insert into llx_c_pays (rowid,code,libelle) values (133, 'LV', 'Lettonie' );
insert into llx_c_pays (rowid,code,libelle) values (134, 'LB', 'Liban' );
insert into llx_c_pays (rowid,code,libelle) values (135, 'LS', 'Lesotho' );
insert into llx_c_pays (rowid,code,libelle) values (136, 'LR', 'Liberia' );
insert into llx_c_pays (rowid,code,libelle) values (137, 'LY', 'Libye' );
insert into llx_c_pays (rowid,code,libelle) values (138, 'LI', 'Liechtenstein' );
insert into llx_c_pays (rowid,code,libelle) values (139, 'LT', 'Lituanie' );
insert into llx_c_pays (rowid,code,libelle) values (140, 'LU', 'Luxembourg' );
insert into llx_c_pays (rowid,code,libelle) values (141, 'MO', 'Macao' );
insert into llx_c_pays (rowid,code,libelle) values (142, 'MK', 'ex-République yougoslave de Macédoine');
insert into llx_c_pays (rowid,code,libelle) values (143, 'MG', 'Madagascar' );
insert into llx_c_pays (rowid,code,libelle) values (144, 'MW', 'Malawi' );
insert into llx_c_pays (rowid,code,libelle) values (145, 'MY', 'Malaisie' );
insert into llx_c_pays (rowid,code,libelle) values (146, 'MV', 'Maldives' );
insert into llx_c_pays (rowid,code,libelle) values (147, 'ML', 'Mali' );
insert into llx_c_pays (rowid,code,libelle) values (148, 'MT', 'Malte' );
insert into llx_c_pays (rowid,code,libelle) values (149, 'MH', 'Iles Marshall' );
insert into llx_c_pays (rowid,code,libelle) values (150, 'MQ', 'Martinique' );
insert into llx_c_pays (rowid,code,libelle) values (151, 'MR', 'Mauritanie' );
insert into llx_c_pays (rowid,code,libelle) values (152, 'MU', 'Maurice' );
insert into llx_c_pays (rowid,code,libelle) values (153, 'YT', 'Mayotte' );
insert into llx_c_pays (rowid,code,libelle) values (154, 'MX', 'Mexique' );
insert into llx_c_pays (rowid,code,libelle) values (155, 'FM', 'Micronésie' );
insert into llx_c_pays (rowid,code,libelle) values (156, 'MD', 'Moldavie' );
insert into llx_c_pays (rowid,code,libelle) values (157, 'MN', 'Mongolie' );
insert into llx_c_pays (rowid,code,libelle) values (158, 'MS', 'Monserrat' );
insert into llx_c_pays (rowid,code,libelle) values (159, 'MZ', 'Mozambique' );
insert into llx_c_pays (rowid,code,libelle) values (160, 'MM', 'Birmanie' );
insert into llx_c_pays (rowid,code,libelle) values (161, 'NA', 'Namibie' );
insert into llx_c_pays (rowid,code,libelle) values (162, 'NR', 'Nauru' );
insert into llx_c_pays (rowid,code,libelle) values (163, 'NP', 'Népal' );
insert into llx_c_pays (rowid,code,libelle) values (164, 'AN', 'Antilles néerlandaises');
insert into llx_c_pays (rowid,code,libelle) values (165, 'NC', 'Nouvelle-Calédonie');
insert into llx_c_pays (rowid,code,libelle) values (166, 'NZ', 'Nouvelle-Zélande');
insert into llx_c_pays (rowid,code,libelle) values (167, 'NI', 'Nicaragua' );
insert into llx_c_pays (rowid,code,libelle) values (168, 'NE', 'Niger' );
insert into llx_c_pays (rowid,code,libelle) values (169, 'NG', 'Nigeria' );
insert into llx_c_pays (rowid,code,libelle) values (170, 'NU', 'Nioué' );
insert into llx_c_pays (rowid,code,libelle) values (171, 'NF', 'Ile Norfolk' );
insert into llx_c_pays (rowid,code,libelle) values (172, 'MP', 'Mariannes du Nord');
insert into llx_c_pays (rowid,code,libelle) values (173, 'NO', 'Norvège' );
insert into llx_c_pays (rowid,code,libelle) values (174, 'OM', 'Oman' );
insert into llx_c_pays (rowid,code,libelle) values (175, 'PK', 'Pakistan' );
insert into llx_c_pays (rowid,code,libelle) values (176, 'PW', 'Palaos' );
insert into llx_c_pays (rowid,code,libelle) values (177, 'PS', 'territoire Palestinien Occupé');
insert into llx_c_pays (rowid,code,libelle) values (178, 'PA', 'Panama' );
insert into llx_c_pays (rowid,code,libelle) values (179, 'PG', 'Papouasie-Nouvelle-Guinée');
insert into llx_c_pays (rowid,code,libelle) values (180, 'PY', 'Paraguay' );
insert into llx_c_pays (rowid,code,libelle) values (181, 'PE', 'Pérou' );
insert into llx_c_pays (rowid,code,libelle) values (182, 'PH', 'Philippines' );
insert into llx_c_pays (rowid,code,libelle) values (183, 'PN', 'Iles Pitcairn' );
insert into llx_c_pays (rowid,code,libelle) values (184, 'PL', 'Pologne' );
insert into llx_c_pays (rowid,code,libelle) values (185, 'PR', 'Porto Rico' );
insert into llx_c_pays (rowid,code,libelle) values (186, 'QA', 'Qatar' );
insert into llx_c_pays (rowid,code,libelle) values (187, 'RE', 'Réunion' );
insert into llx_c_pays (rowid,code,libelle) values (188, 'RO', 'Roumanie' );
insert into llx_c_pays (rowid,code,libelle) values (189, 'RW', 'Rwanda' );
insert into llx_c_pays (rowid,code,libelle) values (190, 'SH', 'Sainte-Hélène' );
insert into llx_c_pays (rowid,code,libelle) values (191, 'KN', 'Saint-Christophe-et-Niévès');
insert into llx_c_pays (rowid,code,libelle) values (192, 'LC', 'Sainte-Lucie' );
insert into llx_c_pays (rowid,code,libelle) values (193, 'PM', 'Saint-Pierre-et-Miquelon');
insert into llx_c_pays (rowid,code,libelle) values (194, 'VC', 'Saint-Vincent-et-les-Grenadines');
insert into llx_c_pays (rowid,code,libelle) values (195, 'WS', 'Samoa' );
insert into llx_c_pays (rowid,code,libelle) values (196, 'SM', 'Saint-Marin' );
insert into llx_c_pays (rowid,code,libelle) values (197, 'ST', 'Sao Tomé-et-Principe');
insert into llx_c_pays (rowid,code,libelle) values (198, 'RS', 'Serbie' );
insert into llx_c_pays (rowid,code,libelle) values (199, 'SC', 'Seychelles' );
insert into llx_c_pays (rowid,code,libelle) values (200, 'SL', 'Sierra Leone' );
insert into llx_c_pays (rowid,code,libelle) values (201, 'SK', 'Slovaquie' );
insert into llx_c_pays (rowid,code,libelle) values (202, 'SI', 'Slovénie' );
insert into llx_c_pays (rowid,code,libelle) values (203, 'SB', 'Iles Salomon' );
insert into llx_c_pays (rowid,code,libelle) values (204, 'SO', 'Somalie' );
insert into llx_c_pays (rowid,code,libelle) values (205, 'ZA', 'Afrique du Sud');
insert into llx_c_pays (rowid,code,libelle) values (206, 'GS', 'Iles Géorgie du Sud et Sandwich du Sud');
insert into llx_c_pays (rowid,code,libelle) values (207, 'LK', 'Sri Lanka' );
insert into llx_c_pays (rowid,code,libelle) values (208, 'SD', 'Soudan' );
insert into llx_c_pays (rowid,code,libelle) values (209, 'SR', 'Suriname' );
insert into llx_c_pays (rowid,code,libelle) values (210, 'SJ', 'Iles Svalbard et Jan Mayen');
insert into llx_c_pays (rowid,code,libelle) values (211, 'SZ', 'Swaziland' );
insert into llx_c_pays (rowid,code,libelle) values (212, 'SY', 'Syrie' );
insert into llx_c_pays (rowid,code,libelle) values (213, 'TW', 'Taïwan' );
insert into llx_c_pays (rowid,code,libelle) values (214, 'TJ', 'Tadjikistan' );
insert into llx_c_pays (rowid,code,libelle) values (215, 'TZ', 'Tanzanie' );
insert into llx_c_pays (rowid,code,libelle) values (216, 'TH', 'Thaïlande' );
insert into llx_c_pays (rowid,code,libelle) values (217, 'TL', 'Timor Oriental');
insert into llx_c_pays (rowid,code,libelle) values (218, 'TK', 'Tokélaou' );
insert into llx_c_pays (rowid,code,libelle) values (219, 'TO', 'Tonga' );
insert into llx_c_pays (rowid,code,libelle) values (220, 'TT', 'Trinité-et-Tobago');
insert into llx_c_pays (rowid,code,libelle) values (221, 'TR', 'Turquie' );
insert into llx_c_pays (rowid,code,libelle) values (222, 'TM', 'Turkménistan' );
insert into llx_c_pays (rowid,code,libelle) values (223, 'TC', 'Iles Turks-et-Caicos');
insert into llx_c_pays (rowid,code,libelle) values (224, 'TV', 'Tuvalu' );
insert into llx_c_pays (rowid,code,libelle) values (225, 'UG', 'Ouganda' );
insert into llx_c_pays (rowid,code,libelle) values (226, 'UA', 'Ukraine' );
insert into llx_c_pays (rowid,code,libelle) values (227, 'AE', 'Emirats arabes unis');
insert into llx_c_pays (rowid,code,libelle) values (228, 'UM', 'Iles mineures éloignées des états-Unis');
insert into llx_c_pays (rowid,code,libelle) values (229, 'UY', 'Uruguay' );
insert into llx_c_pays (rowid,code,libelle) values (230, 'UZ', 'Ouzbékistan' );
insert into llx_c_pays (rowid,code,libelle) values (231, 'VU', 'Vanuatu' );
insert into llx_c_pays (rowid,code,libelle) values (232, 'VE', 'Vénézuela' );
insert into llx_c_pays (rowid,code,libelle) values (233, 'VN', 'Viêt Nam' );
insert into llx_c_pays (rowid,code,libelle) values (234, 'VG', 'Iles Vierges britanniques');
insert into llx_c_pays (rowid,code,libelle) values (235, 'VI', 'Iles Vierges américaines');
insert into llx_c_pays (rowid,code,libelle) values (236, 'WF', 'Wallis-et-Futuna');
insert into llx_c_pays (rowid,code,libelle) values (237, 'EH', 'Sahara occidental');
insert into llx_c_pays (rowid,code,libelle) values (238, 'YE', 'Yémen' );
insert into llx_c_pays (rowid,code,libelle) values (239, 'ZM', 'Zambie' );
insert into llx_c_pays (rowid,code,libelle) values (240, 'ZW', 'Zimbabwe' );
delete from llx_c_regions where rowid='2901' and code_region='2901';
delete from llx_c_departements where fk_region='2901';
insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (2801,28,2801, '',0,'Australia');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'NSW','',1,'','New South Wales');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'VIC','',1,'','Victoria');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'QLD','',1,'','Queensland');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801, 'SA','',1,'','South Australia');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'ACT','',1,'','Australia Capital Territory');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'TAS','',1,'','Tasmania');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801, 'WA','',1,'','Western Australia');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801, 'NT','',1,'','Northern Territory');
delete from llx_c_tva where rowid='291' and fk_pays='5';
delete from llx_c_tva where rowid='292' and fk_pays='5';
delete from llx_c_tva where rowid='291' and fk_pays='29';
delete from llx_c_tva where rowid='292' and fk_pays='29';
delete from llx_c_tva where rowid='261' and fk_pays='26';
delete from llx_c_tva where rowid='262' and fk_pays='26';
delete from llx_c_tva where rowid='263' and fk_pays='26';
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (281, 28, '10','0','VAT Rate 10',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (282, 28, '0','0','VAT Rate 0',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (251,25, '17','0','VAT Rate 17',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (252,25, '12','0','VAT Rate 12',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (253,25, '0','0','VAT Rate 0',1);
update llx_const set name='DON_ADDON_MODEL' where name='DON_ADDON';
update llx_const set value='neptune' where value='pluton' and name = 'FACTURE_ADDON';
update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON';
update llx_const set value='mod_commande_diamant' where value='mod_commande_jade' and name ='COMMANDE_ADDON';
insert into llx_const (name, value, type, visible) values ('FICHEINTER_ADDON', 'pacific','chaine',0);
alter table llx_propal_model_pdf rename to llx_document_model;
alter table llx_document_model DROP PRIMARY KEY;
alter table llx_document_model add column rowid integer AUTO_INCREMENT PRIMARY KEY FIRST;
alter table llx_document_model add column type varchar(20) NOT NULL after nom;
update llx_document_model set type='propal' where type='';
delete from llx_document_model where nom='adytek';
delete from llx_document_model where nom='rouge' and type='order';
delete from llx_document_model where nom='azur' and type='order';
delete from llx_document_model where nom='orange' and type='propal';
delete from llx_document_model where nom='transporteur' and type='shipping';
delete from llx_document_model where nom='dorade' and type='shipping';
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber);
alter table llx_facture_rec add column remise_absolue real default 0 after remise_percent;
alter table llx_facture_rec add column fk_mode_reglement integer default 0 after fk_cond_reglement;
alter table llx_facture_rec add column date_lim_reglement date after fk_mode_reglement;
alter table llx_facture_rec add column note_public text after note;
update llx_facture_rec set fk_mode_reglement='0' where fk_mode_reglement='NULL';
ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_soc (fk_soc);
ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_user_author (fk_user_author);
ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_projet (fk_projet);
ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
ALTER TABLE llx_facture_rec ADD UNIQUE INDEX idx_facture_rec_uk_titre (titre);
ALTER TABLE llx_commandedet ADD COLUMN fk_remise_except integer NULL AFTER remise;
ALTER TABLE llx_commandedet ADD COLUMN special_code tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE llx_propaldet ADD COLUMN fk_remise_except integer NULL AFTER remise;
ALTER TABLE llx_contratdet ADD COLUMN fk_remise_except integer NULL AFTER remise;
create table llx_livraison
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_commande integer DEFAULT 0,
fk_expedition integer,
ref varchar(30) NOT NULL,
date_creation datetime,
date_valid datetime,
fk_user_author integer,
fk_user_valid integer,
fk_statut smallint default 0,
note text,
note_public text,
model_pdf varchar(50),
date_livraison date default NULL,
fk_adresse_livraison integer,
UNIQUE INDEX (ref),
key(fk_commande)
)ENGINE=innodb;
alter table llx_livraison drop foreign key fk_livraison_societe;
alter table llx_livraison drop column fk_soc;
create table llx_livraisondet
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_livraison integer,
fk_commande_ligne integer NOT NULL,
qty real,
key(fk_livraison),
key(fk_commande_ligne)
)ENGINE=innodb;
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (90, 'commande', 'internal', 'SALESREPSIGN', 'Commercial signataire de la commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (91, 'commande', 'internal', 'SALESREPFOLL', 'Commercial suivi de la commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (100, 'commande', 'external', 'BILLING', 'Contact client facturation commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (101, 'commande', 'external', 'CUSTOMER', 'Contact client suivi commande', 1);
alter table llx_bank_account add column ref varchar(12) NOT NULL;
alter table llx_bank_account add column url varchar(128);
alter table llx_bank_account add column currency_code varchar(2) NOT NULL;
alter table llx_bank_account add column min_allowed integer DEFAULT 0;
alter table llx_bank_account add column min_desired integer DEFAULT 0;
alter table llx_bank_account add column comment varchar(254);
alter table llx_bank_account modify bic varchar(11);
update llx_bank_account set currency_code='EU';
update llx_bank_account set rappro=0 where courant=2;
ALTER TABLE llx_bank ADD COLUMN fk_bordereau INTEGER DEFAULT 0;
ALTER TABLE llx_bank ADD COLUMN banque varchar(255);
ALTER TABLE llx_bank ADD COLUMN emetteur varchar(255);
alter table llx_accountingsystem_det rename to llx_accountingaccount;
insert into llx_rights_def (id, libelle, module, type, bydefault, subperms, perms) values (262,'Consulter tous les clients','commercial','r',1,'voir','client');
-- V4.1 insert into llx_user_rights(fk_user,fk_id) select distinct fk_user, '262' from llx_user_rights where fk_id = 261;
update llx_rights_def set subperms='creer' where subperms='supprimer' AND module='user' AND perms='self' AND id=255;
update llx_rights_def set module='tax' where module='compta' AND id in ('91','92','93');
update llx_rights_def set subperms='receptionner' where id=186;
alter table llx_commandedet add column rang integer DEFAULT 0;
alter table llx_propaldet add column rang integer DEFAULT 0;
alter table llx_facture drop column model;
alter table llx_facture add column model_pdf varchar(50) after note_public;
alter table llx_facture drop foreign key fk_facture_fk_facture;
alter table llx_facture drop column fk_facture;
alter table llx_facture add column fk_facture_source integer after fk_user_valid;
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_facture_source (fk_facture_source);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_source_fk_facture FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid);
alter table llx_facture add column type smallint DEFAULT 0 NOT NULL after facnumber;
-- Supprimme orphelins pour permettre montée de la clé
-- V4 DELETE llx_commandedet FROM llx_commandedet LEFT JOIN llx_commande ON llx_commandedet.fk_commande = llx_commande.rowid WHERE llx_commande.rowid IS NULL;
ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_commande (fk_commande);
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid);
-- drop table llx_societe_remise_except;
create table llx_societe_remise_except
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_soc integer NOT NULL,
datec datetime,
amount_ht real NOT NULL,
fk_user integer NOT NULL,
fk_facture integer,
description varchar(255) NOT NULL
)ENGINE=innodb;
alter table llx_societe_remise_except ADD COLUMN amount_tva real DEFAULT 0 NOT NULL after amount_ht;
alter table llx_societe_remise_except ADD COLUMN amount_ttc real DEFAULT 0 NOT NULL after amount_tva;
alter table llx_societe_remise_except ADD COLUMN tva_tx real DEFAULT 0 NOT NULL after amount_ttc;
alter table llx_societe_remise_except ADD COLUMN fk_facture_source integer after fk_user;
update llx_societe_remise_except set amount_tva=0, tva_tx=0, amount_ttc = amount_ht where amount_ttc = 0;
delete from llx_societe_remise_except WHERE amount_ht=0;
-- Supprimme orphelins pour permettre montée de la clé
-- V4 DELETE llx_societe_remise_except FROM llx_societe_remise_except LEFT JOIN llx_facturedet ON llx_societe_remise_except.fk_facture = llx_facturedet.rowid WHERE llx_facturedet.rowid IS NULL;
ALTER TABLE llx_societe_remise_except DROP FOREIGN KEY fk_societe_remise_fk_facture;
ALTER TABLE llx_societe_remise_except DROP FOREIGN KEY fk_societe_remise_fk_facture_source;
ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_user (fk_user);
ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_soc (fk_soc);
ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture (fk_facture);
ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture_source (fk_facture_source);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facturedet (rowid);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture_source FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid);
update llx_societe_remise_except set description='Remise sans description' where description is NULL or description ='';
alter table llx_societe_remise_except modify description varchar(255) NOT NULL;
insert into llx_const (name, value, type, visible, note) VALUES ('PROPALE_VALIDITY_DURATION', '15', 'chaine', 0, 'Durée de validitée des propales');
alter table llx_propal add column ref_client varchar(30) after ref;
alter table llx_societe_adresse_livraison drop column fk_departement;
alter table llx_user change datelastaccess datelastlogin datetime;
alter table llx_user add column datepreviouslogin datetime after datelastlogin;
alter table llx_user add column ldap_sid varchar(255) DEFAULT NULL;
alter table llx_user add column statut tinyint DEFAULT 1;
alter table llx_user add column lang varchar(6);
alter table llx_user add column pass_crypted varchar(128) after pass;
alter table llx_user add column office_phone varchar(20);
alter table llx_user add column office_fax varchar(20);
alter table llx_user add column user_mobile varchar(20);
alter table llx_user modify login varchar(24) NOT NULL;
alter table llx_user drop code;
update llx_user set pass_crypted = MD5(pass) where pass IS NOT NULL AND pass_crypted IS NULL and length(pass) < 32;
update llx_user set pass_crypted = pass where pass IS NOT NULL AND pass_crypted IS NULL and length(pass) = 32;
update llx_user set pass = NULL where length(pass) = 32;
ALTER TABLE llx_user modify fk_societe integer;
ALTER TABLE llx_user modify fk_socpeople integer;
alter table llx_user add column fk_member integer after fk_socpeople;
update llx_user set fk_societe = NULL where fk_societe = 0;
update llx_user set fk_socpeople = NULL where fk_socpeople = 0;
update llx_user set fk_member = NULL where fk_member = 0;
ALTER TABLE llx_user DROP INDEX login;
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login);
ALTER TABLE llx_user ADD INDEX uk_user_fk_societe (fk_societe);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_socpeople (fk_socpeople);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_member (fk_member);
alter table llx_boxes add column fk_user integer;
alter table llx_commande_fournisseur drop column fk_soc_contact;
alter table llx_commande drop column fk_soc_contact;
alter table llx_livraison drop column fk_soc_contact;
alter table llx_propal drop column fk_soc_contact;
alter table llx_commandedet drop column label;
insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_VAL_ORDER_SUUPLIER','Validation commande fournisseur','Déclenché lors de la validation d\'une commande fournisseur','order_supplier');
drop table if exists llx_sqltables;
ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_1;
ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_2;
ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_3;
ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_4;
ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_5;
ALTER TABLE llx_categorie_product ADD CONSTRAINT fk_categorie_product_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_product ADD CONSTRAINT fk_categorie_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
ALTER TABLE llx_categorie_product ADD PRIMARY KEY (fk_categorie, fk_product);
alter table llx_product modify label varchar(255) NOT NULL;
alter table llx_product modify description text;
ALTER TABLE llx_product ADD COLUMN price_base_type varchar(3) DEFAULT 'HT' AFTER price;
ALTER TABLE llx_product ADD COLUMN price_ttc float(12,4) DEFAULT 0 AFTER price_base_type;
alter table llx_product_det modify label varchar(255) NOT NULL;
alter table llx_product_det modify description text;
create table llx_accountingdebcred
(
fk_transaction integer NOT NULL,
fk_account integer NOT NULL,
amount real NOT NULL,
direction varchar(1) NOT NULL
)ENGINE=innodb;
alter table llx_facturedet_rec add column total_ht real;
alter table llx_facturedet_rec add column total_tva real;
alter table llx_facturedet_rec add column total_ttc real;
alter table llx_adherent add column phone varchar(30) after email;
alter table llx_adherent add column phone_perso varchar(30) after phone;
alter table llx_adherent add column phone_mobile varchar(30) after phone_perso;
delete from llx_adherent_type where libelle IS NULL;
alter table llx_adherent_type modify libelle varchar(50) NOT NULL;
update llx_facture set fk_facture_source=null where fk_facture_source is not null and type = 0;
update llx_facture set fk_statut=2 where paye=1;
update llx_facture set fk_statut=2 where close_code is not null and close_code != '' and close_code != 'replaced';
update llx_boxes set fk_user = 0 where fk_user IS NULL;
ALTER TABLE llx_boxes modify fk_user integer default 0 NOT NULL;
-- Supprimme orphelins pour permettre montee de la cle
-- V4 DELETE llx_boxes FROM llx_boxes LEFT JOIN llx_boxes_def ON llx_boxes.box_id = llx_boxes_def.rowid WHERE llx_boxes_def.rowid IS NULL;
ALTER TABLE llx_boxes ADD INDEX idx_boxes_boxid (box_id);
-- V4 ALTER TABLE llx_boxes ADD CONSTRAINT fk_boxes_box_id FOREIGN KEY (box_id) REFERENCES llx_boxes_def (rowid);
ALTER TABLE llx_boxes ADD INDEX idx_boxes_fk_user (fk_user);
create table llx_categorie_fournisseur
(
fk_categorie integer NOT NULL,
fk_societe integer NOT NULL,
UNIQUE (fk_categorie, fk_societe)
)ENGINE=innodb;
create table llx_fournisseur_ca
(
fk_societe integer,
date_calcul datetime,
year smallint UNSIGNED,
ca_genere float,
UNIQUE (fk_societe, year)
)ENGINE=innodb;
alter table llx_fournisseur_ca add ca_achat float(11,2) DEFAULT 0;
create table llx_product_ca
(
fk_product integer,
date_calcul datetime,
year smallint UNSIGNED,
ca_genere float,
UNIQUE (fk_product, year)
)ENGINE=innodb;
create table llx_commande_fournisseur_dispatch
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_commande integer,
fk_product integer,
qty float, -- quantit<69>
fk_entrepot integer,
fk_user integer,
datec datetime
)ENGINE=innodb;
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX (fk_commande);
create table llx_stock_valorisation
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, -- date technique mise a jour automatiquement
date_valo datetime, -- date de valorisation
fk_product integer NOT NULL, -- id du produit concerne par l'operation
qty_ope float(9,3), -- quantite de l'operation
price_ope float(12,4), -- prix unitaire du produit concerne par l'operation
valo_ope float(12,4), -- valorisation de l'operation
price_pmp float(12,4), -- valeur PMP de l'operation
qty_stock float(9,3) DEFAULT 0, -- qunatite en stock
valo_pmp float(12,4), -- valorisation du stock en PMP
fk_stock_mouvement integer, -- id du mouvement de stock
key(fk_product)
)ENGINE=innodb;
create table llx_entrepot_valorisation
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, -- date technique mise a jour automatiquement
date_calcul date, -- date auquel a ete calcule la valeur
fk_entrepot integer UNSIGNED NOT NULL ,
valo_pmp float(12,4), -- valoristaion du stock en PMP
key(fk_entrepot)
)ENGINE=innodb;
ALTER TABLE llx_entrepot ADD COLUMN valo_pmp float(12,4) DEFAULT 0;
create table llx_user_entrepot
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_entrepot integer UNSIGNED, -- pointe sur llx_entrepot
fk_user integer UNSIGNED, -- pointe sur llx_user
consult tinyint(1) UNSIGNED,
send tinyint(1) UNSIGNED
)ENGINE=innodb;
create table llx_product_subproduct
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_product integer NOT NULL, -- id du produit maitre
fk_product_subproduct integer NOT NULL, -- id du sous-produit
UNIQUE(fk_product, fk_product_subproduct)
)ENGINE=innodb;
create table llx_bordereau_cheque
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime,
date_bordereau date,
number mediumint,
amount float(12,2),
nbcheque smallint UNSIGNED DEFAULT 0,
fk_bank_account integer,
fk_user_author integer,
note text,
statut tinyint(1) UNSIGNED DEFAULT 0
)ENGINE=innodb;
alter table llx_product_price add price_level tinyint(4) NULL DEFAULT 1;
alter table llx_product_price add column price_ttc float(12,4) DEFAULT 0 after price;
alter table llx_product_price add column price_base_type varchar(3) DEFAULT 'HT' after price_ttc;
ALTER TABLE llx_document_model ADD UNIQUE uk_document_model (nom,type);
ALTER TABLE llx_chargesociales drop column date_pai;
UPDATE llx_facture SET type=0 where type=3;
create table llx_export_model
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(50) NOT NULL,
type varchar(20) NOT NULL,
field text
)ENGINE=innodb;
ALTER table llx_export_model add fk_user integer DEFAULT 0 NOT NULL after rowid;
ALTER TABLE llx_export_model ADD UNIQUE uk_export_model (label);
UPDATE llx_rights_def SET ID=ID+1001 WHERE ID BETWEEN 180 AND 189 AND module='fournisseur';
UPDATE llx_user_rights SET fk_id=fk_id+1001 WHERE fk_id BETWEEN 180 AND 189;
UPDATE llx_usergroup_rights SET fk_id=fk_id+1001 WHERE fk_id BETWEEN 180 AND 189;
UPDATE llx_rights_def SET ID=ID+1000 WHERE ID BETWEEN 230 AND 236 AND module='fournisseur';
UPDATE llx_user_rights SET fk_id=fk_id+1000 WHERE fk_id BETWEEN 230 AND 236;
UPDATE llx_usergroup_rights SET fk_id=fk_id+1000 WHERE fk_id BETWEEN 230 AND 236;
UPDATE llx_rights_def SET ID=ID+1 WHERE ID BETWEEN 1320 AND 1320 AND module='facture';
UPDATE llx_user_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1320 AND 1320;
UPDATE llx_usergroup_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1320 AND 1320;
UPDATE llx_rights_def SET ID=ID+1 WHERE ID BETWEEN 1420 AND 1420 AND module='commande';
UPDATE llx_user_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1420 AND 1420;
UPDATE llx_usergroup_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1420 AND 1420;
-- Not used. Just to be compatible with upgrade process of higher versions
alter table llx_const add column entity integer DEFAULT 1 NOT NULL;

File diff suppressed because it is too large Load Diff

View File

@ -1,351 +0,0 @@
--
-- Attention a l ordre des requetes.
-- Ce fichier doit etre charge sur une version 2.2.0
--
DROP TABLE llx_facture_tva_sum;
DROP TABLE llx_c_ape;
delete from llx_const where name='MAIN_GRAPH_LIBRARY' and (value like 'phplot%' or value like 'artichow%');
ALTER TABLE llx_societe_adresse_livraison ADD COLUMN tel varchar(20) after fk_pays;
ALTER TABLE llx_societe_adresse_livraison ADD COLUMN fax varchar(20) after tel;
RENAME TABLE llx_c_barcode TO llx_c_barcode_type;
alter table llx_c_barcode_type modify coder varchar(16) NOT NULL;
update llx_c_barcode_type set coder = 0 where coder in (1,2);
update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_ALL' and value='MAIN_FORCE_SETLOCALE_LC_ALL';
update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_MONETARY' and value='MAIN_FORCE_SETLOCALE_LC_MONETARY';
update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_NUMERIC' and value='MAIN_FORCE_SETLOCALE_LC_NUMERIC';
update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_TIME' and value='MAIN_FORCE_SETLOCALE_LC_TIME';
-- remove old deprecated options
update llx_const set name='SOCIETE_CODECLIENT_ADDON' where name='CODECLIENT_ADDON';
update llx_const set name='SOCIETE_CODEFOURNISSEUR_ADDON' where name='CODEFOURNISSEUR_ADDON';
delete from llx_const where name='CODECLIENT_ADDON';
delete from llx_const where name='CODEFOURNISSEUR_ADDON';
alter table llx_const add tms timestamp;
update llx_const set tms=sysdate() where tms is null;
update llx_const set tms=sysdate() where tms <= 0;
alter table llx_document_model modify type varchar(20) NOT NULL;
DELETE FROM llx_rights_def WHERE module = 'menudb';
ALTER table llx_boxes_def drop column name;
ALTER table llx_boxes_def add column tms timestamp;
-- Rename primary key of llx_menu
ALTER TABLE llx_menu_const drop foreign key fk_menu_const_fk_menu;
alter table llx_menu drop primary key;
alter table llx_menu modify rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY;
ALTER TABLE llx_menu_const ADD CONSTRAINT fk_menu_const_fk_menu FOREIGN KEY (fk_menu) REFERENCES llx_menu (rowid);
alter table llx_menu modify user integer NOT NULL default '0';
alter table llx_menu change `order` position integer NOT NULL;
alter table llx_menu change `right` perms varchar(255);
alter table llx_menu add column module varchar(64) after menu_handler;
alter table llx_menu add column tms timestamp;
-- Add a unique key
update llx_menu set url='/comm/prospect/prospects.php?leftmenu=prospects' where rowid=702 and url='/contact/index.php?leftmenu=prospects&type=p';
ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, url);
-- Drop unused table
drop table if exists llx_so_gr;
-- Modification expedition
create table llx_co_exp
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_commande integer NOT NULL,
fk_expedition integer NOT NULL,
key(fk_commande),
key(fk_expedition)
)ENGINE=innodb;
-- V4 ALTER TABLE llx_expedition DROP INDEX fk_expedition_methode;
-- V4 ALTER TABLE llx_expedition DROP INDEX fk_commande;
-- V4 ALTER TABLE llx_expedition DROP INDEX ref;
-- V4 ALTER TABLE llx_expeditiondet DROP INDEX fk_expedition;
-- V4 ALTER TABLE llx_expeditiondet DROP INDEX fk_commande_ligne;
-- V4.1 update llx_commande set fk_adresse_livraison = null where fk_adresse_livraison is not null and fk_adresse_livraison not in (select rowid from llx_societe_adresse_livraison);
-- V4.1 delete from llx_expeditiondet where fk_expedition not in (select rowid from llx_expedition);
-- V4.1 delete from llx_livraisondet where fk_livraison not in (select rowid from llx_livraison);
alter table llx_expedition add column fk_soc integer NOT NULL after ref;
alter table llx_expedition add column fk_adresse_livraison integer DEFAULT NULL after date_expedition;
-- V4.1 UPDATE llx_expedition as e SET e.fk_soc = (SELECT c.fk_soc FROM llx_commande AS c WHERE e.fk_commande = c.rowid);
-- V4.1 UPDATE llx_expedition as e SET e.fk_adresse_livraison = (SELECT c.fk_adresse_livraison FROM llx_commande AS c WHERE e.fk_commande = c.rowid);
update llx_expedition set fk_adresse_livraison=NULL where fk_adresse_livraison = 0;
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_soc (fk_soc);
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_author (fk_user_author);
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_valid (fk_user_valid);
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_adresse_livraison (fk_adresse_livraison);
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_expedition_methode (fk_expedition_methode);
-- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
-- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
-- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
-- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_adresse_livraison FOREIGN KEY (fk_adresse_livraison) REFERENCES llx_societe_adresse_livraison (rowid);
-- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode FOREIGN KEY (fk_expedition_methode) REFERENCES llx_expedition_methode (rowid);
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref);
ALTER TABLE llx_expeditiondet CHANGE fk_commande_ligne fk_origin_line integer;
ALTER TABLE llx_expeditiondet ADD COLUMN fk_entrepot integer after fk_origin_line;
ALTER TABLE llx_expeditiondet ADD COLUMN rang integer DEFAULT 0 after qty;
-- V4.1 UPDATE llx_expeditiondet as ed SET ed.fk_entrepot = (SELECT e.fk_entrepot FROM llx_expedition AS e WHERE ed.fk_expedition = e.rowid);
ALTER TABLE llx_expedition DROP COLUMN fk_entrepot;
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_expedition (fk_expedition);
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_entrepot (fk_entrepot);
-- V4 ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_expedition FOREIGN KEY (fk_expedition) REFERENCES llx_expedition (rowid);
-- V4 ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_entrepot FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid);
-- Modification livraison
create table llx_co_liv
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_commande integer NOT NULL,
fk_livraison integer NOT NULL,
key(fk_commande),
key(fk_livraison)
)ENGINE=innodb;
-- V4 ALTER TABLE llx_livraison DROP INDEX fk_commande;
-- V4 ALTER TABLE llx_livraison DROP INDEX ref;
-- V4 ALTER TABLE llx_livraisondet DROP INDEX fk_livraison;
-- V4 ALTER TABLE llx_livraisondet DROP INDEX fk_commande_ligne;
ALTER TABLE llx_livraison DROP COLUMN total_ttc;
ALTER TABLE llx_livraison add column total_ht double(24,8) DEFAULT 0;
ALTER TABLE llx_livraison MODIFY total_ht double(24,8) DEFAULT 0;
ALTER TABLE llx_livraison MODIFY fk_adresse_livraison integer DEFAULT NULL;
alter table llx_livraison add column ref_client varchar(30) after ref;
alter table llx_livraison add column fk_soc integer NOT NULL after ref_client;
UPDATE llx_livraison SET fk_adresse_livraison = NULL WHERE fk_adresse_livraison = 0;
-- V4.1 UPDATE llx_livraison as l SET l.fk_soc = (SELECT c.fk_soc FROM llx_commande AS c WHERE l.fk_commande = c.rowid);
ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_soc (fk_soc);
ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_user_author (fk_user_author);
ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_user_valid (fk_user_valid);
ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_adresse_livraison (fk_adresse_livraison);
-- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
-- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
-- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
-- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_adresse_livraison FOREIGN KEY (fk_adresse_livraison) REFERENCES llx_societe_adresse_livraison (rowid);
ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref);
alter table llx_livraisondet add column fk_product integer after fk_livraison;
alter table llx_livraisondet add column description text after fk_product;
alter table llx_livraisondet add column subprice double(24,8) DEFAULT 0 after qty;
alter table llx_livraisondet add column total_ht double(24,8) DEFAULT 0 after subprice;
alter table llx_livraisondet add column rang integer DEFAULT 0 after total_ht;
ALTER TABLE llx_livraisondet ADD INDEX idx_livraisondet_fk_expedition (fk_livraison);
-- V4 ALTER TABLE llx_livraisondet ADD CONSTRAINT fk_livraisondet_fk_livraison FOREIGN KEY (fk_livraison) REFERENCES llx_livraison (rowid);
create table llx_pr_exp
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_propal integer NOT NULL,
fk_expedition integer NOT NULL,
key(fk_propal),
key(fk_expedition)
)ENGINE=innodb;
create table llx_pr_liv
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_propal integer NOT NULL,
fk_livraison integer NOT NULL,
key(fk_propal),
key(fk_livraison)
)ENGINE=innodb;
ALTER TABLE llx_paiement modify fk_bank integer NOT NULL DEFAULT 0;
create table llx_element_element
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
sourceid integer NOT NULL,
sourcetype varchar(12) NOT NULL,
targetid integer NOT NULL,
targettype varchar(12) NOT NULL
) ENGINE=innodb;
ALTER TABLE llx_element_element
ADD UNIQUE INDEX idx_element_element_idx1 (sourceid, sourcetype, targetid, targettype);
ALTER TABLE llx_element_element ADD INDEX idx_element_element_targetid (targetid);
ALTER TABLE llx_actioncomm add column fk_user_mod integer after fk_user_author;
ALTER TABLE llx_actioncomm add column fk_user_done integer after fk_user_action;
--drop table if exists llx_events;
create table llx_events
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
type varchar(32) NOT NULL,
dateevent datetime,
fk_user integer,
description varchar(250) NOT NULL,
ip varchar(32) NOT NULL,
fk_object integer
) ENGINE=innodb;
ALTER TABLE llx_events ADD INDEX idx_events_dateevent (dateevent);
ALTER TABLE llx_c_forme_juridique ADD isvatexempted tinyint DEFAULT 0 NOT NULL after libelle;
ALTER TABLE llx_facturedet ADD product_type integer DEFAULT NULL after total_ttc;
ALTER TABLE llx_facture_fourn_det ADD product_type integer DEFAULT NULL after total_ttc;
-- V4.1 update llx_facturedet set product_type = 0 where fk_product in (select rowid from llx_product where fk_product_type = 0);
-- V4.1 update llx_facture_fourn_det set product_type = 0 where fk_product in (select rowid from llx_product where fk_product_type = 0);
-- V4.1 update llx_facturedet set product_type = 1 where fk_product in (select rowid from llx_product where fk_product_type = 1);
-- V4.1 update llx_facture_fourn_det set product_type = 1 where fk_product in (select rowid from llx_product where fk_product_type = 1);
-- V4.1 update llx_facturedet set product_type = 1 where product_type is null;
-- V4.1 update llx_facture_fourn_det set product_type = 1 where product_type is null;
create table llx_c_prospectlevel
(
code varchar(12) PRIMARY KEY,
label varchar(30),
sortorder smallint,
active smallint DEFAULT 1 NOT NULL
) ENGINE=innodb;
insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_UNKOWN', 'Unknown', 1);
insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2);
insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3);
insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4);
alter table llx_societe add column fk_prospectlevel varchar(12) after fournisseur;
alter table llx_societe modify tva_assuj tinyint DEFAULT 1;
--update llx_actioncomm set datea = datep where datea is null and percent = 100;
--update llx_actioncomm set datea2 = datea where datea2 is null and percent = 100;
update llx_actioncomm set datep = datea where datep is null and datea is not null;
update llx_actioncomm set datep = datec where datep is null and datea is null;
update llx_actioncomm set datep2 = datep where datep2 is null and percent = 100;
alter table llx_projet modify fk_soc integer;
update llx_rights_def set module='societe' where module='commercial' and perms='client' and subperms='voir';
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (25, 'Impots revenus', 0,1,'TAXREV');
alter table llx_socpeople add priv smallint NOT NULL DEFAULT 0 after jabberid;
alter table llx_tva modify fk_bank integer;
delete from llx_const where name='MAIN_USE_PREVIEW_TABS';
alter table llx_menu_const drop column user;
update llx_menu set leftmenu = '1' where leftmenu != '0';
alter table llx_menu modify leftmenu varchar(1) default '1';
create table llx_ecm_directories
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(32) NOT NULL,
fk_parent integer,
description varchar(255) NOT NULL,
cachenbofdoc integer NOT NULL DEFAULT 0,
date_c datetime,
date_m timestamp,
fk_user_c integer,
fk_user_m integer
) ENGINE=innodb;
create table llx_ecm_documents
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(16) NOT NULL,
filename varchar(255) NOT NULL,
filesize integer NOT NULL,
filemime varchar(32) NOT NULL,
fullpath_dol varchar(255) NOT NULL,
fullpath_orig varchar(255) NOT NULL,
description text,
manualkeyword text,
fk_create integer NOT NULL,
fk_update integer,
date_c datetime NOT NULL,
date_u timestamp,
fk_directory integer,
fk_status smallint DEFAULT 0,
private smallint DEFAULT 0
) ENGINE=innodb;
ALTER TABLE llx_bank modify num_chq varchar(50);
ALTER TABLE llx_menu_const ADD UNIQUE KEY uk_menu_const(fk_menu, fk_constraint);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (100, 'USLetter', 'Format Letter (A)', '216', '279', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (105, 'USLegal', 'Format Legal', '216', '356', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (110, 'USExecutive', 'Format Executive', '190', '254', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (115, 'USLedger', 'Format Ledger/Tabloid (B)', '279', '432', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (200, 'Canadian P1', 'Format Canadian P1', '560', '860', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (205, 'Canadian P2', 'Format Canadian P2', '430', '560', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (210, 'Canadian P3', 'Format Canadian P3', '280', '430', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (215, 'Canadian P4', 'Format Canadian P4', '215', '280', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (220, 'Canadian P5', 'Format Canadian P5', '140', '215', 'mm', 0);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (225, 'Canadian P6', 'Format Canadian P6', '107', '140', 'mm', 0);
ALTER TABLE llx_commande_fournisseurdet DROP COLUMN price;
alter table llx_adherent modify fk_user_mod integer;
alter table llx_adherent modify fk_user_valid integer;
create table llx_c_type_fees
(
id integer AUTO_INCREMENT PRIMARY KEY,
code varchar(12) UNIQUE NOT NULL,
libelle varchar(30),
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;
alter table llx_deplacement modify type varchar(12) NOT NULL;
alter table llx_deplacement modify km real;
insert into llx_c_type_fees (code,libelle,active) values ('TF_OTHER', 'Other', 1);
insert into llx_c_type_fees (code,libelle,active) values ('TF_TRIP', 'Trip', 1);
insert into llx_c_type_fees (code,libelle,active) values ('TF_LUNCH', 'Lunch', 1);
drop table llx_comfourn_facfourn;
alter table llx_element_element modify sourcetype varchar(16) NOT NULL;
alter table llx_element_element modify targettype varchar(16) NOT NULL;
update llx_societe set fk_typent = 0 where fk_typent is null;
ALTER TABLE llx_surveys_answers_summary ENGINE=innodb;
-- Not used. Just to be compatible with upgrade process of higher versions
alter table llx_const add column entity integer DEFAULT 1 NOT NULL;
-- Not used. Just to be compatible with 2.7 upgrade process or higher
alter table llx_menu add column enabled varchar(255) NULL default '1';

View File

@ -1,115 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 2.4.0 or higher.
--
alter table llx_product add column price_min double(24,8) DEFAULT 0;
alter table llx_product add column price_min_ttc double(24,8) DEFAULT 0;
alter table llx_product add column finished tinyint DEFAULT NULL after canvas;
alter table llx_product_price add column price_min double(24,8) default NULL;
alter table llx_product_price add column price_min_ttc double(24,8) default NULL;
alter table llx_societe add column gencod varchar(255);
delete from llx_user_param where page <> '';
alter table llx_expedition add column tracking_number varchar(50) after fk_expedition_methode;
alter table llx_actioncomm add column location varchar(128) after percent;
-- remove enum type
alter table llx_adherent_type modify column cotisation varchar(3) NOT NULL DEFAULT 'yes';
alter table llx_adherent_type modify column vote varchar(3) NOT NULL DEFAULT 'yes';
alter table llx_adherent modify column morphy varchar(3) NOT NULL;
alter table llx_c_paper_format modify column unit varchar(5) NOT NULL;
alter table llx_const modify column type varchar(6);
alter table llx_menu modify column type varchar(4) NOT NULL;
alter table llx_notify modify column objet_type varchar(24) NOT NULL;
alter table llx_projet_task_actors modify column role varchar(5) DEFAULT 'admin';
alter table llx_projet_task modify column statut varchar(6) DEFAULT 'open';
alter table llx_rights_def modify column type varchar(1);
ALTER TABLE llx_menu ADD COLUMN enabled varchar(255) NULL default '1' after perms;
ALTER TABLE `llx_commandedet` ADD column `date_start` DATETIME DEFAULT NULL, ADD `date_end` DATETIME DEFAULT NULL ;
alter table llx_categorie add column fk_soc integer DEFAULT NULL after description;
alter table llx_product drop column nbvente;
alter table llx_product add column import_key varchar(14);
alter table llx_socpeople add column import_key varchar(14);
alter table llx_facture add column import_key varchar(14);
alter table llx_facturedet add column import_key varchar(14);
alter table llx_commande add column import_key varchar(14);
alter table llx_commandedet add column import_key varchar(14);
alter table llx_facture_fourn add column import_key varchar(14);
alter table llx_facture_fourn_det add column import_key varchar(14);
alter table llx_commande modify column source smallint NULL;
update llx_c_prospectlevel set code='PL_NONE', label='None' where code='PL_UNKOWN' or code='PL_NONE';
update llx_societe set fk_prospectlevel=null where fk_prospectlevel='PL_UNKOWN';
alter table llx_expedition add height integer;
alter table llx_expedition add width integer;
alter table llx_expedition add size_units integer;
alter table llx_expedition add size integer;
alter table llx_expedition add weight_units integer;
alter table llx_expedition add weight integer;
ALTER TABLE llx_paiement_facture ADD UNIQUE INDEX uk_paiement_facture(fk_paiement, fk_facture);
ALTER TABLE llx_paiementfourn_facturefourn ADD UNIQUE INDEX uk_paiementfourn_facturefourn(fk_paiementfourn, fk_facturefourn);
update llx_expedition_methode set code='ENL', libelle='Enlevement' where code='enlevement';
update llx_expedition_methode set code='TRANS', libelle='Transporteur' where code='transporteur';
alter table llx_fichinterdet modify date datetime;
alter table llx_don modify fk_don_projet integer NULL;
alter table llx_don modify fk_user_valid integer NULL;
alter table llx_don add note_public text;
alter table llx_don add model_pdf varchar(50);
alter table llx_don add import_key varchar(14);
ALTER TABLE llx_export_model DROP INDEX uk_export_model;
ALTER TABLE llx_export_model ADD UNIQUE uk_export_model (label,type);
alter table llx_adherent_options_label add column type varchar(8);
alter table llx_adherent_options_label add column size integer DEFAULT 0;
alter table llx_adherent_options_label add column pos integer DEFAULT 0;
-- Reverse option
update llx_const set visible = 1, name = 'FACTURE_ENABLE_RECUR', value='1' where name = 'FACTURE_DISABLE_RECUR' and value = '0';
delete from llx_const where name = 'FACTURE_DISABLE_RECUR' and value = '1';
delete from llx_const where name like 'MAIN_FASTSEARCH_%';
alter table llx_bank_account modify comment text;
update llx_bank_account set ref = label where ref is null or ref = '';
-- 2.5.1
update llx_actioncomm set datep = datea where datep is null;
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (70, 'facture_fourn', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (71, 'facture_fourn', 'external', 'BILLING', 'Contact fournisseur facturation', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
alter table llx_product_stock add column pmp double(24,8) default 0 NOT NULL;
alter table llx_expedition_methode change statut active tinyint DEFAULT 1;
INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (1,'CATCH','Catch','Catch by client',1);
INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (2,'TRANS','Transporter','Generic transporter',1);
INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi',0);
-- Not used. Just to be compatible with upgrade process of higher versions
alter table llx_const add column entity integer DEFAULT 1 NOT NULL;
-- Not used. Just to be compatible with 2.7 upgrade process or higher
alter table llx_menu add column enabled varchar(255) NULL default '1';

View File

@ -1,139 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 2.5.0 or higher.
--
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (140,'order_supplier','internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (141,'order_supplier','internal', 'SHIPPING', 'Responsable reception de la commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (142,'order_supplier','external', 'BILLING', 'Contact fournisseur facturation commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (143,'order_supplier','external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (145,'order_supplier','external', 'SHIPPING', 'Contact fournisseur livraison commande', 1);
update llx_const set visible = 1 where name = 'PROPALE_ADD_DELIVERY_ADDRESS';
delete from llx_const where name like 'MAIN_LOGEVENTS_%' and name not like 'MAIN_LOGEVENTS_USER%' and name not like 'MAIN_LOGEVENTS_GROUP%';
delete from llx_events where type not like 'USER%' and type not like 'GROUP%';
alter table llx_expedition_methode change statut active tinyint DEFAULT 1;
update llx_actioncomm set datep = datea where datep is null;
INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (1,'CATCH','Catch','Catch by client',1);
INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (2,'TRANS','Transporter','Generic transporter',1);
INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi',0);
UPDATE llx_expedition_methode set code='CATCH', libelle='Catch', description='Catch by client' where rowid=1;
UPDATE llx_expedition_methode set code='TRANS', libelle='Transporter', description='Generic transporter' where rowid=2;
UPDATE llx_expedition_methode set code='COLSUI', libelle='Colissimo Suivi', description='Colissimo Suivi' where rowid=3;
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (70, 'facture_fourn', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (71, 'facture_fourn', 'external', 'BILLING', 'Contact fournisseur facturation', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
alter table llx_product_stock add column pmp double(24,8) default 0 NOT NULL;
alter table llx_product add column pmp double(24,8) default 0 NOT NULL;
alter table llx_product_stock modify column reel real;
ALTER TABLE llx_bank ADD INDEX idx_bank_datev(datev);
ALTER TABLE llx_bank ADD INDEX idx_bank_dateo(dateo);
ALTER TABLE llx_bank ADD INDEX idx_bank_fk_account(fk_account);
ALTER TABLE llx_bank ADD INDEX idx_bank_rappro(rappro);
ALTER TABLE llx_mailing_cibles add column other varchar(255) NULL;
ALTER TABLE llx_mailing_cibles ADD INDEX idx_mailing_cibles_email (email);
ALTER TABLE llx_categorie ADD INDEX idx_categorie_type (type);
ALTER TABLE llx_product drop column stock_propale;
ALTER TABLE llx_product drop column stock_commande;
ALTER TABLE llx_product add column stock integer after import_key;
ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode);
ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key);
ALTER TABLE llx_adherent drop index login;
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login);
ALTER TABLE llx_adherent add column fk_soc integer NULL after societe;
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc);
ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_adherent modify column fk_user_author integer NULL;
ALTER TABLE llx_societe drop column rubrique;
-- SAINT PIERRE ET MIQUELON
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1931,193, '0','0','No VAT in SPM',1);
-- SAINT MARTIN
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2461,246, '0','0','VAT Rate 0',1);
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'35','Regime auto-entrepreneur');
alter table llx_user_param drop column page;
alter table llx_commande_fournisseur_log add column comment varchar(255) NULL;
delete from llx_categorie_association where fk_categorie_mere = fk_categorie_fille;
alter table llx_societe add price_level tinyint(4) NULL;
delete from llx_document_model where nom = 'huitre' and type = 'invoice';
drop table llx_don_projet;
alter table llx_facture_fourn_det add column date_start datetime DEFAULT NULL;
alter table llx_facture_fourn_det add column date_end datetime DEFAULT NULL;
alter table llx_commandedet add column product_type integer DEFAULT 0 after total_ttc;
alter table llx_propaldet add column product_type integer DEFAULT 0 after total_ttc;
alter table llx_propaldet add column date_start datetime DEFAULT NULL after product_type;
alter table llx_propaldet add column date_end datetime DEFAULT NULL after date_start;
alter table llx_commande_fournisseurdet add column product_type integer DEFAULT 0 after total_ttc;
alter table llx_commande_fournisseurdet add column date_start datetime DEFAULT NULL after product_type;
alter table llx_commande_fournisseurdet add column date_end datetime DEFAULT NULL after date_start;
alter table llx_commande_fournisseur drop column product_type;
alter table llx_commande_fournisseur drop column date_start;
alter table llx_commande_fournisseur drop column date_end;
drop table llx_models;
-- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet);
-- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
ALTER TABLE llx_adherent modify fk_adherent_type integer NOT NULL;
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_adherent_type (fk_adherent_type);
-- V4.1 delete from llx_adherent where fk_adherent_type not in (select rowid from llx_adherent_type);
-- V4.1 ALTER TABLE llx_adherent ADD CONSTRAINT fk_adherent_adherent_type FOREIGN KEY (fk_adherent_type) REFERENCES llx_adherent_type (rowid);
-- Put at the end. Cas have duplicate values
ALTER TABLE llx_categorie_association drop index idx_categorie_association_fk_categorie_fille;
ALTER TABLE llx_categorie_association ADD UNIQUE INDEX uk_categorie_association (fk_categorie_mere, fk_categorie_fille);
ALTER TABLE llx_categorie_association ADD UNIQUE INDEX uk_categorie_association_fk_categorie_fille (fk_categorie_fille);
-- Multi company
ALTER TABLE llx_const ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER name;
ALTER TABLE llx_user ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER login;
ALTER TABLE llx_usergroup ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER nom;
ALTER TABLE llx_const DROP INDEX name;
ALTER TABLE llx_user DROP INDEX uk_user_login;
ALTER TABLE llx_usergroup DROP INDEX nom;
ALTER TABLE llx_const ADD UNIQUE INDEX uk_const (name, entity);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity);
ALTER TABLE llx_usergroup ADD UNIQUE INDEX uk_usergroup_name (nom, entity);
-- Not used. Just to be compatible with 2.7 upgrade process or higher
alter table llx_menu add column enabled varchar(255) NULL default '1';

View File

@ -1,476 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 2.6.0 or higher.
--
alter table llx_tmp_caisse modify fk_tva integer NOT NULL;
drop table llx_facture_stats;
drop table llx_stock_valorisation;
drop table llx_entrepot_valorisation;
drop table llx_groupesociete_remise;
drop table llx_groupesociete;
update llx_actioncomm set datep = datec where datep is null and datec is not null;
-- Create new table for import module
create table llx_import_model
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer DEFAULT 0 NOT NULL,
label varchar(50) NOT NULL,
type varchar(20) NOT NULL,
field text NOT NULL
)ENGINE=innodb;
update llx_bank_url set type='banktransfert' where type='?' and label='(banktransfert)';
ALTER TABLE llx_import_model ADD UNIQUE INDEX uk_import_model (label,type);
delete from llx_const where name = 'FACTURE_ENABLE_RECUR';
alter table llx_facturedet_rec add column product_type integer DEFAULT 0 after fk_product;
alter table llx_c_chargesociales change actioncompta code varchar(12) NOT NULL;
alter table llx_c_chargesociales add column fk_pays integer DEFAULT 1 NOT NULL;
-- Usage of llx_menu_const and llx_menu_constraint is too complicated
-- so we made first change to remove it
alter table llx_menu_const drop foreign key fk_menu_const_fk_menu;
update llx_menu_constraint set action = '$conf->societe->enabled' where action = '$conf->commercial->enabled';
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_fk_soc (fk_soc);
alter table llx_facture add column tms timestamp after date_valid;
alter table llx_facture_fourn add column tms timestamp after datef;
alter table llx_facture_fourn add column fk_facture_source integer after fk_user_valid;
update llx_facture set tms = datec where tms <= 0;
update llx_facture_fourn set tms = datec where tms <= 0;
-- Clean no more required parameters
delete from llx_const where name = 'MAIN_MODULE_COMMERCIAL';
delete from llx_const where name like 'MAIN_MODULE_%_DIR_OUTPUT';
delete from llx_const where name like 'MAIN_MODULE_%_DIR_TEMP';
delete from llx_const where name like 'PRODUIT_CONFIRM_DELETE_LINE';
delete from llx_const where name = 'MAIN_MODULE_SYSLOG' and entity = 2;
delete from llx_const where name = 'SYSLOG_FILE' and entity = 2;
delete from llx_const where name = 'SYSLOG_LEVEL' and entity = 2;
alter table llx_societe add column import_key varchar(14);
-- V4.1 delete from llx_paiementfourn where rowid not in (select fk_paiementfourn from llx_paiementfourn_facturefourn);
-- V4.1 delete from llx_paiementfourn_facturefourn where fk_facturefourn not in (select rowid from llx_facture_fourn);
-- Multi company
ALTER TABLE llx_rights_def ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER module;
ALTER TABLE llx_events ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER type;
ALTER TABLE llx_boxes_def ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER file;
ALTER TABLE llx_user_param ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER fk_user;
ALTER TABLE llx_societe ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER nom;
ALTER TABLE llx_socpeople ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER fk_soc;
ALTER TABLE llx_product ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_entrepot ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_chargesociales ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER libelle;
ALTER TABLE llx_tva ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_bank_account ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_document_model ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER nom;
ALTER TABLE llx_menu ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER menu_handler;
ALTER TABLE llx_ecm_directories ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_mailing ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER titre;
ALTER TABLE llx_categorie ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_propal ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_commande ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_commande_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_product_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref_fourn;
ALTER TABLE llx_facture ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_facture_fourn ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
ALTER TABLE llx_livraison ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_fichinter ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_contrat ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_c_barcode_type ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER code;
ALTER TABLE llx_dolibarr_modules ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER numero;
ALTER TABLE llx_bank_categ ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_bordereau_cheque ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER number;
ALTER TABLE llx_prelevement_bons ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_projet ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_adherent ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_adherent_type ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_adherent_options_label ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER name;
ALTER TABLE llx_facture_rec ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER fk_soc;
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY;
ALTER TABLE llx_adherent_options_label DROP PRIMARY KEY;
ALTER TABLE llx_adherent_options_label MODIFY COLUMN name varchar(64) NOT NULL;
ALTER TABLE llx_adherent_options_label ADD COLUMN rowid integer AUTO_INCREMENT PRIMARY KEY FIRST;
ALTER TABLE llx_user_param DROP INDEX fk_user;
ALTER TABLE llx_societe DROP INDEX uk_societe_prefix_comm;
ALTER TABLE llx_societe DROP INDEX uk_societe_code_client;
ALTER TABLE llx_product DROP INDEX uk_product_ref;
ALTER TABLE llx_entrepot DROP INDEX label;
ALTER TABLE llx_bank_account DROP INDEX uk_bank_account_label;
ALTER TABLE llx_document_model DROP INDEX uk_document_model;
ALTER TABLE llx_menu DROP INDEX idx_menu_uk_menu;
ALTER TABLE llx_categorie DROP INDEX uk_categorie_ref;
ALTER TABLE llx_propal DROP INDEX ref;
ALTER TABLE llx_commande DROP INDEX ref;
ALTER TABLE llx_commande_fournisseur DROP INDEX uk_commande_fournisseur_ref;
ALTER TABLE llx_product_fournisseur DROP INDEX fk_product;
ALTER TABLE llx_product_fournisseur DROP INDEX fk_soc;
ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber;
ALTER TABLE llx_expedition DROP INDEX idx_expedition_uk_ref;
ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref;
ALTER TABLE llx_livraison DROP INDEX idx_expedition_uk_ref;
ALTER TABLE llx_livraison DROP INDEX idx_livraison_uk_ref;
ALTER TABLE llx_fichinter DROP INDEX ref;
ALTER TABLE llx_prelevement_bons DROP INDEX ref;
ALTER TABLE llx_projet DROP INDEX ref;
ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def;
ALTER TABLE llx_adherent DROP INDEX uk_adherent_login;
ALTER TABLE llx_adherent_type DROP INDEX uk_adherent_type_libelle;
ALTER TABLE llx_facture_rec DROP INDEX idx_facture_rec_uk_titre;
ALTER TABLE llx_rights_def ADD PRIMARY KEY pk_rights_def (id, entity);
ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity);
ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity);
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_prefix_comm (prefix_comm, entity);
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_code_client (code_client, entity);
ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_ref (ref, entity);
ALTER TABLE llx_entrepot ADD UNIQUE INDEX uk_entrepot_label (label, entity);
ALTER TABLE llx_bank_account ADD UNIQUE INDEX uk_bank_account_label (label, entity);
ALTER TABLE llx_document_model ADD UNIQUE INDEX uk_document_model (nom, type, entity);
ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, url, entity);
ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label, type, entity);
ALTER TABLE llx_propal ADD UNIQUE INDEX uk_propal_ref (ref, entity);
ALTER TABLE llx_commande ADD UNIQUE INDEX uk_commande_ref (ref, entity);
ALTER TABLE llx_commande_fournisseur ADD UNIQUE INDEX uk_commande_fournisseur_ref (ref, fk_soc, entity);
ALTER TABLE llx_product_fournisseur ADD UNIQUE INDEX uk_product_fournisseur_ref (ref_fourn, fk_soc, entity);
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity);
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity);
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity);
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity);
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc, entity);
ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref, entity);
ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity);
ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity);
ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, entity);
ALTER TABLE llx_prelevement_bons ADD UNIQUE INDEX uk_prelevement_bons_ref (ref, entity);
ALTER TABLE llx_projet ADD UNIQUE INDEX uk_projet_ref (ref, entity);
ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity);
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login, entity);
ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity);
ALTER TABLE llx_adherent_options_label ADD UNIQUE INDEX uk_adherent_options_label_name (name, entity);
ALTER TABLE llx_facture_rec ADD UNIQUE INDEX idx_facture_rec_uk_titre (titre, entity);
ALTER TABLE llx_projet ADD INDEX idx_projet_fk_soc (fk_soc);
-- V4.1 update llx_projet set fk_soc=null where fk_soc is not null and fk_soc not in (select rowid from llx_societe);
ALTER TABLE llx_projet ADD CONSTRAINT fk_projet_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_USER' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_POPUP_CALENDAR' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_MAIL_SMTP_SERVER' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_MAIL_SMTP_PORT' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_UPLOAD_DOC' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_FEATURES_LEVEL' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_SOCIETE' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_CONTACT' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_PRODUITSERVICE' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_ADHERENT' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_SIZE_LISTE_LIMIT' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_SHOW_WORKBOARD' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='SOCIETE_NOLIST_COURRIER' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='GENBARCODE_LOCATION' AND entity=1;
UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_SYSLOG';
UPDATE llx_const SET entity=0 WHERE name='SYSLOG_FILE';
UPDATE llx_const SET entity=0 WHERE name='SYSLOG_LEVEL';
-- Fix to solve forgoten names on keys
ALTER TABLE llx_dolibarr_modules drop primary KEY;
ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity);
ALTER TABLE llx_events add column user_agent varchar(128) NULL after ip;
alter table llx_commande_fournisseur add column ref_supplier varchar(30) after entity;
alter table llx_mailing add column bgcolor varchar(8) after body;
alter table llx_mailing add column bgimage varchar(255) after bgcolor;
-- Added US states
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (1101, 11, 1101, '', 0, 'United-States', 1);
--
-- Provinces US
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AL', 1101, '', 0, 'ALABAMA', 'Alabama', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AK', 1101, '', 0, 'ALASKA', 'Alaska', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AZ', 1101, '', 0, 'ARIZONA', 'Arizona', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AR', 1101, '', 0, 'ARKANSAS', 'Arkansas', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CA', 1101, '', 0, 'CALIFORNIA', 'California', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CO', 1101, '', 0, 'COLORADO', 'Colorado', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CT', 1101, '', 0, 'CONNECTICUT', 'Connecticut', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('DE', 1101, '', 0, 'DELAWARE', 'Delaware', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('FL', 1101, '', 0, 'FLORIDA', 'Florida', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('GA', 1101, '', 0, 'GEORGIA', 'Georgia', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('HI', 1101, '', 0, 'HAWAII', 'Hawaii', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ID', 1101, '', 0, 'IDAHO', 'Idaho', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IL', 1101, '', 0, 'ILLINOIS','Illinois', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IN', 1101, '', 0, 'INDIANA', 'Indiana', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IA', 1101, '', 0, 'IOWA', 'Iowa', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KS', 1101, '', 0, 'KANSAS', 'Kansas', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KY', 1101, '', 0, 'KENTUCKY', 'Kentucky', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('LA', 1101, '', 0, 'LOUISIANA', 'Louisiana', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ME', 1101, '', 0, 'MAINE', 'Maine', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MD', 1101, '', 0, 'MARYLAND', 'Maryland', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MA', 1101, '', 0, 'MASSACHUSSETTS', 'Massachusetts', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MI', 1101, '', 0, 'MICHIGAN', 'Michigan', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MN', 1101, '', 0, 'MINNESOTA', 'Minnesota', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MS', 1101, '', 0, 'MISSISSIPPI', 'Mississippi', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MO', 1101, '', 0, 'MISSOURI', 'Missouri', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MT', 1101, '', 0, 'MONTANA', 'Montana', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NE', 1101, '', 0, 'NEBRASKA', 'Nebraska', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NV', 1101, '', 0, 'NEVADA', 'Nevada', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NH', 1101, '', 0, 'NEW HAMPSHIRE', 'New Hampshire', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NJ', 1101, '', 0, 'NEW JERSEY', 'New Jersey', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NM', 1101, '', 0, 'NEW MEXICO', 'New Mexico', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NY', 1101, '', 0, 'NEW YORK', 'New York', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NC', 1101, '', 0, 'NORTH CAROLINA', 'North Carolina', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ND', 1101, '', 0, 'NORTH DAKOTA', 'North Dakota', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OH', 1101, '', 0, 'OHIO', 'Ohio', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OK', 1101, '', 0, 'OKLAHOMA', 'Oklahoma', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OR', 1101, '', 0, 'OREGON', 'Oregon', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('PA', 1101, '', 0, 'PENNSYLVANIA', 'Pennsylvania', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('RI', 1101, '', 0, 'RHODE ISLAND', 'Rhode Island', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SC', 1101, '', 0, 'SOUTH CAROLINA', 'South Carolina', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SD', 1101, '', 0, 'SOUTH DAKOTA', 'South Dakota', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TN', 1101, '', 0, 'TENNESSEE', 'Tennessee', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TX', 1101, '', 0, 'TEXAS', 'Texas', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('UT', 1101, '', 0, 'UTAH', 'Utah', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VT', 1101, '', 0, 'VERMONT', 'Vermont', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VA', 1101, '', 0, 'VIRGINIA', 'Virginia', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WA', 1101, '', 0, 'WASHINGTON', 'Washington', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WV', 1101, '', 0, 'WEST VIRGINIA', 'West Virginia', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WI', 1101, '', 0, 'WISCONSIN', 'Wisconsin', 1);
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WY', 1101, '', 0, 'WYOMING', 'Wyoming', 1);
alter table llx_facture_fourn_det add column ref varchar(50) after fk_product;
alter table llx_facture_fourn_det add column label varchar(255) after ref;
alter table llx_societe_rib modify column iban_prefix varchar(34);
alter table llx_bank_account modify column iban_prefix varchar(34);
alter table llx_projet add column datec date after fk_statut;
delete from llx_action_def;
insert into llx_action_def (rowid,code,titre,description,objet_type) values (1,'NOTIFY_VAL_FICHINTER','Validation fiche intervention','Executed when a intervention is validated','ficheinter');
insert into llx_action_def (rowid,code,titre,description,objet_type) values (2,'NOTIFY_VAL_FAC','Validation facture client','Executed when a customer invoice is approved','facture');
insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_APP_ORDER_SUPPLIER','Approbation commande fournisseur','Executed when a supplier order is approved','order_supplier');
insert into llx_action_def (rowid,code,titre,description,objet_type) values (4,'NOTIFY_REF_ORDER_SUPPLIER','Refus commande fournisseur','Executed when a supplier order is refused','order_supplier');
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 52, 5, '7','0','VAT reduced rate', 1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 53, 5, '0','0','VAT Rate 0', 1);
-- Add rule to avoid duplicate use of discount
update llx_facturedet set fk_remise_except = null where fk_remise_except = 0;
ALTER TABLE llx_facturedet ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except);
-- Add Mauritius
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15201', 'Mauritius Private Company Limited By Shares', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15202', 'Mauritius Company Limited By Guarantee', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15203', 'Mauritius Public Company Limited By Shares', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15204', 'Mauritius Foreign Company', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15205', 'Mauritius GBC1 (Offshore Company)', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15206', 'Mauritius GBC2 (International Company)', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15207', 'Mauritius General Partnership', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15208', 'Mauritius Limited Partnership', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15209', 'Mauritius Sole Proprietorship', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15210', 'Mauritius Trusts', 1);
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MU', 'MUR', 1, 'Roupies mauritiennes');
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1521,152, '0','0','VAT Rate 0',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1522,152, '15','0','VAT Rate 15',1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15201, 152, 15201, '', 0, 'Rivière Noire', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15202, 152, 15202, '', 0, 'Flacq', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15203, 152, 15203, '', 0, 'Grand Port', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15204, 152, 15204, '', 0, 'Moka', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15205, 152, 15205, '', 0, 'Pamplemousses', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15206, 152, 15206, '', 0, 'Plaines Wilhems', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15207, 152, 15207, '', 0, 'Port-Louis', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15208, 152, 15208, '', 0, 'Rivière du Rempart', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15209, 152, 15209, '', 0, 'Savanne', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15210, 152, 15210, '', 0, 'Rodrigues', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15211, 152, 15211, '', 0, 'Les îles Agaléga', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15212, 152, 15212, '', 0, 'Les écueils des Cargados Carajos', 1);
alter table llx_const modify column name varchar(255) NOT NULL;
alter table llx_const modify column value text NOT NULL;
-- SWEDEN (id 20)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (202,20, '12','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (203,20, '6','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (204,20, '0','0','VAT Rate 0', 1);
-- Regions Suisse (id pays=6)
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (601, 6, 601, '', 1, 'Cantons', 1);
-- Cantons Suisse
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'AG','ARGOVIE','Argovie',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'AI','APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'AR','APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'BE','BERNE','Berne',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'BL','BALE CAMPAGNE','Bâle Campagne',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'BS','BALE VILLE','Bâle Ville',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'FR','FRIBOURG','Fribourg',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'GE','GENEVE','Genève',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'GL','GLARIS','Glaris',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'GR','GRISONS','Grisons',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'JU','JURA','Jura',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'LU','LUCERNE','Lucerne',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'NE','NEUCHATEL','Neuchâtel',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'NW','NIDWALD','Nidwald',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'OW','OBWALD','Obwald',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SG','SAINT-GALL','Saint-Gall',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SH','SCHAFFHOUSE','Schaffhouse',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SO','SOLEURE','Soleure',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SZ','SCHWYZ','Schwyz',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'TG','THURGOVIE','Thurgovie',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'TI','TESSIN','Tessin',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'UR','URI','Uri',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'VD','VAUD','Vaud',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'VS','VALAIS','Valais',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'ZG','ZUG','Zug',1);
INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'ZH','ZURICH','Zürich',1);
-- Regions spain (id pays=4)
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (401, 4, 401, '', 0, 'Andalucia', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (402, 4, 402, '', 0, 'Aragón', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (403, 4, 403, '', 0, 'Castilla y León', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (404, 4, 404, '', 0, 'Castilla la Mancha', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (405, 4, 405, '', 0, 'Canarias', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (406, 4, 406, '', 0, 'Cataluña', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (407, 4, 407, '', 0, 'Comunidad de Ceuta', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (408, 4, 408, '', 0, 'Comunidad Foral de Navarra', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (409, 4, 409, '', 0, 'Comunidad de Melilla', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (410, 4, 410, '', 0, 'Cantabria', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (411, 4, 411, '', 0, 'Comunidad Valenciana', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (412, 4, 412, '', 0, 'Extemadura', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (413, 4, 413, '', 0, 'Galicia', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (414, 4, 414, '', 0, 'Islas Baleares', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (415, 4, 415, '', 0, 'La Rioja', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (416, 4, 416, '', 0, 'Comunidad de Madrid', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (417, 4, 417, '', 0, 'Región de Murcia', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (418, 4, 418, '', 0, 'Principado de Asturias', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (419, 4, 419, '', 0, 'Pais Vasco', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (420, 4, 420, '', 0, 'Otros', 1);
-- Provinces Spain
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('01', 419, '', 19, 'PAIS VASCO', 'País Vasco', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('02', 404, '', 4, 'ALBACETE', 'Albacete', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('03', 411, '', 11, 'ALICANTE', 'Alicante', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('04', 401, '', 1, 'ALMERIA', 'Almería', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('05', 403, '', 3, 'AVILA', 'Avila', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('06', 412, '', 12, 'BADAJOZ', 'Badajoz', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('07', 414, '', 14, 'ISLAS BALEARES', 'Islas Baleares', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('08', 406, '', 6, 'BARCELONA', 'Barcelona', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('09', 403, '', 8, 'BURGOS', 'Burgos', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('10', 412, '', 12, 'CACERES', 'Cáceres', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('11', 401, '', 1, 'CADIz', 'Cádiz', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('12', 411, '', 11, 'CASTELLON', 'Castellón', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('13', 404, '', 4, 'CIUDAD REAL', 'Ciudad Real', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('14', 401, '', 1, 'CORDOBA', 'Córdoba', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('15', 413, '', 13, 'LA CORUÑA', 'La Coruña', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('16', 404, '', 4, 'CUENCA', 'Cuenca', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('17', 406, '', 6, 'GERONA', 'Gerona', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('18', 401, '', 1, 'GRANADA', 'Granada', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('19', 404, '', 4, 'GUADALAJARA', 'Guadalajara', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('20', 419, '', 19, 'GUIPUZCOA', 'Guipúzcoa', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('21', 401, '', 1, 'HUELVA', 'Huelva', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('22', 402, '', 2, 'HUESCA', 'Huesca', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('23', 401, '', 1, 'JAEN', 'Jaén', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('24', 403, '', 3, 'LEON', 'León', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('25', 406, '', 6, 'LERIDA', 'Lérida', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('26', 415, '', 15, 'LA RIOJA', 'La Rioja', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('27', 413, '', 13, 'LUGO', 'Lugo', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('28', 416, '', 16, 'MADRID', 'Madrid', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('29', 401, '', 1, 'MALAGA', 'Málaga', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('30', 417, '', 17, 'MURCIA', 'Murcia', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('31', 408, '', 8, 'NAVARRA', 'Navarra', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('32', 413, '', 13, 'ORENSE', 'Orense', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('33', 418, '', 18, 'ASTURIAS', 'Asturias', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('34', 403, '', 3, 'PALENCIA', 'Palencia', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('35', 405, '', 5, 'LAS PALMAS', 'Las Palmas', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('36', 413, '', 13, 'PONTEVEDRA', 'Pontevedra', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('37', 403, '', 3, 'SALAMANCA', 'Salamanca', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('38', 405, '', 5, 'STA. CRUZ DE TENERIFE', 'Sta. Cruz de Tenerife', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('39', 410, '', 10, 'CANTABRIA', 'Cantabria', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('40', 403, '', 3, 'SEGOVIA', 'Segovia', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('41', 401, '', 1, 'SEVILLA', 'Sevilla', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('42', 403, '', 3, 'SORIA', 'Soria', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('43', 406, '', 6, 'TARRAGONA', 'Tarragona', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('44', 402, '', 2, 'TERUEL', 'Teruel', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('45', 404, '', 5, 'TOLEDO', 'Toledo', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('46', 411, '', 11, 'VALENCIA', 'Valencia', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('47', 403, '', 3, 'VALLADOLID', 'Valladolid', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('48', 419, '', 19, 'VIZCAYA', 'Vizcaya', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('49', 403, '', 3, 'ZAMORA', 'Zamora', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('50', 402, '', 1, 'ZARAGOZA', 'Zaragoza', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('51', 407, '', 7, 'CEUTA', 'Ceuta', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('52', 409, '', 9, 'MELILLA', 'Melilla', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('53', 420, '', 20, 'OTROS', 'Otros', 1);
alter table llx_product_price modify price_level smallint NULL DEFAULT 1;
alter table llx_commandedet modify special_code integer UNSIGNED DEFAULT 0;
alter table llx_facturedet modify special_code integer UNSIGNED DEFAULT 0;
alter table llx_propaldet modify special_code integer UNSIGNED DEFAULT 0;
alter table llx_societe modify special_code integer NULL;
alter table llx_c_forme_juridique modify code integer NOT NULL;
ALTER TABLE llx_bank_class ADD UNIQUE INDEX idx_bank_class_lineid (lineid);
ALTER TABLE llx_c_ecotaxe ADD UNIQUE INDEX uk_c_ecotaxe (code);
ALTER TABLE llx_c_methode_commande_fournisseur ADD UNIQUE INDEX uk_c_methode_commande_fournisseur (code);
ALTER TABLE llx_menu change user usertype integer NOT NULL default '0';
-- Rename index
ALTER TABLE llx_adherent_options MODIFY COLUMN optid integer;
ALTER TABLE llx_adherent_options DROP PRIMARY KEY;
ALTER TABLE llx_adherent_options DROP INDEX uk_adherent_options;
ALTER TABLE llx_adherent_options DROP INDEX idx_adherent_options;
ALTER TABLE llx_adherent_options DROP INDEX adhid;
ALTER TABLE llx_adherent_options CHANGE optid rowid integer AUTO_INCREMENT PRIMARY KEY;
ALTER TABLE llx_adherent_options CHANGE adhid fk_member integer NOT NULL;
ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (fk_member);
ALTER TABLE llx_adherent DROP INDEX idx_adherent_fk_soc;
ALTER TABLE llx_propaldet ADD INDEX idx_propaldet_fk_propal (fk_propal);
-- V4.1 delete from llx_propaldet where fk_propal not in (select rowid from llx_propal);
ALTER TABLE llx_propaldet ADD CONSTRAINT fk_propaldet_fk_propal FOREIGN KEY (fk_propal) REFERENCES llx_propal (rowid);
ALTER TABLE llx_bank_class DROP INDEX idx_bank_class_lineid;
ALTER TABLE llx_bank_class DROP INDEX uk_bank_class_lineid;
ALTER TABLE llx_bank_class ADD UNIQUE INDEX uk_bank_class_lineid (lineid, fk_categ);
-- Not used. Just to be compatible with 2.7 upgrade process or higher
alter table llx_menu add column enabled varchar(255) NULL default '1';

View File

@ -1,211 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 2.7.0 or higher.
--
ALTER TABLE llx_actioncomm CHANGE fk_projet fk_project integer;
ALTER TABLE llx_don ADD COLUMN ref varchar(30) DEFAULT NULL AFTER rowid;
ALTER TABLE llx_don ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_stock_mouvement ADD COLUMN label varchar(128);
ALTER TABLE llx_deplacement ADD COLUMN ref varchar(30) DEFAULT NULL AFTER rowid;
ALTER TABLE llx_deplacement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_deplacement ADD COLUMN note_public text;
ALTER TABLE llx_element_element DROP INDEX idx_element_element_idx1;
ALTER TABLE llx_element_element DROP INDEX idx_element_element_targetid;
ALTER TABLE llx_element_element CHANGE sourceid fk_source integer NOT NULL;
ALTER TABLE llx_element_element CHANGE targetid fk_target integer NOT NULL;
ALTER TABLE llx_element_element ADD UNIQUE INDEX idx_element_element_idx1 (fk_source, sourcetype, fk_target, targettype);
ALTER TABLE llx_element_element ADD INDEX idx_element_element_fk_target (fk_target);
ALTER TABLE llx_ecm_document RENAME TO llx_ecm_documents;
ALTER TABLE llx_ecm_documents ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_ecm_documents ADD COLUMN crc varchar(32) DEFAULT '' NOT NULL AFTER private;
ALTER TABLE llx_ecm_documents ADD COLUMN cryptkey varchar(50) DEFAULT '' NOT NULL AFTER crc;
ALTER TABLE llx_ecm_documents ADD COLUMN cipher varchar(50) DEFAULT 'twofish' NOT NULL AFTER cryptkey;
ALTER TABLE llx_facture_fourn_det MODIFY COLUMN qty real;
ALTER TABLE llx_notify ADD COLUMN email VARCHAR(255);
ALTER TABLE llx_c_currencies ADD COLUMN labelsing varchar(64);
update llx_c_currencies set labelsing='Euro' where code_iso='EUR';
update llx_c_currencies set labelsing='Dollar' where code_iso='USD';
insert into llx_action_def (rowid,code,titre,description,objet_type) values (5,'NOTIFY_VAL_ORDER','Validation commande client','Executed when a customer order is validated','order');
insert into llx_action_def (rowid,code,titre,description,objet_type) values (6,'NOTIFY_VAL_PROPAL','Validation proposition client','Executed when a commercial proposal is validated','propal');
UPDATE llx_c_type_contact SET element='project' WHERE element='projet';
UPDATE llx_const set value='mail' where value='simplemail' and name='MAIN_MAIL_SENDMODE';
ALTER TABLE llx_projet ADD COLUMN model_pdf varchar(50) AFTER note;
ALTER TABLE llx_societe ADD COLUMN localtax1_assuj tinyint DEFAULT 0 after tva_assuj;
ALTER TABLE llx_societe ADD COLUMN localtax2_assuj tinyint DEFAULT 0 after localtax1_assuj;
ALTER TABLE llx_user ADD COLUMN photo varchar(255) after statut;
-- Create table of extra fields
create table llx_extra_fields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
entity integer DEFAULT 1 NOT NULL,
object varchar(64) NOT NULL,
assign integer,
name varchar(64) NOT NULL,
label varchar(64) NOT NULL,
format varchar(8) NOT NULL,
fieldsize integer,
maxlength integer,
options varchar(45),
rank integer
)ENGINE=innodb;
ALTER TABLE llx_extra_fields ADD UNIQUE INDEX idx_extra_fields_name (name, entity);
-- Create table of possible values
create table llx_extra_fields_options
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_extra_fields integer NOT NULL,
value varchar(255) NOT NULL,
rank integer
)ENGINE=innodb;
ALTER TABLE llx_extra_fields_options ADD INDEX idx_extra_fields_options_fk_extra_fields (fk_extra_fields);
ALTER TABLE llx_extra_fields_options ADD CONSTRAINT fk_extra_fields_options_fk_extra_fields FOREIGN KEY (fk_extra_fields) REFERENCES llx_extra_fields (rowid);
-- Create table of values
create table llx_extra_fields_values
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
entity integer DEFAULT 1 NOT NULL,
datec datetime,
datem datetime,
fk_object integer NOT NULL,
fk_extra_fields integer NOT NULL,
value varchar(255),
fk_user_create integer,
fk_user_modif integer
)ENGINE=innodb;
ALTER TABLE llx_extra_fields_values ADD INDEX idx_extra_fields_values_fk_extra_fields (fk_extra_fields, entity);
ALTER TABLE llx_extra_fields_values ADD CONSTRAINT fk_extra_fields_values_fk_extra_fields FOREIGN KEY (fk_extra_fields) REFERENCES llx_extra_fields (rowid);
ALTER TABLE llx_bank_class DROP INDEX idx_bank_class_lineid;
ALTER TABLE llx_bank_class DROP INDEX uk_bank_class_lineid;
ALTER TABLE llx_bank_class ADD UNIQUE INDEX uk_bank_class_lineid (lineid, fk_categ);
ALTER TABLE llx_rights_def MODIFY COLUMN module varchar(64);
-- Enhancement of project tasks
ALTER TABLE llx_projet ADD COLUMN datee DATE AFTER dateo;
ALTER TABLE llx_projet ADD COLUMN public integer;
ALTER TABLE llx_projet_task ADD COLUMN datec datetime AFTER fk_task_parent;
ALTER TABLE llx_projet_task ADD COLUMN tms timestamp AFTER datec;
ALTER TABLE llx_projet_task ADD COLUMN dateo datetime AFTER tms;
ALTER TABLE llx_projet_task ADD COLUMN datee datetime AFTER dateo;
ALTER TABLE llx_projet_task ADD COLUMN datev datetime AFTER datee;
ALTER TABLE llx_projet_task CHANGE title label varchar(255) NOT NULL;
ALTER TABLE llx_projet_task ADD COLUMN description text AFTER label;
ALTER TABLE llx_projet_task MODIFY description text;
ALTER TABLE llx_projet_task MODIFY duration_effective real DEFAULT 0 NOT NULL;
ALTER TABLE llx_projet_task ADD COLUMN progress integer DEFAULT 0 AFTER duration_effective;
ALTER TABLE llx_projet_task ADD COLUMN priority integer DEFAULT 0 AFTER progress;
ALTER TABLE llx_projet_task ADD COLUMN fk_milestone integer DEFAULT 0 AFTER priority;
ALTER TABLE llx_projet_task ADD COLUMN fk_user_modif integer AFTER fk_user_creat;
ALTER TABLE llx_projet_task ADD COLUMN fk_user_valid integer AFTER fk_user_modif;
UPDATE llx_projet_task SET statut='1' WHERE statut='open';
ALTER TABLE llx_projet_task CHANGE statut fk_statut smallint DEFAULT 0 NOT NULL;
ALTER TABLE llx_projet_task CHANGE note note_private text;
ALTER TABLE llx_projet_task ADD COLUMN note_public text AFTER note_private;
ALTER TABLE llx_projet_task ADD COLUMN rang integer DEFAULT 0 AFTER note_public;
-- Delete old key
ALTER TABLE llx_projet_task DROP INDEX fk_projet;
ALTER TABLE llx_projet_task DROP INDEX fk_user_creat;
ALTER TABLE llx_projet_task DROP INDEX statut;
-- Add new key
ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_projet (fk_projet);
ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_user_creat (fk_user_creat);
ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_user_valid (fk_user_valid);
-- V4.1 DELETE FROM llx_projet_task WHERE fk_projet NOT IN (SELECT rowid from llx_projet);
-- V4.1 UPDATE llx_projet_task set fk_user_creat=NULL WHERE fk_user_creat IS NOT NULL AND fk_user_creat NOT IN (SELECT rowid from llx_user);
-- V4.1 UPDATE llx_projet_task set fk_user_valid=NULL WHERE fk_user_valid IS NOT NULL AND fk_user_valid NOT IN (SELECT rowid from llx_user);
ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_element_contact DROP FOREIGN KEY fk_element_contact_fk_c_type_contact;
ALTER TABLE llx_element_contact DROP INDEX fk_element_contact_fk_c_type_contact;
UPDATE llx_c_type_contact SET rowid='160' WHERE rowid='80';
UPDATE llx_c_type_contact SET rowid='170' WHERE rowid='81';
UPDATE llx_element_contact SET fk_c_type_contact='160' WHERE fk_c_type_contact='80';
UPDATE llx_element_contact SET fk_c_type_contact='170' WHERE fk_c_type_contact='81';
ALTER TABLE llx_element_contact ADD CONSTRAINT fk_element_contact_fk_c_type_contact FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (161, 'project', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (171, 'project', 'external', 'CONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (180, 'project_task', 'internal', 'TASKEXECUTIVE', 'Responsable', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (181, 'project_task', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (191, 'project_task', 'external', 'CONTRIBUTOR', 'Intervenant', 1);
ALTER TABLE llx_projet ADD COLUMN description text AFTER title;
ALTER TABLE llx_projet CHANGE note note_private text;
ALTER TABLE llx_projet ADD COLUMN note_public text AFTER note_private;
ALTER TABLE llx_projet MODIFY fk_statut smallint DEFAULT 0 NOT NULL;
ALTER TABLE llx_projet MODIFY fk_user_creat integer NOT NULL;
-- Uniformize code: change tva_taux to tva_tx
ALTER TABLE llx_facturedet CHANGE tva_taux tva_tx real;
ALTER TABLE llx_facture_fourn_det CHANGE tva_taux tva_tx double(6,3);
ALTER TABLE llx_facturedet_rec CHANGE tva_taux tva_tx real DEFAULT 19.6;
-- Create table for entities
create table llx_entity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
label varchar(255) NOT NULL,
description text,
datec datetime,
fk_user_creat integer,
visible tinyint DEFAULT 1 NOT NULL,
active tinyint DEFAULT 1 NOT NULL
) ENGINE=innodb;
INSERT INTO llx_entity (rowid, label, description, datec, fk_user_creat, visible, active) VALUES (1, 'Default Entity', 'This is the default entity', NOW(), 1, 1, 1);
-- Add constraint
-- V4.1 DELETE FROM llx_fichinterdet WHERE fk_fichinter NOT IN (SELECT rowid from llx_fichinter);
ALTER TABLE llx_fichinterdet ADD INDEX idx_fichinterdet_fk_fichinter (fk_fichinter);
ALTER TABLE llx_fichinterdet ADD CONSTRAINT fk_fichinterdet_fk_fichinter FOREIGN KEY (fk_fichinter) REFERENCES llx_fichinter (rowid);
-- This was created into 2.9.0 but we need them to avoid errors of migration to 2.8 using new classes
alter table llx_facture add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_facture add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_facturedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_facturedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_facturedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_facturedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
-- This was created into 3.0.0 but we need them to avoid errors of migration to 2.8 using new classes
ALTER TABLE llx_propaldet ADD COLUMN fk_parent_line integer NULL AFTER fk_propal;
ALTER TABLE llx_commandedet ADD COLUMN fk_parent_line integer NULL AFTER fk_commande;
ALTER TABLE llx_facturedet ADD COLUMN fk_parent_line integer NULL AFTER fk_facture;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_parent_line integer NULL AFTER fk_facture;

View File

@ -1,329 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 2.8.0 or higher.
--
-- Add unique key
ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot);
ALTER TABLE llx_product_stock drop column location;
-- Add missing table llx_product_association
create table llx_product_association
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_product_pere integer NOT NULL DEFAULT 0,
fk_product_fils integer NOT NULL DEFAULT 0,
qty double NULL
)ENGINE=innodb;
ALTER TABLE llx_product_association ADD UNIQUE INDEX uk_product_association (fk_product_pere, fk_product_fils);
ALTER TABLE llx_product_association ADD INDEX idx_product_association_fils (fk_product_fils);
ALTER TABLE llx_product ADD INDEX idx_product_label (label);
-- V4.1 DELETE FROM llx_projet_task WHERE fk_projet NOT IN (SELECT rowid from llx_projet);
-- V4.1 UPDATE llx_projet_task set fk_user_creat=NULL WHERE fk_user_creat IS NOT NULL AND fk_user_creat NOT IN (SELECT rowid from llx_user);
-- V4.1 UPDATE llx_projet_task set fk_user_valid=NULL WHERE fk_user_valid IS NOT NULL AND fk_user_valid NOT IN (SELECT rowid from llx_user);
ALTER table llx_bank_account ADD COLUMN fk_pays integer DEFAULT 0 NOT NULL after domiciliation;
ALTER TABLE llx_bank_account ADD COLUMN fk_departement integer DEFAULT NULL after domiciliation;
ALTER TABLE llx_socpeople ADD COLUMN fk_departement integer DEFAULT NULL after ville;
ALTER TABLE llx_adherent ADD COLUMN fk_departement integer DEFAULT NULL after ville;
ALTER TABLE llx_entrepot ADD COLUMN fk_departement integer DEFAULT NULL after ville;
ALTER TABLE llx_bookmark ADD COLUMN position integer DEFAULT 0;
-- Rename llx_product_det
ALTER TABLE llx_product_det RENAME TO llx_product_lang;
ALTER TABLE llx_product_lang ADD UNIQUE INDEX uk_product_lang (fk_product, lang);
-- V4.1 DELETE FROM llx_product_lang WHERE fk_product NOT IN (SELECT rowid from llx_product);
ALTER TABLE llx_product_lang ADD CONSTRAINT fk_product_lang_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
ALTER TABLE llx_product ADD COLUMN virtual tinyint DEFAULT 0 NOT NULL AFTER tms;
ALTER TABLE llx_product ADD COLUMN fk_parent integer DEFAULT 0 AFTER virtual;
alter table llx_societe add column default_lang varchar(6) after price_level;
alter table llx_socpeople add column default_lang varchar(6) after note;
alter table llx_mailing add column joined_file1 varchar(255);
alter table llx_mailing add column joined_file2 varchar(255);
alter table llx_mailing add column joined_file3 varchar(255);
alter table llx_mailing add column joined_file4 varchar(255);
update llx_facture_fourn set fk_statut=2 where fk_statut=1 AND paye=1;
alter table llx_facture_fourn add column close_code varchar(16) after remise;
alter table llx_facture_fourn add column close_note varchar(128) after close_code;
-- Add local taxes
alter table llx_facture add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_facture add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_facturedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_facturedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_facturedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_facturedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_facture_rec add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_facture_rec add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_facturedet_rec add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_facturedet_rec add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_facturedet_rec add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_facturedet_rec add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_c_tva add column localtax1 double NOT NULL DEFAULT 0 after taux;
alter table llx_c_tva add column localtax2 double NOT NULL DEFAULT 0 after localtax1;
alter table llx_propal add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_propal add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_propaldet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_propaldet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_propaldet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_propaldet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_commande add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_commande add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_commandedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_commandedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_commandedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_commandedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_commande_fournisseur add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_commande_fournisseur add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_commande_fournisseurdet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_commande_fournisseurdet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_commande_fournisseurdet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_commande_fournisseurdet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_facture_fourn add column localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_facture_fourn add column localtax2 double(24,8) DEFAULT 0 after localtax1;
alter table llx_facture_fourn_det add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_facture_fourn_det add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_facture_fourn_det add column total_localtax1 double(24,8) DEFAULT 0 after tva;
alter table llx_facture_fourn_det add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_product add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_product add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_product_price add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_product_price add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_contratdet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx;
alter table llx_contratdet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx;
alter table llx_contratdet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva;
alter table llx_contratdet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
alter table llx_product add column hidden tinyint DEFAULT 0;
alter table llx_product add column length float DEFAULT NULL after weight_units;
alter table llx_product add column length_units tinyint DEFAULT NULL after length;
alter table llx_product add column surface float DEFAULT NULL after length_units;
alter table llx_product add column surface_units tinyint DEFAULT NULL after surface;
alter table llx_product add column accountancy_code_sell varchar(15) after fk_barcode_type;
alter table llx_product add column accountancy_code_buy varchar(15) after accountancy_code_sell;
ALTER TABLE llx_product drop column stock_loc;
ALTER TABLE llx_product_stock add column location varchar(32);
ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_adresse_livraison;
ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_adresse_livraison;
ALTER TABLE llx_expedition ADD COLUMN ref_customer varchar(30) AFTER entity;
ALTER TABLE llx_expedition ADD COLUMN date_delivery date DEFAULT NULL AFTER date_expedition;
ALTER TABLE llx_expedition CHANGE COLUMN fk_adresse_livraison fk_address integer DEFAULT NULL;
ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_adresse_livraison;
ALTER TABLE llx_livraison DROP INDEX idx_livraison_fk_adresse_livraison;
ALTER TABLE llx_livraison change ref_client ref_customer varchar(30);
ALTER TABLE llx_livraison change date_livraison date_delivery date DEFAULT NULL;
ALTER TABLE llx_livraison CHANGE COLUMN fk_adresse_livraison fk_address integer DEFAULT NULL;
ALTER TABLE llx_c_actioncomm MODIFY libelle varchar(48) NOT NULL;
ALTER TABLE llx_facture MODIFY tva double(24,8) DEFAULT 0;
ALTER TABLE llx_facture MODIFY total double(24,8) DEFAULT 0;
ALTER TABLE llx_facture MODIFY total_ttc double(24,8) DEFAULT 0;
ALTER TABLE llx_facture MODIFY amount double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_facturedet MODIFY tva_tx double(6,3);
ALTER TABLE llx_facturedet MODIFY subprice double(24,8);
ALTER TABLE llx_facturedet MODIFY price double(24,8);
ALTER TABLE llx_facturedet MODIFY total_ht double(24,8);
ALTER TABLE llx_facturedet MODIFY total_tva double(24,8);
ALTER TABLE llx_facturedet MODIFY total_ttc double(24,8);
ALTER TABLE llx_facture_rec MODIFY tva double(24,8) DEFAULT 0;
ALTER TABLE llx_facture_rec MODIFY total double(24,8) DEFAULT 0;
ALTER TABLE llx_facture_rec MODIFY total_ttc double(24,8) DEFAULT 0;
ALTER TABLE llx_facture_rec MODIFY amount double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_facturedet_rec MODIFY tva_tx double(6,3);
ALTER TABLE llx_facturedet_rec MODIFY subprice double(24,8);
ALTER TABLE llx_facturedet_rec MODIFY price double(24,8);
ALTER TABLE llx_facturedet_rec MODIFY total_ht double(24,8);
ALTER TABLE llx_facturedet_rec MODIFY total_tva double(24,8);
ALTER TABLE llx_facturedet_rec MODIFY total_ttc double(24,8);
ALTER TABLE llx_adherent ADD COLUMN civilite varchar(6) after entity;
ALTER TABLE llx_deplacement ADD COLUMN fk_projet integer DEFAULT 0 after fk_soc;
-- Custom list
DROP TABLE llx_c_field_list;
create table llx_c_field_list
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
element varchar(64) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
name varchar(32) NOT NULL,
alias varchar(32) NOT NULL,
title varchar(32) NOT NULL,
align varchar(6) DEFAULT 'left',
sort tinyint DEFAULT 1 NOT NULL,
search tinyint DEFAULT 0 NOT NULL,
enabled varchar(255) DEFAULT 1,
rang integer DEFAULT 0
)ENGINE=innodb;
INSERT INTO llx_c_field_list (rowid, element, entity, name, alias, title, align, sort, search, enabled, rang) VALUES
(1, 'product_default', 1, 'p.ref', 'ref', 'Ref', 'left', 1, 1, '1', 1),
(2, 'product_default', 1, 'p.label', 'label', 'Label', 'left', 1, 1, '1', 2),
(3, 'product_default', 1, 'p.barcode', 'barcode', 'BarCode', 'center', 1, 1, '$conf->barcode->enabled', 3),
(4, 'product_default', 1, 'p.tms', 'datem', 'DateModification', 'center', 1, 0, '1', 4),
(5, 'product_default', 1, 'p.price', 'price', 'SellingPriceHT', 'right', 1, 0, '1', 5),
(6, 'product_default', 1, 'p.price_ttc', 'price_ttc', 'SellingPriceTTC', 'right', 1, 0, '1', 6),
(7, 'product_default', 1, 'p.stock', 'stock', 'Stock', 'right', 0, 0, '$conf->stock->enabled', 7),
(8, 'product_default', 1, 'p.envente', 'status', 'Status', 'right', 1, 0, '1', 8);
UPDATE llx_adherent SET pays = null where pays <= '0' and pays != '0';
ALTER table llx_adherent MODIFY pays integer;
-- Drop old tables
DROP TABLE llx_projet_milestone;
ALTER TABLE llx_projet drop column fk_milestone;
ALTER TABLE llx_deplacement ADD COLUMN fk_statut INTEGER DEFAULT 1 NOT NULL after type;
drop table llx_appro;
ALTER TABLE llx_events MODIFY COLUMN user_agent varchar(255) NULL;
create table llx_categorie_member
(
fk_categorie integer NOT NULL,
fk_member integer NOT NULL
)ENGINE=innodb;
ALTER TABLE llx_categorie_member ADD PRIMARY KEY (fk_categorie, fk_member);
ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_categorie (fk_categorie);
ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_member (fk_member);
ALTER TABLE llx_categorie_member ADD CONSTRAINT fk_categorie_member_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_member ADD CONSTRAINT fk_categorie_member_member_rowid FOREIGN KEY (fk_member) REFERENCES llx_adherent (rowid);
ALTER TABLE llx_product ADD COLUMN canvas varchar(32) DEFAULT 'default@product';
ALTER TABLE llx_product MODIFY COLUMN canvas varchar(32) DEFAULT 'default@product';
UPDATE llx_product SET canvas = 'default@product' WHERE fk_product_type = 0 AND (canvas = '' OR canvas = 'default');
UPDATE llx_product SET canvas = 'service@product' WHERE fk_product_type = 1 AND (canvas = '' OR canvas = 'service');
UPDATE llx_product SET canvas = 'livre@droitpret' WHERE canvas = 'livre';
UPDATE llx_product SET canvas = 'livrecontrat@droitpret' WHERE canvas = 'livrecontrat';
UPDATE llx_product SET canvas = 'livrecouverture@droitpret' WHERE canvas = 'livrecouverture';
ALTER TABLE llx_menu DROP INDEX idx_menu_uk_menu;
ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, url, entity);
UPDATE llx_const SET name = 'MAIN_MODULE_PRODUCT' WHERE name = 'MAIN_MODULE_PRODUIT';
UPDATE llx_expedition set ref_customer = NULL where ref_customer = '';
-- Add more predefined action codes --
insert into llx_c_actioncomm (id, code, type, libelle, module) values (30, 'AC_SUP_ORD', 'system', 'Send supplier order by email' ,'supplier_order');
insert into llx_c_actioncomm (id, code, type, libelle, module) values (31, 'AC_SUP_INV', 'system', 'Send supplier invoice by email' ,'supplier_invoice');
-- Rename llx_societe_adresse_livraison
ALTER TABLE llx_societe_adresse_livraison RENAME TO llx_societe_address;
ALTER TABLE llx_societe_address CHANGE COLUMN nom name varchar(60);
ALTER TABLE llx_societe_address CHANGE COLUMN fk_societe fk_soc integer DEFAULT 0;
-- Add new spanish VAT from July 2010
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 45, 4, '18','0','4','VAT standard rate from July 2010',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 46, 4, '8','0','1','VAT reduced rate from July 2010',1);
-- Add Argentina Data
-- Regions Argentina (id pays=23)
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2301, 23, 2301, '', 0, 'Norte', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2302, 23, 2302, '', 0, 'Litoral', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2303, 23, 2303, '', 0, 'Cuyana', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2304, 23, 2304, '', 0, 'Central', 1);
INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2305, 23, 2305, '', 0, 'Patagonia', 1);
-- Provinces Argentina
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2301', 2301, '', 01, 'CATAMARCA', 'Catamarca', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2302', 2301, '', 02, 'YUJUY', 'Yujuy', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2303', 2301, '', 03, 'TUCAMAN', 'Tucamán', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2304', 2301, '', 04, 'SANTIAGO DEL ESTERO', 'Santiago del Estero', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2305', 2301, '', 05, 'SALTA', 'Salta', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2306', 2302, '', 06, 'CHACO', 'Chaco', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2307', 2302, '', 07, 'CORRIENTES', 'Corrientes', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2308', 2302, '', 08, 'ENTRE RIOS', 'Entre Ríos', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2309', 2302, '', 09, 'FORMOSA MISIONES', 'Formosa Misiones', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2310', 2302, '', 10, 'SANTA FE', 'Santa Fe', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2311', 2303, '', 11, 'LA RIOJA', 'La Rioja', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2312', 2303, '', 12, 'MENDOZA', 'Mendoza', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2313', 2303, '', 13, 'SAN JUAN', 'San Juan', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2314', 2303, '', 14, 'SAN LUIS', 'San Luis', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2315', 2304, '', 15, 'CORDOBA', 'Córdoba', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2316', 2304, '', 16, 'BUENOS AIRES', 'Buenos Aires', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2317', 2304, '', 17, 'CABA', 'Caba', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2318', 2305, '', 18, 'LA PAMPA', 'La Pampa', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2319', 2305, '', 19, 'NEUQUEN', 'Neuquén', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2320', 2305, '', 20, 'RIO NEGRO', 'Río Negro', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2321', 2305, '', 21, 'CHUBUT', 'Chubut', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2322', 2305, '', 22, 'SANTA CRUZ', 'Santa Cruz', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2323', 2305, '', 23, 'TIERRA DEL FUEGO', 'Tierra del Fuego', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2324', 2305, '', 24, 'ISLAS MALVINAS', 'Islas Malvinas', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2325', 2305, '', 25, 'ANTARTIDA', 'Antártida', 1);
-- Juridical status Argentina
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2301', 'Monotributista', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2302', 'Sociedad Civil', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2303', 'Sociedades Comerciales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2304', 'Sociedades de Hecho', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2305', 'Sociedades Irregulares', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2306', 'Sociedad Colectiva', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2307', 'Sociedad en Comandita Simple', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2308', 'Sociedad de Capital e Industria', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2309', 'Sociedad Accidental o en participación', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2310', 'Sociedad de Responsabilidad Limitada', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2311', 'Sociedad Anónima', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2312', 'Sociedad Anónima con Participación Estatal Mayoritaria', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2313', 'Sociedad en Comandita por Acciones (arts. 315 a 324, LSC)', 1);
DELETE from llx_const where name='USER_PASSWORD_GENERATED' and value='default';
ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def;
ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL;
ALTER TABLE llx_boxes_def MODIFY note varchar(130);
ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity, note);
-- Fix bad old data
UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%';
update llx_const set value ='eldy' where name = 'MAIN_THEME' and (value= 'rodolphe' or value='dev' or value='bluelagoon');
update llx_user_param set value ='eldy' where param = 'MAIN_THEME' and (value= 'rodolphe' or value='dev' or value='bluelagoon');
ALTER TABLE llx_tmp_caisse MODIFY fk_article integer NOT NULL;

View File

@ -1,169 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 2.9.0 or higher.
--
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60);
-- To remove a column: ALTER TABLE llx_table DROP COLUMN colname;
ALTER TABLE llx_paiement MODIFY amount double(24,8);
ALTER TABLE llx_paiement_facture MODIFY amount double(24,8);
-- Fix bad old data
UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%';
-- Add recuperableonly field
ALTER TABLE llx_product add COLUMN recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
ALTER TABLE llx_product_price add COLUMN recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
-- Rename envente into tosell and add tobuy
ALTER TABLE llx_product CHANGE COLUMN envente tosell tinyint DEFAULT 1;
ALTER TABLE llx_product add COLUMN tobuy tinyint DEFAULT 1 after tosell;
ALTER TABLE llx_product_price CHANGE COLUMN envente tosell tinyint DEFAULT 1;
ALTER TABLE llx_bank MODIFY COLUMN fk_type varchar(6);
ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def;
ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL;
ALTER TABLE llx_boxes_def MODIFY note varchar(130);
ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity, note);
ALTER TABLE llx_notify_def MODIFY fk_contact integer NULL;
ALTER TABLE llx_notify_def ADD COLUMN fk_user integer NULL after fk_contact;
ALTER TABLE llx_notify_def ADD COLUMN type varchar(16) DEFAULT 'email';
ALTER TABLE llx_notify MODIFY fk_contact integer NULL;
ALTER TABLE llx_notify ADD COLUMN fk_user integer NULL after fk_contact;
ALTER TABLE llx_notify ADD COLUMN type varchar(16) DEFAULT 'email';
ALTER TABLE llx_actioncomm MODIFY label varchar(128) NOT NULL;
ALTER TABLE llx_expedition MODIFY date_expedition datetime;
ALTER TABLE llx_expedition MODIFY date_delivery datetime NULL;
ALTER TABLE llx_societe ADD COLUMN canvas varchar(32) NULL AFTER default_lang;
ALTER TABLE llx_societe MODIFY canvas varchar(32) NULL;
ALTER TABLE llx_cond_reglement RENAME TO llx_c_payment_term;
ALTER TABLE llx_expedition_methode RENAME TO llx_c_shipment_mode;
ALTER TABLE llx_facturedet_rec ADD COLUMN special_code integer UNSIGNED DEFAULT 0 AFTER total_ttc;
ALTER TABLE llx_facturedet_rec ADD COLUMN rang integer DEFAULT 0 AFTER special_code;
ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_order integer;
ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_invoice integer;
ALTER TABLE llx_propaldet ADD COLUMN fk_parent_line integer NULL AFTER fk_propal;
ALTER TABLE llx_commandedet ADD COLUMN fk_parent_line integer NULL AFTER fk_commande;
ALTER TABLE llx_facturedet ADD COLUMN fk_parent_line integer NULL AFTER fk_facture;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_parent_line integer NULL AFTER fk_facture;
-- Remove old Spanish TVA
UPDATE llx_c_tva SET taux = '18' WHERE rowid = 41;
UPDATE llx_c_tva SET taux = '8' WHERE rowid = 42;
DELETE FROM llx_c_tva WHERE rowid = 45;
DELETE FROM llx_c_tva WHERE rowid = 46;
ALTER TABLE llx_adherent ADD COLUMN import_key varchar(14);
ALTER TABLE llx_categorie ADD COLUMN import_key varchar(14);
ALTER TABLE llx_product ADD COLUMN customcode varchar(32) after note;
ALTER TABLE llx_product ADD COLUMN fk_country integer after customcode;
ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX idx_ecm_directories (label, fk_parent, entity);
ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents (fullpath_dol);
-- Add modules facture fournisseur
INSERT INTO llx_const (name, value, type, note, visible) values ('INVOICE_SUPPLIER_ADDON_PDF', 'canelle','chaine','',0);
ALTER TABLE llx_facture_fourn ADD COLUMN model_pdf varchar(50) after note_public;
CREATE TABLE llx_c_ziptown
(
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
code varchar(5) DEFAULT NULL,
fk_county integer NOT NULL,
zip varchar(10) NOT NULL,
town varchar(255) NOT NULL,
active tinyint NOT NULL DEFAULT 1
) ENGINE=innodb;
ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_county (fk_county);
ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county FOREIGN KEY (fk_county) REFERENCES llx_c_departements (rowid);
ALTER TABLE llx_socpeople ADD COLUMN canvas varchar(32) NULL after default_lang;
ALTER TABLE llx_socpeople MODIFY canvas varchar(32) NULL;
UPDATE llx_socpeople SET canvas = 'default' WHERE canvas = 'default@contact';
UPDATE llx_societe SET canvas = 'default' WHERE canvas = 'default@thirdparty';
UPDATE llx_societe SET canvas = 'individual' WHERE canvas = 'individual@thirdparty';
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS','7','chaine','Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées',0);
ALTER TABLE llx_actioncomm ADD COLUMN fulldayevent smallint NOT NULL default 0 after priority;
-- Enhance POS module
DROP TABLE llx_tmp_caisse;
CREATE TABLE llx_pos_tmp (
id integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
fk_article integer NOT NULL,
qte real NOT NULL,
fk_tva integer NOT NULL,
remise_percent real NOT NULL,
remise real NOT NULL,
total_ht double(24,8) NOT NULL,
total_tva double(24,8) NOT NULL,
total_ttc double(24,8) NOT NULL
) ENGINE=innodb;
-- Add external ref
ALTER TABLE llx_facture ADD COLUMN ref_ext varchar(30) after entity;
ALTER TABLE llx_commande ADD COLUMN ref_ext varchar(30) after entity;
ALTER TABLE llx_propal ADD COLUMN ref_ext varchar(30) after entity;
ALTER TABLE llx_user ADD COLUMN ref_ext varchar(30) after entity;
ALTER TABLE llx_societe ADD COLUMN ref_ext varchar(60) after entity;
ALTER TABLE llx_product ADD COLUMN ref_ext varchar(30) after entity;
ALTER TABLE llx_mailing_cibles CHANGE COLUMN url source_url integer;
ALTER TABLE llx_mailing_cibles MODIFY source_url varchar(160);
ALTER TABLE llx_mailing_cibles ADD COLUMN source_id integer after source_url;
ALTER TABLE llx_mailing_cibles ADD COLUMN source_type varchar(16) after source_id;
ALTER TABLE llx_facture_rec DROP COLUMN frequency;
ALTER TABLE llx_facture_rec ADD COLUMN frequency integer;
ALTER TABLE llx_facture_rec ADD COLUMN unit_frequency varchar(2) DEFAULT 'd';
ALTER TABLE llx_facture_rec ADD COLUMN date_when datetime DEFAULT NULL;
ALTER TABLE llx_facture_rec ADD COLUMN date_last_gen datetime DEFAULT NULL;
ALTER TABLE llx_facture_rec ADD COLUMN nb_gen_done integer DEFAULT NULL;
ALTER TABLE llx_facture_rec ADD COLUMN nb_gen_max integer DEFAULT NULL;
ALTER TABLE llx_user ADD COLUMN openid varchar(255);
-- Enhance Withdrawal module
INSERT INTO llx_action_def (rowid,code,titre,description,objet_type) values (7,'NOTIFY_TRN_WITHDRAW','Transmit withdraw','Executed when a withdrawal is transmited','withdraw');
INSERT INTO llx_action_def (rowid,code,titre,description,objet_type) values (8,'NOTIFY_CRD_WITHDRAW','Credite withdraw','Executed when a withdrawal is credited','withdraw');
INSERT INTO llx_action_def (rowid,code,titre,description,objet_type) values (9,'NOTIFY_EMT_WITHDRAW','Emit withdraw','Executed when a withdrawal is emited','withdraw');
ALTER TABLE llx_prelevement_notifications MODIFY action varchar(32);
ALTER TABLE llx_c_tva ADD COLUMN accountancy_code varchar(15) DEFAULT NULL;
UPDATE llx_c_actioncomm set module='invoice_supplier' WHERE module='supplier_invoice';
UPDATE llx_c_actioncomm set module='order_supplier' WHERE module='supplier_order';
UPDATE llx_documentmodel set type='invoice_supplier' WHERE type='supplier_invoice';
UPDATE llx_documentmodel set type='order_supplier' WHERE type='supplier_order';
UPDATE llx_c_type_contact set element='invoice_supplier' WHERE element='facture_fourn';
UPDATE llx_c_type_contact set module='invoice_supplier' WHERE module='supplier_invoice';
UPDATE llx_c_type_contact set module='order_supplier' WHERE module='supplier_order';
ALTER TABLE llx_facturedet DROP INDEX uk_fk_remise_except;
ALTER TABLE llx_facturedet ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture);
ALTER TABLE llx_societe_remise MODIFY remise_client double(6,3) DEFAULT 0 NOT NULL;

View File

@ -68,7 +68,7 @@ ALTER TABLE llx_projet_task_time ADD COLUMN task_datehour datetime after task_da
-- Localtaxes by thirds
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10);
ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(10);
ALTER TABLE llx_localtax ADD COLUMN localtaxtype tinyint(4) after entity;
ALTER TABLE llx_localtax ADD COLUMN localtaxtype tinyint after entity;
ALTER TABLE llx_societe ADD COLUMN localtax1_value double(6,3) after localtax1_assuj;
ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_assuj;
@ -940,7 +940,7 @@ create table llx_c_email_templates
position smallint, -- Position
topic text, -- Predefined topic
content text -- Predefined text
)ENGINE=innodb;
) ENGINE=innodb;
UPDATE llx_c_regions SET rowid = 0 where rowid = 1;
@ -952,11 +952,11 @@ CREATE TABLE llx_holiday_types (
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
label varchar(45) NOT NULL,
description varchar(255) NOT NULL,
affect int(1) NOT NULL,
delay int(1) NOT NULL,
affect integer NOT NULL,
delay integer NOT NULL,
insertAt DATETIME NOT NULL,
updateAt DATETIME,
deleteAt DATETIME,
nbCongesDeducted varchar(255) NOT NULL,
nbCongesEveryMonth varchar(255) NOT NULL
);
) ENGINE=innodb;

View File

@ -27,4 +27,4 @@ CREATE TABLE llx_holiday_types (
deleteAt DATETIME,
nbCongesDeducted varchar(255) NOT NULL,
nbCongesEveryMonth varchar(255) NOT NULL
);
) ENGINE=innodb;

View File

@ -139,25 +139,31 @@ class SqlTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/install/mysql/tables');
foreach($filesarray as $key => $file)
$listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration');
foreach ($listofsqldir as $dir)
{
if (! preg_match('/\.sql$/',$file)) continue;
print 'Process dir '.$dir."\n";
$filesarray = scandir($dir);
foreach($filesarray as $key => $file)
{
if (! preg_match('/\.sql$/',$file)) continue;
print 'Check sql file '.$file."\n";
$filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$file);
print 'Check sql file '.$file."\n";
$filecontent=file_get_contents($dir.'/'.$file);
$result=strpos($filecontent,'`');
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
$this->assertTrue($result===false, 'Found ON back quote. Bad.');
$result=strpos($filecontent,'`');
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
$this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.');
$result=strpos($filecontent,'int(');
print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n";
$this->assertTrue($result===false, 'Found int(x) instead of integer. Bad.');
$result=strpos($filecontent,'int(');
print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n";
$this->assertTrue($result===false, 'Found int(x) instead of integer into '.$file.'. Bad.');
$result=strpos($filecontent,'ON DELETE CASCADE');
print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
$this->assertTrue($result===false, 'Found ON DELETE CASCADE. Bad.');
$result=strpos($filecontent,'ON DELETE CASCADE');
print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
$this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.');
}
}
return;