[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/mysql/migration/ -> 1.1.0-2.0.0.sql (source)

   1  -- $Revision: 1.103.2.3 $
   2  --
   3  -- Attention à l ordre des requetes
   4  -- ce fichier doit être chargé sur une version 1.1.0 
   5  -- sans AUCUNE erreur ni warning
   6  -- ;
   7  
   8  
   9  drop table if exists llx_c_tva;
  10  
  11  create table llx_c_tva
  12  (
  13    rowid             integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
  14    fk_pays           integer NOT NULL,
  15    taux              double  NOT NULL,
  16    recuperableonly   integer NOT NULL DEFAULT 0,
  17    note              varchar(128),
  18    active            tinyint DEFAULT 1 NOT NULL
  19  
  20  )type=innodb;
  21  
  22  -- ALLEMAGNE (id 5)
  23  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5,  '16','0','VAT Rate 16',1);
  24  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 52, 5,   '7','0','VAT Rate 7',1);
  25  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 53, 5,   '0','0','VAT Rate 0',1);
  26  
  27  -- BELGIQUE (id 2)
  28  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 21, 2,  '21','0','VAT Rate 21',1);
  29  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 22, 2,   '6','0','VAT Rate 6',1);
  30  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 23, 2,   '0','0','VAT Rate 0 ou non applicable',1);
  31  
  32  -- CANADA (id 14)
  33  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (141,14,   '7','0','VAT Rate 7',1);
  34  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (142,14,   '0','0','VAT Rate 0',1);
  35  
  36  -- ESPAGNE (id 4)
  37  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 41, 4,  '16','0','VAT Rate 16',1);
  38  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 42, 4,   '7','0','VAT Rate 7',1);
  39  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 43, 4,   '4','0','VAT Rate 4',1);
  40  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 44, 4,   '0','0','VAT Rate 0',1);
  41  
  42  -- ITALY (id 3)
  43  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 31, 3,  '20','0','VAT Rate 20',1);
  44  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 32, 3,  '10','0','VAT Rate 10',1);
  45  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 33, 3,   '4','0','VAT Rate 4',1);
  46  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3,   '0','0','VAT Rate 0',1);
  47  
  48  -- FRANCE (id 1)
  49  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1,'19.6','0','VAT Rate 19.6 (France hors DOM-TOM)',1);
  50  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 12, 1, '8.5','0','VAT Rate 8.5 (DOM sauf Guyane et Saint-Martin)',0);
  51  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 13, 1, '8.5','1','VAT Rate 8.5 (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par l\'acheteur',0);
  52  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT Rate 5.5 (France hors DOM-TOM)',1);
  53  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1,   '0','0','VAT Rate 0 ou non applicable (France, TOM)',1);
  54  
  55  -- PAYS-BAS (id 17)
  56  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (171,17,  '19','0','VAT Rate 19',1);
  57  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (172,17,   '6','0','VAT Rate 6',1);
  58  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (173,17,   '0','0','VAT Rate 0',1);
  59  
  60  -- PORTUGAL (id 26)
  61  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (261,26,  '17','0','VAT Rate 17',1);
  62  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (262,26,  '12','0','VAT Rate 12',1);
  63  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (263,26,   '0','0','VAT Rate 0',1);
  64  
  65  -- ROYAUME UNI (id 7)
  66  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 71, 7,'17.5','0','VAT Rate 17.5',1);
  67  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 72, 7,   '5','0','VAT Rate 5',1);
  68  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 73, 7,   '0','0','VAT Rate 0',1);
  69  
  70  -- SUISSE (id 6)
  71  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '7.6','0','VAT Rate 7.6',1);
  72  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.6','0','VAT Rate 3.6',1);
  73  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.4','0','VAT Rate 2.4',1);
  74  insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6,   '0','0','VAT Rate 0',1);
  75  
  76  
  77  create table llx_user_clicktodial
  78  (
  79    fk_user       integer PRIMARY KEY,
  80    login         varchar(32),
  81    pass          varchar(64),
  82    poste         varchar(20)
  83  
  84  )type=innodb;
  85  
  86  create table llx_export_compta
  87  (
  88    rowid            integer AUTO_INCREMENT PRIMARY KEY,
  89    ref              varchar(12) NOT NULL,
  90    date_export      datetime NOT NULL,        -- date de creation
  91    fk_user          integer NOT NULL,
  92    note             text
  93  
  94  )type=innodb;
  95  
  96  create table llx_expeditiondet
  97  (
  98    rowid             integer AUTO_INCREMENT PRIMARY KEY,
  99    fk_expedition     integer NOT NULL,
 100    fk_commande_ligne integer NOT NULL,
 101    qty               real,              -- quantité
 102  
 103    key(fk_expedition),
 104    key(fk_commande_ligne)
 105  )type=innodb;
 106  
 107  create table llx_expedition_methode
 108  (
 109    rowid            integer PRIMARY KEY,
 110    tms              timestamp,
 111    code             varchar(30) NOT NULL,
 112    libelle          varchar(50) NOT NULL,
 113    description      text,
 114    statut           tinyint DEFAULT 0
 115  )type=innodb;
 116  
 117  create table llx_expedition
 118  (
 119    rowid                 integer AUTO_INCREMENT PRIMARY KEY,
 120    tms                   timestamp,
 121    ref                   varchar(30) NOT NULL,
 122    fk_commande           integer,
 123    date_creation         datetime,              -- date de creation 
 124    date_valid            datetime,              -- date de validation
 125    date_expedition       date,                  -- date de l'expedition
 126    fk_user_author        integer,               -- createur
 127    fk_user_valid         integer,               -- valideur
 128    fk_entrepot           integer,
 129    fk_expedition_methode integer,
 130    fk_statut             smallint  DEFAULT 0,
 131    note                  text,
 132    model_pdf             varchar(50),
 133  
 134    UNIQUE INDEX (ref),
 135    key(fk_expedition_methode),
 136    key(fk_commande)
 137  )type=innodb;
 138  
 139  create table llx_contratdet_log
 140  (
 141    rowid                 integer AUTO_INCREMENT PRIMARY KEY,
 142    tms                   timestamp,
 143    fk_contratdet         integer NOT NULL,
 144    date                  datetime NOT NULL,
 145    statut                smallint NOT NULL,
 146    fk_user_author        integer NOT NULL,
 147    commentaire           text
 148  
 149  )type=innodb;
 150  
 151  create table llx_compta_compte_generaux
 152  (
 153    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 154    date_creation   datetime,
 155    numero          varchar(50),
 156    intitule        varchar(255),
 157    fk_user_author  integer,
 158    note            text,
 159  
 160    UNIQUE(numero)
 161  )type=innodb;
 162  
 163  create table llx_categorie_association
 164  (
 165    fk_categorie_mere   integer NOT NULL,
 166    fk_categorie_fille  integer NOT NULL
 167  )type=innodb;
 168  
 169  
 170  create table llx_categorie_product
 171  (
 172    fk_categorie  integer NOT NULL,
 173    fk_product    integer NOT NULL
 174  )type=innodb;
 175  
 176  create table llx_c_methode_commande_fournisseur
 177  (
 178    rowid    integer AUTO_INCREMENT PRIMARY KEY,
 179    code     varchar(30),
 180    libelle  varchar(60),
 181    active   tinyint default 1  NOT NULL,
 182  
 183    UNIQUE INDEX(code)
 184  )type=innodb;
 185  
 186  INSERT INTO llx_c_methode_commande_fournisseur (rowid, code, libelle, active) VALUES (1, 'OrderByMail',  'Courrier',  1);
 187  INSERT INTO llx_c_methode_commande_fournisseur (rowid, code, libelle, active) VALUES (2, 'OrderByFax',   'Fax',       1);
 188  INSERT INTO llx_c_methode_commande_fournisseur (rowid, code, libelle, active) VALUES (3, 'OrderByEMail', 'EMail',     1);
 189  INSERT INTO llx_c_methode_commande_fournisseur (rowid, code, libelle, active) VALUES (4, 'OrderByPhone', 'Téléphone', 1);
 190  INSERT INTO llx_c_methode_commande_fournisseur (rowid, code, libelle, active) VALUES (5, 'OrderByWWW',   'En ligne',  1);
 191  
 192  create table llx_bookmark4u_login
 193  (
 194    rowid         integer AUTO_INCREMENT PRIMARY KEY,
 195    fk_user       integer,
 196    bk4u_uid      integer,
 197  
 198    UNIQUE INDEX(fk_user)
 199  )type=innodb;
 200  
 201  
 202  create table llx_categorie
 203  (
 204      rowid         integer AUTO_INCREMENT PRIMARY KEY,
 205      label         VARCHAR(255),
 206      description     text    
 207  )type=innodb;
 208  
 209  
 210  create table llx_product_fournisseur_price
 211  (
 212    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 213    datec           datetime,
 214    tms             timestamp,
 215    fk_product      integer,
 216    fk_soc          integer,
 217    price           real,
 218    quantity        real,
 219    fk_user         integer
 220  
 221  )type=innodb;
 222  
 223  create table llx_product_fournisseur_price_log
 224  (
 225    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 226    datec           datetime,
 227    fk_product      integer,
 228    fk_soc          integer,
 229    price           real,
 230    quantity        real,
 231    fk_user         integer
 232  
 233  )type=innodb;
 234  
 235  
 236  create table llx_usergroup
 237  (
 238    rowid         integer AUTO_INCREMENT PRIMARY KEY,
 239    datec         datetime,
 240    tms           timestamp,
 241    nom           varchar(255) NOT NULL UNIQUE,
 242    note          text
 243  
 244  )type=innodb;
 245  
 246  create table llx_usergroup_rights
 247  (
 248    rowid         integer AUTO_INCREMENT PRIMARY KEY,
 249    fk_usergroup  integer NOT NULL,
 250    fk_id         integer NOT NULL,
 251  
 252    UNIQUE(fk_usergroup,fk_id)
 253  )type=innodb;
 254  
 255  
 256  create table llx_usergroup_user
 257  (
 258    rowid         integer AUTO_INCREMENT PRIMARY KEY,
 259    fk_user       integer NOT NULL,
 260    fk_usergroup  integer NOT NULL,
 261  
 262    UNIQUE(fk_user,fk_usergroup)
 263  )type=innodb;
 264  
 265  DELETE llx_usergroup_rights FROM llx_usergroup_rights LEFT JOIN llx_usergroup ON llx_usergroup_rights.fk_usergroup = llx_usergroup.rowid WHERE llx_usergroup.rowid IS NULL;
 266  ALTER TABLE llx_usergroup_rights ADD FOREIGN KEY (fk_usergroup)    REFERENCES llx_usergroup (rowid);
 267  
 268  
 269  alter table llx_facture add  increment           varchar(10);
 270  alter table llx_facture drop column author;
 271  alter table llx_facture drop column fk_user;
 272  
 273  alter table llx_facture_rec add frequency char(2) DEFAULT NULL;
 274  alter table llx_facture_rec add last_gen varchar(7) DEFAULT NULL;
 275  
 276  create table llx_societe_commerciaux
 277  (
 278    rowid         integer AUTO_INCREMENT PRIMARY KEY,
 279    fk_soc        integer,
 280    fk_user       integer,
 281  
 282    UNIQUE INDEX(fk_soc, fk_user)
 283  )type=innodb;
 284  
 285  
 286  alter table llx_action_def add code varchar(24) NOT NULL after rowid;
 287  
 288  alter table llx_action_def modify objet_type enum('ficheinter','facture','propale','mailing') default NULL;
 289  
 290  update llx_action_def set code='NOTIFY_VAL_FICHINTER' where titre='Validation fiche intervention';
 291  update llx_action_def set code='NOTIFY_VAL_FAC' where titre='Validation facture';
 292  
 293  
 294  delete from llx_const where name like '%_OUTPUT_URL';
 295  delete from llx_const where name like 'MAIN_START_YEAR';
 296  
 297  alter table llx_boxes add box_order smallint default 0 NOT NULL;
 298  
 299  alter table llx_user drop column module_comm;
 300  alter table llx_user drop column module_compta;
 301  alter table llx_user add datelastaccess datetime;
 302  alter table llx_user add office_phone varchar(20);
 303  alter table llx_user add office_fax varchar(20);
 304  alter table llx_user add user_mobile varchar(20);
 305  alter table llx_user modify login varchar(24);
 306  
 307  alter table llx_user_rights add rowid integer AUTO_INCREMENT PRIMARY KEY;
 308  
 309  -- Commenté car semble déjà présent dans la base 1.1.0
 310  -- alter table llx_facture add fk_cond_reglement integer DEFAULT 1 NOT NULL;
 311  
 312  alter table llx_facture add fk_mode_reglement integer after fk_cond_reglement ;
 313  
 314  alter table llx_cond_reglement change column actif active tinyint(4);
 315  alter table llx_cond_reglement add code varchar(16) after rowid;
 316  update llx_cond_reglement set code='RECEP' where libelle='A réception' and code IS NULL;
 317  update llx_cond_reglement set code='30D' where libelle='30 jours' and code IS NULL;
 318  update llx_cond_reglement set code='30DENDMONTH' where libelle='30 jours fin de mois' and code IS NULL;
 319  update llx_cond_reglement set code='60D' where libelle='60 jours' and code IS NULL;
 320  update llx_cond_reglement set code='60DENDMONTH' where libelle='60 jours fin de mois' and code IS NULL;
 321   
 322  alter table llx_socpeople add cp varchar(25) after address;
 323  alter table llx_socpeople add ville varchar(255) after cp;
 324  alter table llx_socpeople add fk_pays integer DEFAULT 0 after ville;
 325  
 326  alter table llx_paiement add statut smallint DEFAULT 0 NOT NULL ;
 327  alter table llx_facturedet add fk_export_compta integer DEFAULT 0 NOT NULL ;
 328  alter table llx_paiement add fk_export_compta integer DEFAULT 0 NOT NULL ;
 329  
 330  alter table llx_facturedet add rang integer DEFAULT 0 NOT NULL;
 331  
 332  alter table llx_rights_def add perms varchar(255) after module;
 333  alter table llx_rights_def add subperms varchar(255) after perms;
 334  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="10";
 335  UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="11";
 336  UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="12";
 337  UPDATE llx_rights_def set perms="valider", subperms=NULL               where id="14";
 338  UPDATE llx_rights_def set perms="envoyer", subperms=NULL               where id="15";
 339  UPDATE llx_rights_def set perms="paiement", subperms=NULL              where id="16";
 340  UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="19";
 341  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="20";
 342  UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="21";
 343  UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="22";
 344  UPDATE llx_rights_def set perms="valider", subperms=NULL               where id="24";
 345  UPDATE llx_rights_def set perms="envoyer", subperms=NULL               where id="25";
 346  UPDATE llx_rights_def set perms="cloturer", subperms=NULL              where id="26";
 347  UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="27";
 348  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="30";
 349  UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="31";
 350  UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="32";
 351  UPDATE llx_rights_def set perms="commander", subperms=NULL             where id="33";
 352  UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="34";
 353  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="40";
 354  UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="41";
 355  UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="42";
 356  UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="44";
 357  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="70";
 358  UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="71";
 359  UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="72";
 360  UPDATE llx_rights_def set perms="modifier", subperms=NULL              where id="73";
 361  UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="74";
 362  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="80";
 363  UPDATE llx_rights_def set perms="lire", subperms=NULL                  where id="81";
 364  UPDATE llx_rights_def set perms="creer", subperms=NULL                 where id="82";
 365  UPDATE llx_rights_def set perms="valider", subperms=NULL               where id="84";
 366  UPDATE llx_rights_def set perms="supprimer", subperms=NULL             where id="89";
 367  UPDATE llx_rights_def set perms=NULL, subperms=NULL                    where id="90";
 368  UPDATE llx_rights_def set perms="charges", subperms="lire"             where id="91";
 369  UPDATE llx_rights_def set perms="charges", subperms="creer"            where id="92";
 370  UPDATE llx_rights_def set perms="charges", subperms="supprimer"        where id="93";
 371  UPDATE llx_rights_def set perms="resultat", subperms="lire"            where id="95";
 372  UPDATE llx_rights_def set perms="ventilation", subperms="parametrer"   where id="96";
 373  UPDATE llx_rights_def set perms="ventilation", subperms="creer"        where id="97";
 374  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="100";
 375  UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="101";
 376  UPDATE llx_rights_def set perms= "creer", subperms=NULL                where id="102";
 377  UPDATE llx_rights_def set perms= "valider", subperms=NULL              where id="104";
 378  UPDATE llx_rights_def set perms= "supprimer", subperms=NULL            where id="109";
 379  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="110";
 380  UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="111";
 381  UPDATE llx_rights_def set perms= "modifier", subperms=NULL             where id="112";
 382  UPDATE llx_rights_def set perms= "configurer", subperms=NULL           where id="113";
 383  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="120";
 384  UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="121";
 385  UPDATE llx_rights_def set perms= "creer", subperms=NULL                where id="122";
 386  UPDATE llx_rights_def set perms= "supprimer", subperms=NULL            where id="129";
 387  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="140";
 388  UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="141";
 389  UPDATE llx_rights_def set perms= "ligne_commander", subperms=NULL      where id="142";
 390  UPDATE llx_rights_def set perms= "ligne_activer", subperms=NULL        where id="143";
 391  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="144";
 392  UPDATE llx_rights_def set perms= "fournisseur", subperms="config"      where id="145";
 393  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="150";
 394  UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="151";
 395  UPDATE llx_rights_def set perms= "configurer", subperms=NULL           where id="152";
 396  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="160";
 397  UPDATE llx_rights_def set perms= "lire", subperms=NULL                 where id="161";
 398  UPDATE llx_rights_def set perms= "creer", subperms=NULL                where id="162";
 399  UPDATE llx_rights_def set perms= "activer", subperms=NULL              where id="163";
 400  UPDATE llx_rights_def set perms= "desactiver", subperms=NULL           where id="164";
 401  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="170";
 402  UPDATE llx_rights_def set perms= NULL, subperms=NULL                   where id="180";
 403  UPDATE llx_rights_def set perms= "commande", subperms="lire"           where id="181";
 404  UPDATE llx_rights_def set perms= "commande", subperms="creer"          where id="182";
 405  UPDATE llx_rights_def set perms= "commande", subperms="valider"        where id="183";
 406  UPDATE llx_rights_def set perms= "commande", subperms="approuver"      where id="184";
 407  UPDATE llx_rights_def set perms= "commande", subperms="commander"      where id="185";
 408  UPDATE llx_rights_def set perms= "commande", subperms="cloturer"       where id="186";
 409  UPDATE llx_rights_def set perms= "ligne", subperms="creer"             where id="192";
 410  UPDATE llx_rights_def set perms= "adsl", subperms="creer"              where id="202";
 411  UPDATE llx_rights_def set perms= "adsl", subperms="requete"            where id="203";
 412  UPDATE llx_rights_def set perms= "adsl", subperms="commander"          where id="204";
 413  UPDATE llx_rights_def set perms= "adsl", subperms="gerer"              where id="205";
 414  UPDATE llx_rights_def set perms= "contrat", subperms="paiement"        where id="215";
 415  delete from llx_rights_def where perms is null and subperms is null;
 416  delete from llx_rights_def where id=73;
 417  
 418  alter table llx_facturedet add fk_code_ventilation integer NOT NULL DEFAULT 0;
 419  
 420  
 421  alter table llx_contrat change fk_user_cloture  fk_user_cloture integer;
 422  alter table llx_contrat change fk_user_mise_en_service fk_user_mise_en_service integer;
 423  alter table llx_contrat change enservice statut smallint(6) default 0;
 424  alter table llx_contrat add   datec             datetime after tms;
 425  alter table llx_contrat add   date_contrat      datetime after datec;
 426  alter table llx_contrat add   fk_projet         integer after fk_soc;
 427  alter table llx_contrat add   fk_commercial_signature integer NOT NULL after fk_projet;
 428  alter table llx_contrat add   fk_commercial_suivi     integer NOT NULL after fk_commercial_signature;
 429  alter table llx_contrat add   facture           smallint(6) default 0;
 430  alter table llx_contrat add   ref                 varchar(30) after rowid;
 431  
 432    
 433  alter table llx_facturedet add date_start date;
 434  alter table llx_facturedet add date_end   date;
 435  
 436  alter table llx_user add egroupware_id integer;
 437  alter table llx_societe add code_client              varchar(15) after nom;
 438  alter table llx_societe add code_fournisseur         varchar(15) after code_client;
 439  alter table llx_societe add code_compta              varchar(15) after code_fournisseur;
 440  alter table llx_societe add code_compta_fournisseur  varchar(15) after code_compta;
 441  alter table llx_societe add siret     varchar(14) after siren;
 442  alter table llx_societe add ape       varchar(4) after siret;
 443  alter table llx_societe add tva_intra varchar(20) after ape;
 444  alter table llx_societe add capital real after tva_intra;
 445  alter table llx_societe add rubrique varchar(255);
 446  alter table llx_societe add remise_client real default 0;
 447  
 448  update llx_societe set prefix_comm = null where prefix_comm = '';
 449  update llx_societe set code_client = null where code_client = '';
 450  ALTER TABLE llx_societe ADD UNIQUE uk_societe_prefix_comm(prefix_comm);
 451  ALTER TABLE llx_societe ADD UNIQUE uk_societe_code_client(code_client);
 452  
 453  insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_REQUIRED','1','yesno','Le mail est obligatoire pour créer un adhérent',0);
 454  
 455  alter table llx_societe add fk_forme_juridique integer default 0 after fk_typent;
 456  
 457  alter table llx_societe add fk_departement integer default 0 after ville;
 458  
 459  alter table llx_societe add fk_user_creat integer;
 460  alter table llx_societe add fk_user_modif integer;
 461  
 462  alter table llx_socpeople add civilite varchar(6);
 463  alter table llx_socpeople add fk_user_modif integer;
 464  
 465  
 466  alter table llx_paiement add tms timestamp after datec;
 467  alter table llx_paiement add fk_user_creat integer;
 468  alter table llx_paiement add fk_user_modif integer;
 469  
 470  alter table llx_propal add fin_validite datetime ;
 471  alter table llx_propal add fk_cond_reglement integer after total;
 472  alter table llx_propal add fk_mode_reglement integer after total;
 473  
 474  alter table llx_entrepot add statut  tinyint default 1;
 475  alter table llx_entrepot add lieu    varchar(64);
 476  alter table llx_entrepot add address varchar(255);
 477  alter table llx_entrepot add cp      varchar(10);
 478  alter table llx_entrepot add ville   varchar(50);
 479  alter table llx_entrepot add fk_pays integer DEFAULT 0;
 480  
 481  alter table llx_product add stock_propale integer default 0;
 482  alter table llx_product add stock_commande integer default 0;
 483  alter table llx_product add seuil_stock_alerte integer default 0;
 484  update llx_product set ref=substring(label,0,15) where ref is null;
 485  alter table llx_product modify ref varchar(15) UNIQUE NOT NULL;
 486  alter table llx_product add note text after description;
 487  
 488  alter table llx_product_stock change value reel integer;
 489  alter table llx_product_stock change fk_stock fk_entrepot integer;
 490  
 491  alter table llx_groupart add description text after groupart ;
 492  
 493  alter table llx_socpeople add phone_perso varchar(30) after phone ;
 494  alter table llx_socpeople add phone_mobile varchar(30) after phone_perso ;
 495  alter table llx_socpeople add jabberid varchar(255) after email ;
 496  alter table llx_socpeople add birthday date after address ;
 497  alter table llx_socpeople add tms timestamp after datec ;
 498  
 499  
 500  ALTER TABLE llx_facture ADD INDEX idx_facture_fk_soc (fk_soc);
 501  ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_author (fk_user_author);
 502  ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_valid (fk_user_valid);
 503  ALTER TABLE llx_facture ADD INDEX idx_facture_fk_projet (fk_projet);
 504  
 505  ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc            FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
 506  ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author    FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
 507  ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_valid     FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
 508  ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_projet         FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
 509  
 510  
 511  alter table llx_facture_fourn drop index facnumber ;
 512  alter table llx_facture_fourn add unique index (facnumber, fk_soc) ;
 513  
 514  alter table llx_facture_fourn add fk_projet integer ;
 515  alter table llx_facture_fourn add fk_cond_reglement integer DEFAULT 1 NOT NULL ;
 516  alter table llx_facture_fourn add date_lim_reglement  date;
 517  
 518  ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_soc (fk_soc);
 519  ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_user_author (fk_user_author);
 520  ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_user_valid (fk_user_valid);
 521  ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_projet (fk_projet);
 522  
 523  ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_soc            FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
 524  ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_user_author    FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
 525  ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_user_valid     FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
 526  ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_projet         FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
 527  
 528  ALTER TABLE llx_facture_fourn_det ADD fk_export_compta INT( 11 ) NOT NULL AFTER total_ttc;
 529  ALTER TABLE llx_facture_fourn_det ADD fk_code_ventilation INT( 11 ) NOT NULL AFTER fk_export_compta ; 
 530  
 531  update llx_facture_fourn set date_lim_reglement = datef where fk_cond_reglement = 1;
 532  
 533  alter table llx_bank_account modify bank varchar(60);
 534  alter table llx_bank_account modify domiciliation varchar(255);
 535  alter table llx_bank_account add proprio varchar(60) after domiciliation ;
 536  alter table llx_bank_account add adresse_proprio varchar(255) after proprio ;
 537  alter table llx_bank_account add account_number varchar(8) after clos ;
 538  alter table llx_bank_account add rappro smallint DEFAULT 1 after clos;
 539  alter table llx_bank_account modify label varchar(30) unique;
 540  update llx_bank_account set account_number = '51' where account_number is null;
 541  ALTER TABLE llx_bank_account drop index label;
 542  ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label);
 543  
 544  alter table llx_paiement add fk_bank integer NOT NULL after note ;
 545  alter table llx_paiementfourn add fk_bank integer NOT NULL after note ;
 546  
 547  
 548  alter table c_actioncomm     rename llx_c_actioncomm ;
 549  alter table c_effectif       rename llx_c_effectif ;
 550  alter table c_paiement       rename llx_c_paiement ;
 551  alter table c_pays           rename llx_c_pays ;
 552  alter table c_propalst       rename llx_c_propalst ;
 553  alter table c_stcomm         rename llx_c_stcomm ;
 554  alter table c_typent         rename llx_c_typent ;
 555  
 556  alter table llx_c_actioncomm add type varchar(10) not null default 'system' after id;
 557  alter table llx_c_actioncomm add active tinyint default 1 NOT NULL after libelle;
 558  
 559  alter table llx_c_paiement add code varchar(6) after id;
 560  
 561  
 562  create table llx_prelevement_facture
 563  (
 564    rowid                  integer AUTO_INCREMENT PRIMARY KEY,
 565    fk_facture             integer NOT NULL,
 566    fk_prelevement_lignes  integer NOT NULL
 567  
 568  )type=innodb;
 569  
 570  
 571  create table llx_prelevement_facture_demande
 572  (
 573    rowid               integer AUTO_INCREMENT PRIMARY KEY,
 574    fk_facture          integer NOT NULL,
 575    amount              real NOT NULL,
 576    date_demande        datetime NOT NULL,
 577    traite              smallint DEFAULT 0,
 578    date_traite         datetime,
 579    fk_prelevement_bons integer,
 580    fk_user_demande     integer NOT NULL,
 581  
 582    code_banque         varchar(7),
 583    code_guichet        varchar(6),
 584    number              varchar(255),
 585    cle_rib             varchar(5)
 586  
 587  )type=innodb;
 588  
 589  
 590  create table llx_prelevement_bons
 591  (
 592    rowid          integer AUTO_INCREMENT PRIMARY KEY,
 593    ref            varchar(12),
 594    datec          datetime,
 595    amount         real DEFAULT 0,
 596    statut         smallint DEFAULT 0,
 597    credite        smallint DEFAULT 0,
 598    note           text,
 599    date_trans     datetime,  
 600    method_trans   smallint,  
 601    fk_user_trans  integer,   
 602    date_credit    datetime,  
 603    fk_user_credit integer,   
 604    
 605    UNIQUE(ref)
 606  )type=innodb;
 607  
 608  
 609  create table llx_prelevement_lignes
 610  (
 611    rowid               integer AUTO_INCREMENT PRIMARY KEY,
 612    fk_prelevement_bons integer,
 613    fk_soc              integer NOT NULL,
 614    statut              smallint DEFAULT 0,
 615  
 616    client_nom          varchar(255),
 617    amount              real DEFAULT 0,
 618    code_banque         varchar(7),
 619    code_guichet        varchar(6),
 620    number              varchar(255),
 621    cle_rib             varchar(5),
 622  
 623    note                text
 624  
 625  )type=innodb;
 626  
 627  
 628  create table llx_prelevement_rejet
 629  (
 630    rowid                 integer AUTO_INCREMENT PRIMARY KEY,
 631    fk_prelevement_lignes integer,
 632    date_rejet            datetime,
 633    motif                 integer,
 634    date_creation         datetime,
 635    fk_user_creation      integer,
 636    note                  text
 637  
 638  )type=innodb;
 639  
 640  alter table llx_prelevement_rejet add afacturer tinyint default 0;
 641  alter table llx_prelevement_rejet add fk_facture integer;
 642  
 643  ALTER TABLE llx_prelevement_facture ADD INDEX (fk_prelevement_lignes);
 644  ALTER TABLE llx_prelevement_facture ADD FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid);
 645  ALTER TABLE llx_prelevement_lignes ADD INDEX (fk_prelevement_bons);
 646  ALTER TABLE llx_prelevement_lignes ADD FOREIGN KEY (fk_prelevement_bons) REFERENCES llx_prelevement_bons (rowid);
 647  
 648  
 649  create table llx_prelevement_notifications
 650  (
 651    rowid     integer AUTO_INCREMENT PRIMARY KEY,
 652    fk_user   integer NOT NULL,
 653    action    varchar(2) 
 654  
 655  )type=innodb;
 656  
 657  
 658  
 659  create table llx_mailing
 660  (
 661    rowid              integer AUTO_INCREMENT PRIMARY KEY,
 662  
 663    statut             smallint       DEFAULT 0,   
 664  
 665    date_envoi         datetime,                   
 666    titre              varchar(60),                
 667    sujet              varchar(60),                
 668    body               text,
 669    cible              varchar(60),
 670  
 671    nbemail            integer,
 672  
 673    email_from         varchar(160),               
 674    email_replyto      varchar(160),               
 675    email_errorsto     varchar(160),               
 676  
 677    date_creat         datetime,                   
 678    date_valid         datetime,                   
 679    date_appro         datetime,                   
 680  
 681    fk_user_creat      integer,                    
 682    fk_user_valid      integer,                    
 683    fk_user_appro      integer                     
 684  
 685  )type=innodb;
 686  
 687  
 688  create table llx_mailing_cibles
 689  (
 690    rowid              integer AUTO_INCREMENT PRIMARY KEY,
 691    fk_mailing         integer NOT NULL,
 692    fk_contact         integer NOT NULL,
 693    nom                varchar(160),
 694    prenom             varchar(160),
 695    email              varchar(160) NOT NULL
 696  
 697  )type=innodb;
 698  
 699  -- Ajout des champs statut, url et date_envoi
 700  alter table llx_mailing_cibles ADD statut SMALLINT DEFAULT 0 NOT NULL AFTER email;
 701  alter table llx_mailing_cibles ADD url varchar(160) AFTER statut;
 702  alter table llx_mailing_cibles ADD date_envoi DATETIME NOT NULL AFTER url;
 703  alter table llx_mailing_cibles ADD UNIQUE uk_mailing_cibles (fk_mailing, email);
 704  
 705  --
 706  --create table llx_stock_mouvement
 707  --(
 708  --  rowid           integer AUTO_INCREMENT PRIMARY KEY,
 709  --  tms             timestamp,
 710  --  datem           datetime,
 711  --  fk_product      integer NOT NULL,
 712  --  value           integer,
 713  --  type_mouvement  smallint,
 714  --  fk_user_author  integer,
 715  --  key(fk_product),
 716  --  key(fk_entrepot)
 717  --)type=innodb;
 718  
 719  alter table llx_stock_mouvement ADD fk_entrepot     integer NOT NULL after fk_product;
 720  
 721  
 722  create table llx_birthday_alert
 723  (
 724    rowid        integer AUTO_INCREMENT PRIMARY KEY,
 725    fk_contact   integer,
 726    fk_user      integer
 727  )type=innodb;
 728  
 729  
 730  alter table llx_birthday_alert rename llx_user_alert ;
 731  alter table llx_user_alert add type integer after rowid;
 732  update llx_user_alert set type=1 where type is null;
 733  
 734  
 735  create table llx_co_fa
 736  (
 737    rowid       integer AUTO_INCREMENT PRIMARY KEY,
 738    fk_commande integer NOT NULL,
 739    fk_facture  integer NOT NULL,
 740  
 741    key(fk_commande),
 742    key(fk_facture)
 743  )type=innodb;
 744  
 745  
 746  create table llx_co_pr
 747  (
 748    rowid       integer AUTO_INCREMENT PRIMARY KEY,
 749    fk_commande integer,
 750    fk_propale  integer
 751  )type=innodb;
 752  
 753  
 754  create table llx_paiement_facture
 755  (
 756    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 757    fk_paiement     integer,
 758    fk_facture      integer,
 759    amount          real default 0,
 760    
 761    key (fk_paiement),
 762    key( fk_facture)
 763  )type=innodb;
 764  
 765  
 766  insert into llx_const(name, value, type, note, visible) values ('MAIN_UPLOAD_DOC','1','chaine','Authorise l\'upload de document',0);
 767  insert into llx_const(name, value, type, note, visible) values ('MAIN_SEARCHFORM_PRODUITSERVICE','1','yesno','Affichage formulaire de recherche des Produits et Services dans la barre de gauche',0);
 768  
 769  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_ACTIONS_TODO','7','chaine','Tolérance de retard avant alerte (en jours) sur actions planifiées non réalisées',0);
 770  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_ORDERS_TO_PROCESS','2','chaine','Tolérance de retard avant alerte (en jours) sur commandes non traitées',0);
 771  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_PROPALS_TO_CLOSE','31','chaine','Tolérance de retard avant alerte (en jours) sur propales à cloturer',0);
 772  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_PROPALS_TO_BILL','7','chaine','Tolérance de retard avant alerte (en jours) sur propales non facturées',0);
 773  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_SUPPLIER_BILLS_TO_PAY','2','chaine','Tolérance de retard avant alerte (en jours) sur factures fournisseur impayées',0);
 774  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_CUSTOMER_BILLS_UNPAYED','31','chaine','Tolérance de retard avant alerte (en jours) sur factures client impayées',0);
 775  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_NOT_ACTIVATED_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services à activer',0);
 776  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0);
 777  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0);
 778  insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0);
 779         
 780  delete from llx_const where name = 'COMPTA_BANK_FACTURES';
 781  update llx_const set visible='0' where name='MAIN_UPLOAD_DOC';
 782  update llx_const set visible='0' where name='MAIN_TITLE';
 783  
 784  update llx_bank set fk_type = 'VAD' where fk_type = 'WWW';
 785  update llx_bank set fk_type = 'LIQ' where fk_type = 'DEP';
 786  
 787  alter table llx_socpeople change civilite civilite varchar(6);
 788  
 789  update llx_paiement set author = null where author = '';
 790  
 791  create table llx_paiementcharge
 792  (
 793    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 794    fk_charge       integer,
 795    datec           datetime,
 796    tms             timestamp,
 797    datep           datetime,
 798    amount          real default 0,
 799    fk_typepaiement integer NOT NULL,
 800    num_paiement    varchar(50),
 801    note            text,
 802    fk_bank         integer NOT NULL,
 803    fk_user_creat   integer,
 804    fk_user_modif   integer
 805  
 806  )type=innodb;
 807  
 808  
 809  delete from llx_const where name like 'DONS_%';
 810  insert into llx_const (name, value, type, visible) values ('DON_ADDON','html_cerfafr','chaine',0);
 811  
 812  update llx_const set visible=0 where name like 'ADHERENT%';
 813  update llx_const set visible=0 where name like 'PROPALE_ADDON%';
 814  
 815  
 816  create table llx_user_param
 817  (
 818    fk_user       integer      NOT NULL,
 819    page          varchar(255) NOT NULL,
 820    param         varchar(64)  NOT NULL,
 821    value         varchar(255) NOT NULL,
 822  
 823    UNIQUE (fk_user,page,param)
 824  )type=innodb;
 825  
 826  alter table llx_user_param modify fk_user       integer      NOT NULL;
 827  alter table llx_user_param modify page          varchar(255) NOT NULL;
 828  alter table llx_user_param modify param         varchar(64)  NOT NULL;
 829  alter table llx_user_param modify value         varchar(255) NOT NULL;
 830  
 831  
 832  update llx_bank set datev=dateo where datev is null;
 833  
 834  update llx_chargesociales set periode=date_ech where periode is null or periode = '0000-00-00';
 835  
 836  -- pour virer les doublons de llx_bank_url (dus à un ancien bug)
 837  alter ignore table llx_bank_url add unique index(fk_bank,url_id);
 838  alter table llx_bank_url add type enum("company","payment","member","donation","charge");
 839  update llx_bank_url set type = 'payment' where label='(paiement)' and type is null;
 840  
 841  create table llx_societe_remise
 842  (
 843    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 844    fk_soc          integer NOT NULL,
 845    tms             timestamp,
 846    datec              datetime,                            
 847    fk_user_author  integer,                             
 848    remise_client   real           default 0,            
 849    note            text
 850  
 851  )type=innodb;
 852  
 853  
 854  create table llx_societe_remise_except
 855  (
 856    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 857    fk_soc          integer NOT NULL,
 858    datec           datetime,
 859    amount_ht       real NOT NULL,
 860    fk_user         integer NOT NULL,
 861    fk_facture      integer,
 862    description     text
 863  
 864  )type=innodb;
 865  
 866  create table llx_contact_facture
 867  (
 868    idp          integer AUTO_INCREMENT PRIMARY KEY,
 869    fk_soc       integer NOT NULL,
 870    fk_contact   integer NOT NULL,
 871  
 872    UNIQUE (fk_soc, fk_contact)
 873  )type=innodb;
 874  
 875  
 876  --
 877  --
 878  --
 879  --
 880  
 881  create table llx_so_gr
 882  (
 883    rowid       integer AUTO_INCREMENT PRIMARY KEY,
 884    fk_soc      integer,
 885    fk_groupe   integer,
 886  
 887    UNIQUE(fk_soc, fk_groupe)
 888  )type=innodb;
 889  
 890  create table llx_groupesociete_remise
 891  (
 892    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 893    fk_groupe       integer NOT NULL,
 894    tms             timestamp,
 895    datec              datetime,                            
 896    fk_user_author  integer,                             
 897    remise          real           default 0,            
 898    note            text
 899  
 900  )type=innodb;
 901  
 902  create table llx_groupesociete
 903  (
 904    rowid           integer AUTO_INCREMENT PRIMARY KEY,
 905    parent          integer UNIQUE,
 906    tms             timestamp,
 907    datec              datetime,                            
 908    nom             varchar(60),                         
 909    note            text,                                
 910    remise          real           default 0,
 911    fk_user_author  integer
 912  
 913  )type=innodb;
 914  
 915  --
 916  --
 917  --
 918  --
 919  
 920  create table llx_commande
 921  (
 922    rowid            integer AUTO_INCREMENT PRIMARY KEY,
 923    tms              timestamp,
 924    fk_soc           integer,
 925    fk_soc_contact   integer,
 926    fk_projet        integer default 0,
 927    ref              varchar(30) NOT NULL,
 928    date_creation    datetime,            
 929    date_valid       datetime,            
 930    date_cloture     datetime,            
 931    date_commande    date,                
 932    fk_user_author   integer,             
 933    fk_user_valid    integer,             
 934    fk_user_cloture  integer,             
 935    source           smallint NOT NULL,
 936    fk_statut        smallint  default 0,
 937    amount_ht        real      default 0,
 938    remise_percent   real      default 0,
 939    remise           real      default 0,
 940    tva              real      default 0,
 941    total_ht         real      default 0,
 942    total_ttc        real      default 0,
 943    note             text,
 944    model_pdf        varchar(50),
 945    facture          tinyint default 0,   
 946    UNIQUE INDEX (ref)
 947  )type=innodb;
 948  
 949  update llx_commande set date_cloture=tms where date_cloture is null and fk_statut > 2;
 950  
 951  create table llx_commandedet
 952  (
 953    rowid          integer AUTO_INCREMENT PRIMARY KEY,
 954    fk_commande    integer,
 955    fk_product     integer,
 956    label          varchar(255),
 957    description    text,
 958    tva_tx         real default 19.6,
 959    qty         real,             
 960    remise_percent real default 0,
 961    remise         real default 0,
 962    subprice       real,          
 963    price          real           
 964  )type=innodb;
 965  
 966  create table llx_commande_fournisseur
 967  (
 968    rowid               integer AUTO_INCREMENT PRIMARY KEY,
 969    tms                 timestamp,
 970    fk_soc              integer,
 971    fk_soc_contact      integer,
 972    fk_projet           integer DEFAULT 0,   
 973    ref                 varchar(30) NOT NULL,
 974    date_creation       datetime,            
 975    date_valid          datetime,            
 976    date_cloture        datetime,            
 977    date_commande       date,                
 978    fk_methode_commande integer default 0,
 979    fk_user_author      integer,             
 980    fk_user_valid       integer,             
 981    fk_user_cloture     integer,             
 982    source              smallint NOT NULL,
 983    fk_statut           smallint  default 0,
 984    amount_ht           real      default 0,
 985    remise_percent      real      default 0,
 986    remise              real      default 0,
 987    tva                 real      default 0,
 988    total_ht            real      default 0,
 989    total_ttc           real      default 0,
 990    note                text,
 991    model_pdf           varchar(50),
 992  
 993    UNIQUE INDEX (ref)
 994  )type=innodb;
 995  
 996  create table llx_commande_fournisseur_log
 997  (
 998    rowid            integer AUTO_INCREMENT PRIMARY KEY,
 999    tms              timestamp,
1000    datelog          datetime NOT NULL,
1001    fk_commande      integer NOT NULL,
1002    fk_statut        smallint NOT NULL,
1003    fk_user          integer NOT NULL
1004  )type=innodb;
1005  
1006  create table llx_commande_fournisseurdet
1007  (
1008    rowid          integer AUTO_INCREMENT PRIMARY KEY,
1009    fk_commande    integer,
1010    fk_product     integer,
1011    ref            varchar(50),
1012    label          varchar(255),
1013    description    text,
1014    tva_tx         real DEFAULT 19.6,
1015    qty            real,             
1016    remise_percent real DEFAULT 0,
1017    remise         real DEFAULT 0,
1018    subprice       real,          
1019    price          real           
1020  )type=innodb;
1021  
1022  
1023  create table llx_societe_rib
1024  (
1025    rowid          integer AUTO_INCREMENT PRIMARY KEY,
1026    fk_soc         integer NOT NULL,
1027    datec          datetime,
1028    tms            timestamp,
1029    label          varchar(30),
1030    bank           varchar(255),
1031    code_banque    varchar(7),
1032    code_guichet   varchar(6),
1033    number         varchar(255),
1034    cle_rib        varchar(5),
1035    bic            varchar(10),
1036    iban_prefix    varchar(5),
1037    domiciliation  varchar(255),
1038    proprio        varchar(60),
1039    adresse_proprio varchar(255)
1040  
1041  
1042  )type=innodb;
1043  
1044  
1045  
1046  
1047  drop table if exists llx_c_accountingsystem;
1048  
1049  drop table if exists llx_accountingsystem_det;
1050  drop table if exists llx_accountingsystem;
1051  
1052  create table llx_accountingsystem
1053  (
1054    pcg_version       varchar(12)     PRIMARY KEY,
1055    fk_pays           integer         NOT NULL,
1056    label             varchar(128)    NOT NULL,
1057    datec             varchar(12)     NOT NULL,
1058    fk_author         varchar(20),
1059    tms               timestamp,
1060    active            smallint        DEFAULT 0
1061  )type=innodb;
1062  
1063  create table llx_accountingsystem_det
1064  (
1065    rowid             integer AUTO_INCREMENT PRIMARY KEY,
1066    fk_pcg_version    varchar(12)  NOT NULL,
1067    pcg_type          varchar(20)  NOT NULL,
1068    pcg_subtype       varchar(20)  NOT NULL,
1069    label             varchar(128) NOT NULL,
1070    account_number    varchar(20)  NOT NULL,
1071    account_parent    varchar(20)
1072  )type=innodb;
1073  
1074  
1075  
1076  ALTER TABLE llx_accountingsystem_det ADD INDEX idx_accountingsystem_det_fk_pcg_version (fk_pcg_version);
1077  
1078  
1079  ALTER TABLE llx_accountingsystem_det ADD FOREIGN KEY (fk_pcg_version)    REFERENCES llx_accountingsystem (pcg_version);
1080  
1081  
1082  delete from llx_accountingsystem_det;
1083  delete from llx_accountingsystem;
1084  
1085  insert into llx_accountingsystem (pcg_version, fk_pays, label, datec, fk_author, active) VALUES ('PCG99-ABREGE', 1, 'Plan de compte standard français abrégé', sysdate(), null, 0);
1086  
1087  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  1,'PCG99-ABREGE','CAPIT', 'CAPITAL', '101', '1', 'Capital');
1088  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  2,'PCG99-ABREGE','CAPIT', 'XXXXXX',  '105', '1', 'Ecarts de réévaluation');
1089  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  3,'PCG99-ABREGE','CAPIT', 'XXXXXX', '1061', '1', 'Réserve légale');
1090  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  4,'PCG99-ABREGE','CAPIT', 'XXXXXX', '1063', '1', 'Réserves statutaires ou contractuelles');
1091  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  5,'PCG99-ABREGE','CAPIT', 'XXXXXX', '1064', '1', 'Réserves réglementées');
1092  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  6,'PCG99-ABREGE','CAPIT', 'XXXXXX', '1068', '1', 'Autres réserves');
1093  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  7,'PCG99-ABREGE','CAPIT', 'XXXXXX',  '108', '1', 'Compte de l''exploitant');
1094  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  8,'PCG99-ABREGE','CAPIT', 'XXXXXX',   '12', '1', 'Résultat de l''exercice');
1095  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (  9,'PCG99-ABREGE','CAPIT', 'XXXXXX',  '145', '1', 'Amortissements dérogatoires');
1096  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 10,'PCG99-ABREGE','CAPIT', 'XXXXXX',  '146', '1', 'Provision spéciale de réévaluation');
1097  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 11,'PCG99-ABREGE','CAPIT', 'XXXXXX',  '147', '1', 'Plus-values réinvesties');
1098  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 12,'PCG99-ABREGE','CAPIT', 'XXXXXX',  '148', '1', 'Autres provisions réglementées');
1099  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 13,'PCG99-ABREGE','CAPIT', 'XXXXXX',   '15', '1', 'Provisions pour risques et charges');
1100  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 14,'PCG99-ABREGE','CAPIT', 'XXXXXX',   '16', '1', 'Emprunts et dettes assimilees');
1101  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 15,'PCG99-ABREGE','IMMO',  'XXXXXX',   '20', '2', 'Immobilisations incorporelles');
1102  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 16,'PCG99-ABREGE','IMMO',  'XXXXXX',  '201','20', 'Frais d''établissement');
1103  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 17,'PCG99-ABREGE','IMMO',  'XXXXXX',  '206','20', 'Droit au bail');
1104  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 18,'PCG99-ABREGE','IMMO',  'XXXXXX',  '207','20', 'Fonds commercial');
1105  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 19,'PCG99-ABREGE','IMMO',  'XXXXXX',  '208','20', 'Autres immobilisations incorporelles');
1106  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 20,'PCG99-ABREGE','IMMO',  'XXXXXX',   '21', '2', 'Immobilisations corporelles');
1107  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 21,'PCG99-ABREGE','IMMO',  'XXXXXX',   '23', '2', 'Immobilisations en cours');
1108  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 22,'PCG99-ABREGE','IMMO',  'XXXXXX',   '27', '2', 'Autres immobilisations financieres');
1109  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 23,'PCG99-ABREGE','IMMO',  'XXXXXX',  '280', '2', 'Amortissements des immobilisations incorporelles');
1110  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 24,'PCG99-ABREGE','IMMO',  'XXXXXX',  '281', '2', 'Amortissements des immobilisations corporelles');
1111  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 25,'PCG99-ABREGE','IMMO',  'XXXXXX',  '290', '2', 'Provisions pour dépréciation des immobilisations incorporelles');
1112  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 26,'PCG99-ABREGE','IMMO',  'XXXXXX',  '291', '2', 'Provisions pour dépréciation des immobilisations corporelles');
1113  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 27,'PCG99-ABREGE','IMMO',  'XXXXXX',  '297', '2', 'Provisions pour dépréciation des autres immobilisations financières');
1114  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 28,'PCG99-ABREGE','STOCK', 'XXXXXX',   '31', '3', 'Matieres premières');
1115  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 29,'PCG99-ABREGE','STOCK', 'XXXXXX',   '32', '3', 'Autres approvisionnements');
1116  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 30,'PCG99-ABREGE','STOCK', 'XXXXXX',   '33', '3', 'En-cours de production de biens');
1117  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 31,'PCG99-ABREGE','STOCK', 'XXXXXX',   '34', '3', 'En-cours de production de services');
1118  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 32,'PCG99-ABREGE','STOCK', 'XXXXXX',   '35', '3', 'Stocks de produits');
1119  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 33,'PCG99-ABREGE','STOCK', 'XXXXXX',   '37', '3', 'Stocks de marchandises');
1120  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 34,'PCG99-ABREGE','STOCK', 'XXXXXX',  '391', '3', 'Provisions pour dépréciation des matières premières');
1121  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 35,'PCG99-ABREGE','STOCK', 'XXXXXX',  '392', '3', 'Provisions pour dépréciation des autres approvisionnements');
1122  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 36,'PCG99-ABREGE','STOCK', 'XXXXXX',  '393', '3', 'Provisions pour dépréciation des en-cours de production de biens');
1123  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 37,'PCG99-ABREGE','STOCK', 'XXXXXX',  '394', '3', 'Provisions pour dépréciation des en-cours de production de services');
1124  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 38,'PCG99-ABREGE','STOCK', 'XXXXXX',  '395', '3', 'Provisions pour dépréciation des stocks de produits');
1125  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 39,'PCG99-ABREGE','STOCK', 'XXXXXX',  '397', '3', 'Provisions pour dépréciation des stocks de marchandises');
1126  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 40,'PCG99-ABREGE','TIERS', 'SUPPLIER','400', '4', 'Fournisseurs et Comptes rattachés');
1127  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 41,'PCG99-ABREGE','TIERS', 'XXXXXX',  '409', '4', 'Fournisseurs débiteurs');
1128  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 42,'PCG99-ABREGE','TIERS', 'CUSTOMER','410', '4', 'Clients et Comptes rattachés');
1129  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 43,'PCG99-ABREGE','TIERS', 'XXXXXX',  '419', '4', 'Clients créditeurs');
1130  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 44,'PCG99-ABREGE','TIERS', 'XXXXXX',  '421', '4', 'Personnel');
1131  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 45,'PCG99-ABREGE','TIERS', 'XXXXXX',  '428', '4', 'Personnel');
1132  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 46,'PCG99-ABREGE','TIERS', 'XXXXXX',   '43', '4', 'Sécurité sociale et autres organismes sociaux');
1133  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 47,'PCG99-ABREGE','TIERS', 'XXXXXX',  '444', '4', 'Etat - impôts sur bénéfice');
1134  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 48,'PCG99-ABREGE','TIERS', 'XXXXXX',  '445', '4', 'Etat - Taxes sur chiffre affaire');
1135  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 49,'PCG99-ABREGE','TIERS', 'XXXXXX',  '447', '4', 'Autres impôts, taxes et versements assimilés');
1136  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 50,'PCG99-ABREGE','TIERS', 'XXXXXX',   '45', '4', 'Groupe et associes');
1137  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 51,'PCG99-ABREGE','TIERS', 'XXXXXX',  '455','45', 'Associés');
1138  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 52,'PCG99-ABREGE','TIERS', 'XXXXXX',   '46', '4', 'Débiteurs divers et créditeurs divers');
1139  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 53,'PCG99-ABREGE','TIERS', 'XXXXXX',   '47', '4', 'Comptes transitoires ou d''attente');
1140  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 54,'PCG99-ABREGE','TIERS', 'XXXXXX',  '481', '4', 'Charges à répartir sur plusieurs exercices');
1141  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 55,'PCG99-ABREGE','TIERS', 'XXXXXX',  '486', '4', 'Charges constatées d''avance');
1142  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 56,'PCG99-ABREGE','TIERS', 'XXXXXX',  '487', '4', 'Produits constatés d''avance');
1143  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 57,'PCG99-ABREGE','TIERS', 'XXXXXX',  '491', '4', 'Provisions pour dépréciation des comptes de clients');
1144  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 58,'PCG99-ABREGE','TIERS', 'XXXXXX',  '496', '4', 'Provisions pour dépréciation des comptes de débiteurs divers');
1145  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 59,'PCG99-ABREGE','FINAN', 'XXXXXX',   '50', '5', 'Valeurs mobilières de placement');
1146  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 60,'PCG99-ABREGE','FINAN', 'BANK',     '51', '5', 'Banques, établissements financiers et assimilés');
1147  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 61,'PCG99-ABREGE','FINAN', 'CASH',     '53', '5', 'Caisse');
1148  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 62,'PCG99-ABREGE','FINAN', 'XXXXXX',   '54', '5', 'Régies d''avance et accréditifs');
1149  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 63,'PCG99-ABREGE','FINAN', 'XXXXXX',   '58', '5', 'Virements internes');
1150  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 64,'PCG99-ABREGE','FINAN', 'XXXXXX',  '590', '5', 'Provisions pour dépréciation des valeurs mobilières de placement');
1151  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 65,'PCG99-ABREGE','CHARGE','PRODUCT',  '60', '6', 'Achats');
1152  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 66,'PCG99-ABREGE','CHARGE','XXXXXX',  '603','60', 'Variations des stocks');
1153  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 67,'PCG99-ABREGE','CHARGE','SERVICE',  '61', '6', 'Services extérieurs');
1154  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 68,'PCG99-ABREGE','CHARGE','XXXXXX',   '62', '6', 'Autres services extérieurs');
1155  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 69,'PCG99-ABREGE','CHARGE','XXXXXX',   '63', '6', 'Impôts, taxes et versements assimiles');
1156  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 70,'PCG99-ABREGE','CHARGE','XXXXXX',  '641', '6', 'Rémunérations du personnel');
1157  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 71,'PCG99-ABREGE','CHARGE','XXXXXX',  '644', '6', 'Rémunération du travail de l''exploitant');
1158  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 72,'PCG99-ABREGE','CHARGE','SOCIAL',  '645', '6', 'Charges de sécurité sociale et de prévoyance');
1159  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 73,'PCG99-ABREGE','CHARGE','XXXXXX',  '646', '6', 'Cotisations sociales personnelles de l''exploitant');
1160  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 74,'PCG99-ABREGE','CHARGE','XXXXXX',   '65', '6', 'Autres charges de gestion courante');
1161  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 75,'PCG99-ABREGE','CHARGE','XXXXXX',   '66', '6', 'Charges financières');
1162  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 76,'PCG99-ABREGE','CHARGE','XXXXXX',   '67', '6', 'Charges exceptionnelles');
1163  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 77,'PCG99-ABREGE','CHARGE','XXXXXX',  '681', '6', 'Dotations aux amortissements et aux provisions');
1164  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 78,'PCG99-ABREGE','CHARGE','XXXXXX',  '686', '6', 'Dotations aux amortissements et aux provisions');
1165  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 79,'PCG99-ABREGE','CHARGE','XXXXXX',  '687', '6', 'Dotations aux amortissements et aux provisions');
1166  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 80,'PCG99-ABREGE','CHARGE','XXXXXX',  '691', '6', 'Participation des salariés aux résultats');
1167  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 81,'PCG99-ABREGE','CHARGE','XXXXXX',  '695', '6', 'Impôts sur les bénéfices');
1168  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 82,'PCG99-ABREGE','CHARGE','XXXXXX',  '697', '6', 'Imposition forfaitaire annuelle des sociétés');
1169  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 83,'PCG99-ABREGE','CHARGE','XXXXXX',  '699', '6', 'Produits');
1170  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 84,'PCG99-ABREGE','PROD',  'PRODUCT', '701', '7', 'Ventes de produits finis');
1171  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 85,'PCG99-ABREGE','PROD',  'SERVICE', '706', '7', 'Prestations de services');
1172  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 86,'PCG99-ABREGE','PROD',  'PRODUCT', '707', '7', 'Ventes de marchandises');
1173  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 87,'PCG99-ABREGE','PROD',  'PRODUCT', '708', '7', 'Produits des activités annexes');
1174  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 88,'PCG99-ABREGE','PROD',  'XXXXXX',  '709', '7', 'Rabais, remises et ristournes accordés par l''entreprise');
1175  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 89,'PCG99-ABREGE','PROD',  'XXXXXX',  '713', '7', 'Variation des stocks');
1176  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 90,'PCG99-ABREGE','PROD',  'XXXXXX',   '72', '7', 'Production immobilisée');
1177  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 91,'PCG99-ABREGE','PROD',  'XXXXXX',   '73', '7', 'Produits nets partiels sur opérations à long terme');
1178  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 92,'PCG99-ABREGE','PROD',  'XXXXXX',   '74', '7', 'Subventions d''exploitation');
1179  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 93,'PCG99-ABREGE','PROD',  'XXXXXX',   '75', '7', 'Autres produits de gestion courante');
1180  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 94,'PCG99-ABREGE','PROD',  'XXXXXX',  '753','75', 'Jetons de présence et rémunérations d''administrateurs, gérants,...');
1181  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 95,'PCG99-ABREGE','PROD',  'XXXXXX',  '754','75', 'Ristournes perçues des coopératives');
1182  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 96,'PCG99-ABREGE','PROD',  'XXXXXX',  '755','75', 'Quotes-parts de résultat sur opérations faites en commun');
1183  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 97,'PCG99-ABREGE','PROD',  'XXXXXX',   '76', '7', 'Produits financiers');
1184  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 98,'PCG99-ABREGE','PROD',  'XXXXXX',   '77', '7', 'Produits exceptionnels');
1185  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES ( 99,'PCG99-ABREGE','PROD',  'XXXXXX',  '781', '7', 'Reprises sur amortissements et provisions');
1186  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (100,'PCG99-ABREGE','PROD',  'XXXXXX',  '786', '7', 'Reprises sur provisions pour risques');
1187  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (101,'PCG99-ABREGE','PROD',  'XXXXXX',  '787', '7', 'Reprises sur provisions');
1188  insert into llx_accountingsystem_det (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label) VALUES (102,'PCG99-ABREGE','PROD',  'XXXXXX',   '79', '7', 'Transferts de charges');
1189  
1190  
1191  
1192  drop table if exists llx_c_actioncomm;
1193  
1194  create table llx_c_actioncomm
1195  (
1196    id         integer     PRIMARY KEY,
1197    code       varchar(12)  UNIQUE NOT NULL,
1198    type       varchar(10) default 'system' not null,
1199    libelle    varchar(30) NOT NULL,
1200    active     tinyint default 1  NOT NULL,
1201    todo       tinyint
1202  )type=innodb;
1203  
1204  delete from llx_c_actioncomm;
1205  insert into llx_c_actioncomm (id, code, type, libelle) values ( 1, 'AC_TEL',  'system', 'Appel Téléphonique');
1206  insert into llx_c_actioncomm (id, code, type, libelle) values ( 2, 'AC_FAX',  'system', 'Envoi Fax');
1207  insert into llx_c_actioncomm (id, code, type, libelle) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition');
1208  insert into llx_c_actioncomm (id, code, type, libelle) values ( 4, 'AC_EMAIL','system', 'Envoi Email');
1209  insert into llx_c_actioncomm (id, code, type, libelle) values ( 5, 'AC_RDV',  'system', 'Prendre rendez-vous');
1210  insert into llx_c_actioncomm (id, code, type, libelle) values ( 9, 'AC_FAC',  'system', 'Envoi Facture');
1211  insert into llx_c_actioncomm (id, code, type, libelle) values (10, 'AC_REL',  'system', 'Relance effectuée');
1212  insert into llx_c_actioncomm (id, code, type, libelle) values (11, 'AC_CLO',  'system', 'Clôture');
1213  
1214  alter table llx_actioncomm change percent percent smallint NOT NULL default 0;
1215  ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datea (datea);
1216  ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc);
1217  ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact);
1218  ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_facture (fk_facture);
1219  
1220  
1221  drop table if exists llx_c_ape;
1222  
1223  create table llx_c_ape
1224  (
1225    rowid       integer      AUTO_INCREMENT UNIQUE,
1226    code_ape    varchar(5)   PRIMARY KEY,
1227    libelle     varchar(255),
1228    active      tinyint default 1  NOT NULL
1229  )type=innodb;
1230  
1231  
1232  delete from llx_c_ape;
1233  
1234  
1235  create table llx_c_chargesociales
1236  (
1237    id          integer AUTO_INCREMENT PRIMARY KEY,
1238    libelle     varchar(80),
1239    deductible  smallint NOT NULL default 0,
1240    active      tinyint default 1  NOT NULL
1241  )type=innodb;
1242  
1243  insert into llx_c_chargesociales (id,libelle,deductible) values ( 1, 'Allocations familiales',1);
1244  insert into llx_c_chargesociales (id,libelle,deductible) values ( 2, 'GSG Deductible',1);
1245  insert into llx_c_chargesociales (id,libelle,deductible) values ( 3, 'GSG/CRDS NON Deductible',0);
1246  
1247  drop table c_chargesociales;
1248  
1249  
1250  drop table if exists llx_c_civilite;
1251  
1252  create table llx_c_civilite
1253  (
1254    rowid       integer    PRIMARY KEY,
1255    code        varchar(6) UNIQUE NOT NULL,
1256    civilite      varchar(50),
1257    active      tinyint default 1  NOT NULL
1258  )type=innodb;
1259  
1260  delete from llx_c_civilite;
1261  insert into llx_c_civilite (rowid, code, civilite, active) values (1 , 'MME',  'Madame', 1);
1262  insert into llx_c_civilite (rowid, code, civilite, active) values (3 , 'MR',   'Monsieur', 1);
1263  insert into llx_c_civilite (rowid, code, civilite, active) values (5 , 'MLE',  'Mademoiselle', 1);
1264  insert into llx_c_civilite (rowid, code, civilite, active) values (7 , 'MTRE', 'Maître', 1);
1265  
1266  
1267  drop table if exists llx_c_departements;
1268  
1269  create table llx_c_departements
1270  (
1271    rowid       integer         AUTO_INCREMENT PRIMARY KEY,
1272    code_departement varchar(6) NOT NULL,
1273    fk_region   integer,
1274    cheflieu    varchar(7),
1275    tncc        integer,
1276    ncc         varchar(50),
1277    nom         varchar(50),
1278    active      tinyint default 1  NOT NULL
1279  )type=innodb;
1280  
1281  ALTER TABLE llx_c_departements ADD UNIQUE uk_departements (code_departement,fk_region);
1282  ALTER TABLE llx_c_departements ADD INDEX idx_departements_fk_region (fk_region);
1283  
1284  delete from llx_c_departements;
1285  insert into llx_c_departements (rowid, fk_region, code_departement,cheflieu,tncc,ncc,nom) values (0,0,'0','0',0,'-','-');
1286  
1287  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'01','01053',5,'AIN','Ain');
1288  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'02','02408',5,'AISNE','Aisne');
1289  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'03','03190',5,'ALLIER','Allier');
1290  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence');
1291  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes');
1292  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes');
1293  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'07','07186',5,'ARDECHE','Ardèche');
1294  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'08','08105',4,'ARDENNES','Ardennes');
1295  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'09','09122',5,'ARIEGE','Ariège');
1296  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'10','10387',5,'AUBE','Aube');
1297  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'11','11069',5,'AUDE','Aude');
1298  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'12','12202',5,'AVEYRON','Aveyron');
1299  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône');
1300  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'14','14118',2,'CALVADOS','Calvados');
1301  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'15','15014',2,'CANTAL','Cantal');
1302  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'16','16015',3,'CHARENTE','Charente');
1303  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime');
1304  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher');
1305  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'19','19272',3,'CORREZE','Corrèze');
1306  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud');
1307  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse');
1308  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'21','21231',3,'COTE-D\'OR','Côte-d\'Or');
1309  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D\'ARMOR','Côtes-d\'Armor');
1310  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'23','23096',3,'CREUSE','Creuse');
1311  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'24','24322',3,'DORDOGNE','Dordogne');
1312  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'25','25056',2,'DOUBS','Doubs');
1313  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'26','26362',3,'DROME','Drôme');
1314  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'27','27229',5,'EURE','Eure');
1315  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir');
1316  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère');
1317  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'30','30189',2,'GARD','Gard');
1318  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne');
1319  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'32','32013',2,'GERS','Gers');
1320  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'33','33063',3,'GIRONDE','Gironde');
1321  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'34','34172',5,'HERAULT','Hérault');
1322  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine');
1323  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre');
1324  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire');
1325  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'38','38185',5,'ISERE','Isère');
1326  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'39','39300',2,'JURA','Jura');
1327  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'40','40192',4,'LANDES','Landes');
1328  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher');
1329  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'42','42218',3,'LOIRE','Loire');
1330  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'43','43157',3,'HAUTE-LOIRE','Haute-Loire');
1331  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique');
1332  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret');
1333  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'46','46042',2,'LOT','Lot');
1334  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne');
1335  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'48','48095',3,'LOZERE','Lozère');
1336  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire');
1337  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'50','50502',3,'MANCHE','Manche');
1338  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'51','51108',3,'MARNE','Marne');
1339  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'52','52121',3,'HAUTE-MARNE','Haute-Marne');
1340  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne');
1341  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle');
1342  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'55','55029',3,'MEUSE','Meuse');
1343  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan');
1344  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'57','57463',3,'MOSELLE','Moselle');
1345  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'58','58194',3,'NIEVRE','Nièvre');
1346  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'59','59350',2,'NORD','Nord');
1347  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'60','60057',5,'OISE','Oise');
1348  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'61','61001',5,'ORNE','Orne');
1349  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais');
1350  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme');
1351  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques');
1352  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées');
1353  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales');
1354  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'67','67482',2,'BAS-RHIN','Bas-Rhin');
1355  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'68','68066',2,'HAUT-RHIN','Haut-Rhin');
1356  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'69','69123',2,'RHONE','Rhône');
1357  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'70','70550',3,'HAUTE-SAONE','Haute-Saône');
1358  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire');
1359  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe');
1360  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'73','73065',3,'SAVOIE','Savoie');
1361  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie');
1362  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris');
1363  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'76','76540',3,'SEINE-MARITIME','Seine-Maritime');
1364  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne');
1365  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines');
1366  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres');
1367  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'80','80021',3,'SOMME','Somme');
1368  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'81','81004',2,'TARN','Tarn');
1369  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne');
1370  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var');
1371  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse');
1372  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée');
1373  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'86','86194',3,'VIENNE','Vienne');
1374  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne');
1375  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'88','88160',4,'VOSGES','Vosges');
1376  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'89','89024',5,'YONNE','Yonne');
1377  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort');
1378  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne');
1379  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine');
1380  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis');
1381  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne');
1382  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D\'OISE','Val-d\'Oise');
1383  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 1,'971','97105',3,'GUADELOUPE','Guadeloupe');
1384  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 2,'972','97209',3,'MARTINIQUE','Martinique');
1385  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 3,'973','97302',3,'GUYANE','Guyane');
1386  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 4,'974','97411',3,'REUNION','Réunion');
1387  
1388  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'01','',1,'ANVERS','Anvers');
1389  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (203,'02','',3,'BRUXELLES-CAPITALE','Bruxelles-Capitale');
1390  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'03','',2,'BRABANT-WALLON','Brabant-Wallon');
1391  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'04','',1,'BRABANT-FLAMAND','Brabant-Flamand');
1392  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'05','',1,'FLANDRE-OCCIDENTALE','Flandre-Occidentale');
1393  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'06','',1,'FLANDRE-ORIENTALE','Flandre-Orientale');
1394  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'07','',2,'HAINAUT','Hainaut');
1395  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'08','',2,'LIEGE','Liège');
1396  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'09','',1,'LIMBOURG','Limbourg');
1397  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'10','',2,'LUXEMBOURG','Luxembourg');
1398  insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'11','',2,'NAMUR','Namur');
1399  
1400  
1401  drop table if exists llx_c_effectif;
1402  
1403  create table llx_c_effectif
1404  (
1405    id      integer     PRIMARY KEY,
1406    code    varchar(12)  UNIQUE NOT NULL,
1407    libelle varchar(30),
1408    active  tinyint default 1  NOT NULL
1409  )type=innodb;
1410  
1411  delete from llx_c_effectif;
1412  insert into llx_c_effectif (id,code,libelle) values (0, 'EF0',       '-');
1413  insert into llx_c_effectif (id,code,libelle) values (1, 'EF1-5',     '1 - 5');
1414  insert into llx_c_effectif (id,code,libelle) values (2, 'EF6-10',    '6 - 10');
1415  insert into llx_c_effectif (id,code,libelle) values (3, 'EF11-50',   '11 - 50');
1416  insert into llx_c_effectif (id,code,libelle) values (4, 'EF51-100',  '51 - 100');
1417  insert into llx_c_effectif (id,code,libelle) values (5, 'EF100-500', '100 - 500');
1418  insert into llx_c_effectif (id,code,libelle) values (6, 'EF500-',    '> 500');
1419  
1420  
1421  drop table if exists llx_c_forme_juridique;
1422  
1423  create table llx_c_forme_juridique
1424  (
1425    rowid      integer       AUTO_INCREMENT PRIMARY KEY,
1426    code       varchar(12)   UNIQUE NOT NULL,
1427    fk_pays    integer       NOT NULL,
1428    libelle    varchar(255),
1429    active     tinyint default 1  NOT NULL
1430  
1431  )type=innodb;
1432  
1433  delete from llx_c_forme_juridique;
1434  
1435  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (0, '0','-');
1436  
1437  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'11','Artisan Commerçant');
1438  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'12','Commerçant');
1439  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'13','Artisan');
1440  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'14','Officier public ou ministériel');
1441  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'15','Profession libérale');
1442  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'16','Exploitant agricole');
1443  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'17','Agent commercial');
1444  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'18','Associé Gérant de société');
1445  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'19','(Autre) personne physique');
1446  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'21','Indivision');
1447  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'22','Société créée de fait');
1448  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'23','Société en participation');
1449  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'27','Paroisse hors zone concordataire');
1450  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'29','Autre groupement de droit privé non doté de la personnalité morale');
1451  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'31','Personne morale de droit étranger, immatriculée au RCS');
1452  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'32','Personne morale de droit étranger, non immatriculée au RCS');
1453                                                                       
1454  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'41','Établissement public ou régie à caractère industriel ou commercial');
1455                                                                       
1456  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'51','Société coopérative commerciale particulière');
1457  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'52','Société en nom collectif');
1458  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'53','Société en commandite');
1459  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'54','Société à responsabilité limité (SARL)');
1460  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'55','Société anonyme à conseil d\'administration');
1461  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'56','Société anonyme à directoire');
1462  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'57','Société par actions simplifiée');
1463  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'58','Entreprise Unipersonnelle à Responsabilité Limitée (EURL)');
1464                                                                       
1465  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'61','Caisse d\'épargne et de prévoyance');
1466  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'62','Groupement d\'intérêt économique');
1467  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'63','Société coopérative agricole');
1468  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'64','Société non commerciale d\'assurances');
1469  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'65','Société civile');
1470  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'69','Autres personnes de droit privé inscrites au registre du commerce et des sociétés');
1471                                                                       
1472  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'71','Administration de l\'état');
1473  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'72','Collectivité territoriale');
1474  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'73','Établissement public administratif');
1475  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'74','Autre personne morale de droit public administratif');
1476                                                                       
1477  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'81','Organisme gérant un régime de protection social à adhésion obligatoire');
1478  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'82','Organisme mutualiste');
1479  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'83','Comité d\'entreprise');
1480  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'84','Organisme professionnel');
1481  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'85','Organisme de retraite à adhésion non obligatoire');
1482                                                                       
1483  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'91','Syndicat de propriétaires');
1484  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'92','Association loi 1901 ou assimilé');
1485  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'93','Fondation');
1486  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'99','Autre personne morale de droit privé');
1487  
1488  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '200', 'Indépendant');
1489  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '201', 'SPRL - Société à responsabilité limitée');
1490  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '202', 'SA   - Société Anonyme');
1491  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '203', 'SCRL - Société coopérative à responsabilité limitée');
1492  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '204', 'ASBL - Association sans but Lucratif');
1493  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '205', 'SCRI - Société coopérative à responsabilité illimitée');
1494  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '206', 'SCS  - Société en commandite simple');
1495  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '207', 'SCA  - Société en commandite par action');
1496  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '208', 'SNC  - Société en nom collectif');
1497  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '209', 'GIE  - Groupement d\'intérêt économique');
1498  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '210', 'GEIE - Groupement européen d\'intérêt économique');
1499  
1500  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '600', 'Raison Individuelle');
1501  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '601', 'Société Simple');
1502  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '602', 'Société en nom collectif');
1503  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '603', 'Société en commandite');
1504  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '604', 'Société anonyme (SA)');
1505  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '605', 'Société en commandite par actions');
1506  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '606', 'Société à responsabilité limitées (SARL)');
1507  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '607', 'Société coopérative');
1508  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '608', 'Association');
1509  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (6, '609', 'Fondation');
1510  
1511  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '700', 'Sole Trader');
1512  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '701', 'Partnership');
1513  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '702', 'Private Limited Company by shares - (LTD)');
1514  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '703', 'Public Limited Company');
1515  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '704', 'Workers Cooperative');
1516  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '705', 'Limited Liability Partnership');
1517  insert into llx_c_forme_juridique (fk_pays, code, libelle) values (7, '706', 'Franchise');
1518  
1519  drop table if exists llx_c_paiement;
1520  
1521  create table llx_c_paiement
1522  (
1523    id         integer     PRIMARY KEY,
1524    code       varchar(6)  UNIQUE NOT NULL,
1525    libelle    varchar(30),
1526    type       smallint,    
1527    active     tinyint default 1  NOT NULL
1528  )type=innodb;
1529  
1530  delete from llx_c_paiement;
1531  insert into llx_c_paiement (id,code,libelle,type,active) values (0, '',    '-',                 3,1);
1532  insert into llx_c_paiement (id,code,libelle,type,active) values (1, 'TIP', 'TIP',               2,1);
1533  insert into llx_c_paiement (id,code,libelle,type,active) values (2, 'VIR', 'Virement',          2,1);
1534  insert into llx_c_paiement (id,code,libelle,type,active) values (3, 'PRE', 'Prélèvement',       2,1);
1535  insert into llx_c_paiement (id,code,libelle,type,active) values (4, 'LIQ', 'Espèces',           2,1);
1536  insert into llx_c_paiement (id,code,libelle,type,active) values (5, 'VAD', 'Paiement en ligne', 2,0);
1537  insert into llx_c_paiement (id,code,libelle,type,active) values (6, 'CB',  'Carte Bancaire',    2,1);
1538  insert into llx_c_paiement (id,code,libelle,type,active) values (7, 'CHQ', 'Chèque',            2,1);
1539  insert into llx_c_paiement (id,code,libelle,type,active) values (8, 'TRA', 'Traite',            2,1);
1540  insert into llx_c_paiement (id,code,libelle,type,active) values (9, 'LCR', 'LCR',               2,1);
1541  insert into llx_c_paiement (id,code,libelle,type,active) values (10,'FAC', 'Factor',            2,1);
1542  
1543  drop table if exists llx_c_pays;
1544  
1545  create table llx_c_pays
1546  (
1547    rowid    integer            PRIMARY KEY,
1548    code     varchar(2)         NOT NULL,
1549    libelle  varchar(25)        NOT NULL,
1550    active   tinyint DEFAULT 1  NOT NULL
1551  )type=innodb;
1552  
1553  alter table llx_c_pays modify code varchar(2) NOT NULL;
1554  alter table llx_c_pays add code_iso varchar(3) after code;
1555  
1556  ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_code (code);
1557  ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_code_iso (code_iso);
1558  ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_libelle (libelle);
1559  
1560  delete from llx_c_pays;
1561  insert into llx_c_pays (rowid,code,libelle) values (0,  ''  , '-'              );
1562  insert into llx_c_pays (rowid,code,libelle) values (1,  'FR', 'France'         );
1563  insert into llx_c_pays (rowid,code,libelle) values (2,  'BE', 'Belgique'       );
1564  insert into llx_c_pays (rowid,code,libelle) values (3,  'IT', 'Italie'         );
1565  insert into llx_c_pays (rowid,code,libelle) values (4,  'ES', 'Espagne'        );
1566  insert into llx_c_pays (rowid,code,libelle) values (5,  'DE', 'Allemagne'      );
1567  insert into llx_c_pays (rowid,code,libelle) values (6,  'CH', 'Suisse'         );
1568  insert into llx_c_pays (rowid,code,libelle) values (7,  'GB', 'Royaume uni'    );
1569  insert into llx_c_pays (rowid,code,libelle) values (8,  'IE', 'Irlande'        );
1570  insert into llx_c_pays (rowid,code,libelle) values (9,  'CN', 'Chine'          );
1571  insert into llx_c_pays (rowid,code,libelle) values (10, 'TN', 'Tunisie'        );
1572  insert into llx_c_pays (rowid,code,libelle) values (11, 'US', 'Etats Unis'     );
1573  insert into llx_c_pays (rowid,code,libelle) values (12, 'MA', 'Maroc'          );
1574  insert into llx_c_pays (rowid,code,libelle) values (13, 'DZ', 'Algérie'        );
1575  insert into llx_c_pays (rowid,code,libelle) values (14, 'CA', 'Canada'         );
1576  insert into llx_c_pays (rowid,code,libelle) values (15, 'TG', 'Togo'           );
1577  insert into llx_c_pays (rowid,code,libelle) values (16, 'GA', 'Gabon'          );
1578  insert into llx_c_pays (rowid,code,libelle) values (17, 'NL', 'Pays Bas'       );
1579  insert into llx_c_pays (rowid,code,libelle) values (18, 'HU', 'Hongrie'        );
1580  insert into llx_c_pays (rowid,code,libelle) values (19, 'RU', 'Russie'         );
1581  insert into llx_c_pays (rowid,code,libelle) values (20, 'SE', 'Suède'          );
1582  insert into llx_c_pays (rowid,code,libelle) values (21, 'CI', 'Côte d\'Ivoire' );
1583  insert into llx_c_pays (rowid,code,libelle) values (23, 'SN', 'Sénégal'        );
1584  insert into llx_c_pays (rowid,code,libelle) values (24, 'AR', 'Argentine'      );
1585  insert into llx_c_pays (rowid,code,libelle) values (25, 'CM', 'Cameroun'       );
1586  insert into llx_c_pays (rowid,code,libelle) values (26, 'PT', 'Portugal'       );
1587  insert into llx_c_pays (rowid,code,libelle) values (27, 'SA', 'Arabie Saoudite');
1588  insert into llx_c_pays (rowid,code,libelle) values (28, 'MC', 'Monaco'         );
1589  
1590  drop table if exists llx_c_propalst;
1591  
1592  create table llx_c_propalst
1593  (
1594    id              smallint    PRIMARY KEY,
1595    code            varchar(12)  UNIQUE NOT NULL,
1596    label           varchar(30),
1597    active          tinyint default 1  NOT NULL
1598  )type=innodb;
1599  
1600  delete from llx_c_propalst;
1601  insert into llx_c_propalst (id,code,label) values (0, 'PR_DRAFT',     'Brouillon');
1602  insert into llx_c_propalst (id,code,label) values (1, 'PR_OPEN',      'Ouverte');
1603  insert into llx_c_propalst (id,code,label) values (2, 'PR_SIGNED',    'Signée');
1604  insert into llx_c_propalst (id,code,label) values (3, 'PR_NOTSIGNED', 'Non Signée');
1605  insert into llx_c_propalst (id,code,label) values (4, 'PR_FAC',       'Facturée');
1606  
1607  drop table if exists llx_c_stcomm;
1608  
1609  create table llx_c_stcomm
1610  (
1611    id       integer     PRIMARY KEY,
1612    code     varchar(12)  UNIQUE NOT NULL,
1613    libelle  varchar(30),
1614    active   tinyint default 1  NOT NULL
1615  )type=innodb;
1616  
1617  delete from llx_c_stcomm;
1618  insert into llx_c_stcomm (id,code,libelle) values (-1, 'ST_NO',    'Ne pas contacter');
1619  insert into llx_c_stcomm (id,code,libelle) values ( 0, 'ST_NEVER', 'Jamais contacté');
1620  insert into llx_c_stcomm (id,code,libelle) values ( 1, 'ST_TODO',  'A contacter');
1621  insert into llx_c_stcomm (id,code,libelle) values ( 2, 'ST_PEND',  'Contact en cours');
1622  insert into llx_c_stcomm (id,code,libelle) values ( 3, 'ST_DONE',  'Contactée');
1623  
1624  drop table if exists llx_c_typent;
1625  
1626  create table llx_c_typent
1627  (
1628    id        integer     PRIMARY KEY,
1629    code      varchar(12)  UNIQUE NOT NULL,
1630    libelle   varchar(30),
1631    active    tinyint default 1  NOT NULL
1632  )type=innodb;
1633  
1634  delete from llx_c_typent;
1635  insert into llx_c_typent (id,code,libelle) values (  0, 'TE_UNKNOWN', '-');
1636  insert into llx_c_typent (id,code,libelle) values (  1, 'TE_STARTUP', 'Start-up');
1637  insert into llx_c_typent (id,code,libelle) values (  2, 'TE_GROUP',   'Grand groupe');
1638  insert into llx_c_typent (id,code,libelle) values (  3, 'TE_MEDIUM',  'PME/PMI');
1639  insert into llx_c_typent (id,code,libelle) values (  4, 'TE_SMALL',   'TPE');
1640  insert into llx_c_typent (id,code,libelle) values (  5, 'TE_ADMIN',   'Administration');
1641  insert into llx_c_typent (id,code,libelle) values (  6, 'TE_WHOLE',   'Grossiste');
1642  insert into llx_c_typent (id,code,libelle) values (  7, 'TE_RETAIL',  'Revendeur');
1643  insert into llx_c_typent (id,code,libelle) values (  8, 'TE_PRIVATE', 'Particulier');
1644  insert into llx_c_typent (id,code,libelle) values (100, 'TE_OTHER',   'Autres');
1645  
1646  drop table if exists llx_c_regions;
1647  
1648  create table llx_c_regions
1649  (
1650    rowid       integer AUTO_INCREMENT PRIMARY KEY,
1651    code_region integer UNIQUE NOT NULL,
1652    fk_pays     integer NOT NULL,
1653    cheflieu    varchar(7),
1654    tncc        integer,
1655    nom         varchar(50),
1656    active      tinyint default 1 NOT NULL
1657  )type=innodb;
1658  
1659  delete from llx_c_regions;
1660  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (0,0,0,'0',0,'-');
1661  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (101,1,  1,'97105',3,'Guadeloupe');
1662  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (102,1,  2,'97209',3,'Martinique');
1663  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (103,1,  3,'97302',3,'Guyane');
1664  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (104,1,  4,'97411',3,'Réunion');
1665  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (105,1, 11,'75056',1,'Île-de-France');
1666  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (106,1, 21,'51108',0,'Champagne-Ardenne');
1667  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (107,1, 22,'80021',0,'Picardie');
1668  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (108,1, 23,'76540',0,'Haute-Normandie');
1669  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (109,1, 24,'45234',2,'Centre');
1670  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (110,1, 25,'14118',0,'Basse-Normandie');
1671  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (111,1, 26,'21231',0,'Bourgogne');
1672  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (112,1, 31,'59350',2,'Nord-Pas-de-Calais');
1673  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (113,1, 41,'57463',0,'Lorraine');
1674  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (114,1, 42,'67482',1,'Alsace');
1675  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (115,1, 43,'25056',0,'Franche-Comté');
1676  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (116,1, 52,'44109',4,'Pays de la Loire');
1677  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (117,1, 53,'35238',0,'Bretagne');
1678  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (118,1, 54,'86194',2,'Poitou-Charentes');
1679  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (119,1, 72,'33063',1,'Aquitaine');
1680  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (120,1, 73,'31555',0,'Midi-Pyrénées');
1681  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (121,1, 74,'87085',2,'Limousin');
1682  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (122,1, 82,'69123',2,'Rhône-Alpes');
1683  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (123,1, 83,'63113',1,'Auvergne');
1684  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (124,1, 91,'34172',2,'Languedoc-Roussillon');
1685  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (125,1, 93,'13055',0,'Provence-Alpes-Côte d\'Azur');
1686  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (126,1, 94,'2A004',0,'Corse');
1687  
1688  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (201,2,201,'',1,'Flandre');
1689  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (202,2,202,'',2,'Wallonie');
1690  insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (203,2,203,'',3,'Bruxelles-Capitale');
1691  
1692  
1693  create table llx_c_currencies
1694  (
1695    code        varchar(2)   UNIQUE PRIMARY KEY,
1696    code_iso    varchar(3)   UNIQUE NOT NULL,
1697    label       varchar(64),
1698    active      tinyint DEFAULT 1  NOT NULL
1699  )type=innodb;
1700  
1701  ALTER TABLE llx_c_currencies DROP INDEX code_iso;
1702  ALTER TABLE llx_c_currencies ADD UNIQUE uk_c_currencies_code_iso(code_iso);
1703  
1704  
1705  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'BT', 'THB', 1, 'Bath thailandais'); 
1706  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CD', 'DKK', 1, 'Couronnes dannoises'); 
1707  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CN', 'NOK', 1, 'Couronnes norvegiennes'); 
1708  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CS', 'SEK', 1, 'Couronnes suedoises'); 
1709  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CZ', 'CZK', 1, 'Couronnes tcheques'); 
1710  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DA', 'AUD', 1, 'Dollars australiens'); 
1711  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DC', 'CAD', 1, 'Dollars canadiens'); 
1712  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DH', 'HKD', 1, 'Dollars hong kong'); 
1713  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DS', 'SGD', 1, 'Dollars singapour'); 
1714  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DU', 'USD', 1, 'Dollars us'); 
1715  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'EC', 'XEU', 1, 'Ecus'); 
1716  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'ES', 'PTE', 1, 'Escudos'); 
1717  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FB', 'BEF', 1, 'Francs belges'); 
1718  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FF', 'FRF', 1, 'Francs francais'); 
1719  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FL', 'LUF', 1, 'Francs luxembourgeois'); 
1720  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FO', 'NLG', 1, 'Florins'); 
1721  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FS', 'CHF', 1, 'Francs suisses'); 
1722  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LI', 'IEP', 1, 'Livres irlandaises'); 
1723  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LR', 'ITL', 1, 'Lires'); 
1724  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LS', 'GBP', 1, 'Livres sterling'); 
1725  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MA', 'DEM', 1, 'Deutsch mark'); 
1726  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MF', 'FIM', 1, 'Mark finlandais'); 
1727  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PA', 'ARP', 1, 'Pesos argentins'); 
1728  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PC', 'CLP', 1, 'Pesos chilien'); 
1729  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PE', 'ESP', 1, 'Pesete'); 
1730  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PL', 'PLN', 1, 'Zlotys polonais'); 
1731  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'SA', 'ATS', 1, 'Shiliing autrichiens'); 
1732  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'TW', 'TWD', 1, 'Dollar taiwanais'); 
1733  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'YE', 'JPY', 1, 'Yens'); 
1734  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'ZA', 'ZAR', 1, 'Rand africa'); 
1735  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DR', 'GRD', 1, 'Drachme (grece)'); 
1736  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'EU', 'EUR', 1, 'Euros'); 
1737  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'RB', 'BRL', 1, 'Real bresilien'); 
1738  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'SK', 'SKK', 1, 'Couronnes slovaques'); 
1739  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'YC', 'CNY', 1, 'Yuang chinois');
1740  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'AE', 'AED', 1, 'Arabes emirats dirham');
1741  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CF', 'XAF', 1, 'Francs cfa beac');
1742  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'EG', 'EGP', 1, 'Livre egyptienne');
1743  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'KR', 'KRW', 1, 'Won coree du sud');
1744  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'NZ', 'NZD', 1, 'Dollar neo-zelandais');
1745  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'TR', 'TRL', 1, 'Livre turque');
1746  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'ID', 'IDR', 1, 'Rupiahs d''indonesie');
1747  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'IN', 'INR', 1, 'Roupie indienne'); 
1748  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LT', 'LTL', 1, 'Litas');
1749  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'RU', 'SUR', 1, 'Rouble');
1750  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FH', 'HUF', 1, 'Forint hongrois');
1751  insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LK', 'LKR', 1, 'Roupie sri lanka'); 
1752  
1753  create table llx_contratdet
1754  (
1755    rowid                 integer AUTO_INCREMENT PRIMARY KEY,
1756    tms                   timestamp,
1757  
1758    fk_contrat            integer NOT NULL,
1759    fk_product            integer NOT NULL,
1760  
1761    statut                smallint DEFAULT 0,
1762  
1763    label                 text, -- libellé du produit
1764    description           text,
1765  
1766    date_commande         datetime,
1767    date_ouverture_prevue datetime,
1768    date_ouverture        datetime, -- date d'ouverture du service chez le client
1769    date_fin_validite     datetime,
1770    date_cloture          datetime,
1771  
1772    tva_tx                real DEFAULT 19.6, -- taux tva
1773    qty                   real,              -- quantité
1774    remise_percent        real DEFAULT 0,    -- pourcentage de remise
1775    remise                real DEFAULT 0,    -- montant de la remise
1776    subprice              real,              -- prix avant remise
1777    price_ht              real,              -- prix final
1778  
1779    fk_user_author        integer NOT NULL default 0,
1780    fk_user_ouverture     integer,
1781    fk_user_cloture       integer,
1782    commentaire           text
1783  
1784  )type=innodb;
1785  
1786  create table llx_dolibarr_modules
1787  (
1788    numero         integer     PRIMARY KEY,
1789    active         tinyint     DEFAULT 0 NOT NULL,
1790    active_date    datetime    NOT NULL,
1791    active_version varchar(25) NOT NULL
1792  
1793  )type=innodb;
1794  
1795  
1796  insert into llx_const (name, value, type, visible, note) VALUES ('MAIN_FORCE_SETLOCALE_LC_ALL',      'MAIN_FORCE_SETLOCALE_LC_ALL', 'chaine', 1, 'Pour forcer LC_ALL si pb de locale');
1797  insert into llx_const (name, value, type, visible, note) VALUES ('MAIN_FORCE_SETLOCALE_LC_TIME',     'MAIN_FORCE_SETLOCALE_LC_TIME', 'chaine', 1, 'Pour forcer LC_TIME si pb de locale');
1798  insert into llx_const (name, value, type, visible, note) VALUES ('MAIN_FORCE_SETLOCALE_LC_MONETARY', 'MAIN_FORCE_SETLOCALE_LC_MONETARY', 'chaine', 1, 'Pour forcer LC_MONETARY si pb de locale');
1799  insert into llx_const (name, value, type, visible, note) VALUES ('MAIN_FORCE_SETLOCALE_LC_NUMERIC',  'MAIN_FORCE_SETLOCALE_LC_NUMERIC', 'chaine', 1, 'Mettre la valeur C si problème de centimes');
1800  
1801  
1802  update llx_const set name='OSC_DB_NAME' where name='DB_NAME_OSC';
1803  update llx_const set name='MAIN_EMAIL_FROM' where name='MAIN_MAIL_FROM';
1804  
1805  alter table llx_bookmark add url         varchar(128);
1806  alter table llx_bookmark add target      varchar(16);
1807  alter table llx_bookmark add title       varchar(64);
1808  alter table llx_bookmark add favicon     varchar(24);
1809  
1810  
1811  
1812  create table llx_energie_compteur
1813  (
1814    rowid           integer AUTO_INCREMENT PRIMARY KEY,
1815    libelle         varchar(50),
1816    fk_energie      integer NOT NULL,
1817    datec           datetime,
1818    fk_user_author  integer NOT NULL,
1819  
1820    note            text
1821  )type=innodb;
1822  
1823  create table llx_energie_compteur_groupe
1824  (
1825    fk_energie_compteur integer NOT NULL,
1826    fk_energie_groupe   integer NOT NULL
1827  )type=innodb;
1828  
1829  create table llx_energie_compteur_releve
1830  (
1831    rowid           integer AUTO_INCREMENT PRIMARY KEY,
1832    fk_compteur     integer NOT NULL,
1833    date_releve     datetime,
1834    valeur          real,
1835    datec           datetime,
1836    fk_user_author  integer NOT NULL,
1837  
1838    note            text
1839  )type=innodb;
1840  
1841  
1842  create table llx_energie_groupe
1843  (
1844    rowid           integer AUTO_INCREMENT PRIMARY KEY,
1845    libelle         varchar(100),
1846    datec           datetime,
1847    fk_user_author  integer NOT NULL,
1848  
1849    note            text
1850  )type=innodb;
1851  
1852  create table llx_projet_task
1853  (
1854    rowid              integer AUTO_INCREMENT PRIMARY KEY,
1855    fk_projet          integer NOT NULL,
1856    fk_task_parent     integer NOT NULL,
1857    title              varchar(255),
1858    duration_effective real NOT NULL,
1859    fk_user_creat      integer,      -- createur
1860    statut             enum('open','closed') DEFAULT 'open',
1861    note               text,
1862  
1863    key(fk_projet),
1864    key(statut),
1865    key(fk_user_creat)
1866    
1867  )type=innodb;
1868  
1869  create table llx_projet_task_time
1870  (
1871    rowid            integer AUTO_INCREMENT PRIMARY KEY,
1872    fk_task          integer  NOT NULL,
1873    task_date        date,
1874    task_duration    real UNSIGNED,
1875    fk_user          integer,
1876    note             text,
1877  
1878    key(fk_task),
1879    key(fk_user)
1880  
1881  )type=innodb;
1882  
1883  create table llx_projet_task_actors
1884  (
1885    fk_projet_task integer NOT NULL,
1886    fk_user        integer NOT NULL,
1887    role           enum ('admin','read','acto','info') DEFAULT 'admin',
1888  
1889    UNIQUE (fk_projet_task, fk_user),
1890    key (role)
1891  
1892  )type=innodb;
1893  
1894  
1895  create table llx_societe_perms
1896  (
1897    fk_soc    integer,
1898    fk_user   integer,
1899    pread     tinyint unsigned DEFAULT 0, 
1900    pwrite    tinyint unsigned DEFAULT 0,
1901    pperms    tinyint unsigned DEFAULT 0, 
1902  
1903    UNIQUE INDEX(fk_soc, fk_user)
1904  )type=innodb;
1905  
1906  
1907  drop table if exists llx_contact_facture;
1908  
1909  
1910  create table llx_c_type_contact
1911  (
1912    rowid          integer     PRIMARY KEY,
1913    element       varchar(30) NOT NULL,
1914    source        varchar(8)  DEFAULT 'external' NOT NULL,
1915    code          varchar(16) NOT NULL,
1916    libelle         varchar(64)    NOT NULL,
1917    active          tinyint DEFAULT 1  NOT NULL
1918  )type=innodb;
1919  
1920  
1921  ALTER TABLE llx_c_type_contact 
1922      ADD UNIQUE INDEX idx_c_type_contact_uk (element, source, code);
1923  
1924  
1925  create table llx_element_contact
1926  (
1927    rowid             integer AUTO_INCREMENT PRIMARY KEY,  
1928    datecreate        datetime NULL,             -- date de creation de l'enregistrement
1929    statut            smallint DEFAULT 5,     -- 5 inactif, 4 actif
1930    element_id        int NOT NULL,             -- la reference de l'element.
1931    fk_c_type_contact    int NOT NULL,            -- nature du contact.
1932    fk_socpeople      integer NOT NULL
1933  )type=innodb;
1934  
1935  
1936  ALTER TABLE llx_element_contact 
1937      ADD UNIQUE INDEX idx_element_contact_idx1 (element_id, fk_c_type_contact, fk_socpeople);
1938      
1939  ALTER TABLE llx_element_contact 
1940      ADD CONSTRAINT idx_element_contact_fk_c_type_contact        
1941      FOREIGN KEY (fk_c_type_contact)     REFERENCES llx_c_type_contact(rowid);
1942      
1943      
1944  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (10, 'contrat', 'internal', 'SALESREPSIGN',  'Commercial signataire du contrat', 1);
1945  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (11, 'contrat', 'internal', 'SALESREPFOLL',  'Commercial suivi du contrat', 1);
1946  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (20, 'contrat', 'external', 'BILLING',       'Contact client facturation contrat', 1);
1947  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (21, 'contrat', 'external', 'CUSTOMER',      'Contact client suivi contrat', 1);
1948  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (22, 'contrat', 'external', 'SALESREPSIGN',  'Contact client signataire contrat', 1);
1949                                                                                                      
1950  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (30, 'propal',  'internal', 'SALESREPSIGN',  'Commercial signataire de la propale', 1);
1951  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (31, 'propal',  'internal', 'SALESREPFOLL',  'Commercial suivi de la propale', 1);
1952  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (40, 'propal',  'external', 'BILLING',       'Contact client facturation propale', 1);
1953  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (41, 'propal',  'external', 'CUSTOMER',      'Contact client suivi propale', 1);
1954                                                                                                      
1955  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (80, 'projet',  'internal', 'PROJECTLEADER', 'Chef de Projet', 1);
1956  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (81, 'projet',  'external', 'PROJECTLEADER', 'Chef de Projet', 1);
1957  
1958  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (50, 'facture', 'internal', 'SALESREPFOLL',  'Commercial suivi du paiement', 1);
1959  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (60, 'facture', 'external', 'BILLING',       'Contact client facturation', 1);
1960  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (61, 'facture', 'external', 'SHIPPING',      'Contact client livraison', 1);
1961  insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (62, 'facture', 'external', 'SERVICE',       'Contact client prestation', 1);
1962  
1963  
1964  alter table llx_commande add ref_client varchar(30) after ref;
1965  alter table llx_facture add ref_client varchar(30) after facnumber;
1966  alter table llx_facture add date_valid date after datef;
1967  alter table llx_facture add model varchar(50) after note;
1968  
1969  alter table llx_facturedet modify fk_product      integer NULL;
1970  alter table llx_contratdet modify fk_product      integer NULL;
1971  update llx_facturedet set fk_product = null where fk_product=0;
1972  
1973  CREATE TABLE IF NOT EXISTS `llx_paiementfourn_facturefourn`
1974  (
1975    `rowid` int(11) NOT NULL auto_increment,
1976    `fk_paiementfourn` int(11) default NULL,
1977    `fk_facturefourn` int(11) default NULL,
1978    `amount` double default '0',
1979    PRIMARY KEY  (`rowid`),
1980    KEY `idx_fk_facture` (`fk_facturefourn`),
1981    KEY `idx_fk_paiement` (`fk_paiementfourn`)
1982  ) TYPE=innodb;
1983  
1984  ALTER TABLE `llx_paiementfourn` ADD `statut` SMALLINT( 6 ) NOT NULL ;


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics