diff --git a/pgsql/tables/llx_bank_account.sql b/pgsql/tables/llx_bank_account.sql index 449f69d2b4c..7615ff25717 100644 --- a/pgsql/tables/llx_bank_account.sql +++ b/pgsql/tables/llx_bank_account.sql @@ -49,5 +49,6 @@ create table llx_bank_account "courant" smallint DEFAULT 0 NOT NULL, "clos" smallint DEFAULT 0 NOT NULL, "rappro" smallint DEFAULT 1, + "url" varchar(128), "account_number" varchar(8) ); diff --git a/pgsql/tables/llx_c_pays.sql b/pgsql/tables/llx_c_pays.sql index 5cbb195ee6d..77e90a3169d 100644 --- a/pgsql/tables/llx_c_pays.sql +++ b/pgsql/tables/llx_c_pays.sql @@ -30,6 +30,6 @@ create table llx_c_pays rowid integer PRIMARY KEY, "code" varchar(2) NOT NULL, "code_iso" varchar(3) , - "libelle" varchar(25) NOT NULL, + "libelle" varchar(50) NOT NULL, "active" smallint DEFAULT 1 NOT NULL ); diff --git a/pgsql/tables/llx_commande.sql b/pgsql/tables/llx_commande.sql index 45c70f0c5c3..bf62edc0624 100644 --- a/pgsql/tables/llx_commande.sql +++ b/pgsql/tables/llx_commande.sql @@ -26,6 +26,7 @@ + create table llx_commande ( rowid SERIAL PRIMARY KEY, diff --git a/pgsql/tables/llx_commandedet.sql b/pgsql/tables/llx_commandedet.sql index c5644ef6c64..a28e2326146 100644 --- a/pgsql/tables/llx_commandedet.sql +++ b/pgsql/tables/llx_commandedet.sql @@ -30,11 +30,17 @@ create table llx_commandedet "fk_product" integer, "label" varchar(255), "description" text, - "tva_tx" real DEFAULT 19.6, -- taux tva + "tva_tx" real, -- taux tva "qty" real, -- quantité "remise_percent" real DEFAULT 0, -- pourcentage de remise "remise" real DEFAULT 0, -- montant de la remise + "fk_remise_except" integer NULL, -- Lien vers table des remises fixes "subprice" real, -- prix avant remise "price" real, -- prix final - "coef" real -- coefficient de marge + "total_ht" real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale + "total_tva" real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale + "total_ttc" real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale + "info_bits" integer DEFAULT 0, -- TVA NPR ou non + "coef" real, -- coefficient de marge + "rang" integer DEFAULT 0 ); diff --git a/pgsql/tables/llx_contrat.key.sql b/pgsql/tables/llx_contrat.key.sql index bcdac311a15..6be1985a301 100644 --- a/pgsql/tables/llx_contrat.key.sql +++ b/pgsql/tables/llx_contrat.key.sql @@ -35,4 +35,4 @@ ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_soc (fk_soc); ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_user_author (fk_user_author); ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); -ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); \ No newline at end of file +ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/pgsql/tables/llx_contratdet.sql b/pgsql/tables/llx_contratdet.sql index 1f0e0979e13..5043b70ecad 100644 --- a/pgsql/tables/llx_contratdet.sql +++ b/pgsql/tables/llx_contratdet.sql @@ -49,8 +49,13 @@ create table llx_contratdet "qty" real, -- quantité "remise_percent" real DEFAULT 0, -- pourcentage de remise "remise" real DEFAULT 0, -- montant de la remise + "fk_remise_except" integer NULL, -- Lien vers table des remises fixes "subprice" real, -- prix avant remise "price_ht" real, -- prix final + "total_ht" real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale + "total_tva" real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale + "total_ttc" real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale + "info_bits" integer DEFAULT 0, -- TVA NPR ou non "fk_user_author" integer NOT NULL default 0, "fk_user_ouverture" integer, "fk_user_cloture" integer, diff --git a/pgsql/tables/llx_document_model.sql b/pgsql/tables/llx_document_model.sql index 785aea2b064..25eba821c47 100644 --- a/pgsql/tables/llx_document_model.sql +++ b/pgsql/tables/llx_document_model.sql @@ -29,8 +29,9 @@ create table llx_document_model ( - nom varchar(50) PRIMARY KEY, - "type" varchar(12) NOT NULL, + rowid SERIAL PRIMARY KEY, + "nom" varchar(50), + "type" varchar(12) NOT NULL, "libelle" varchar(255), "description" text ); \ No newline at end of file diff --git a/pgsql/tables/llx_facture.sql b/pgsql/tables/llx_facture.sql index 2f98926f037..1c46d95cb7f 100644 --- a/pgsql/tables/llx_facture.sql +++ b/pgsql/tables/llx_facture.sql @@ -56,5 +56,5 @@ create table llx_facture "date_lim_reglement" date, -- date limite de reglement "note" text, "note_public" text, - "model" varchar(50) + "model_pdf" varchar(50) ); diff --git a/pgsql/tables/llx_facturedet.sql b/pgsql/tables/llx_facturedet.sql index 4ab58ecb383..03637b4dcc3 100644 --- a/pgsql/tables/llx_facturedet.sql +++ b/pgsql/tables/llx_facturedet.sql @@ -28,17 +28,21 @@ create table llx_facturedet ( rowid SERIAL PRIMARY KEY, "fk_facture" integer NOT NULL, - "fk_product" integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits + "fk_product" integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits "description" text, - "tva_taux" real DEFAULT 19.6, -- taux tva - "qty" real, -- quantité - "remise_percent" real DEFAULT 0, -- pourcentage de remise - "remise" real DEFAULT 0, -- montant de la remise - "subprice" real, -- prix avant remise - "price" real, -- prix final - "date_start" timestamp, -- date debut si service - "date_end" timestamp, -- date fin si service - "info_bits" integer DEFAULT 0, + "tva_taux" real, -- Taux tva produit/service (exemple 19.6) + "qty" real, -- Quantité (exemple 2) + "remise_percent" real DEFAULT 0, -- % de la remise ligne (exemple 20%) + "remise" real DEFAULT 0, -- Montant calculé de la remise % sur PU HT (exemple 20) + "fk_remise_except" integer NULL, -- Lien vers table des remises fixes + "subprice" real, -- P.U. HT (exemple 100) + "price" real, -- P.U. HT apres remise % de ligne + "total_ht" real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale + "total_tva" real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale + "total_ttc" real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale + "date_start" timestamp, -- date debut si service + "date_end" timestamp, -- date fin si service + "info_bits" integer DEFAULT 0, -- TVA NPR ou non "fk_code_ventilation" integer DEFAULT 0 NOT NULL, "fk_export_compta" integer DEFAULT 0 NOT NULL, "rang" integer DEFAULT 0 diff --git a/pgsql/tables/llx_livraison.key.sql b/pgsql/tables/llx_livraison.key.sql deleted file mode 100644 index 26db89b9e20..00000000000 --- a/pgsql/tables/llx_livraison.key.sql +++ /dev/null @@ -1,32 +0,0 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- ============================================================================ --- Copyright (C) 2006 Laurent Destailleur --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id: llx_livraison.key.sql,v 1.1 2006/05/05 15:28:06 hregis Exp $ --- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_livraison.key.sql,v $ --- --- ============================================================================ - - --- Supprimme orphelins pour permettre montée de la clé --- V4 DELETE llx_livraison FROM llx_livraison LEFT JOIN llx_societe ON llx_livraison.fk_soc = llx_societe.idp WHERE llx_societe.idp IS NULL; - -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_soc (fk_soc); -ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/pgsql/tables/llx_livraison.sql b/pgsql/tables/llx_livraison.sql index 84c992117ef..1a35190bd43 100644 --- a/pgsql/tables/llx_livraison.sql +++ b/pgsql/tables/llx_livraison.sql @@ -29,7 +29,6 @@ create table llx_livraison ( rowid SERIAL PRIMARY KEY, "tms" timestamp, - "fk_soc" integer NOT NULL, "fk_commande" integer DEFAULT 0, -- commande auquel est rattache le bon de livraison "fk_expedition" integer, -- expedition auquel est rattache le bon de livraison "ref" varchar(30) NOT NULL, -- delivery number @@ -49,3 +48,4 @@ create table llx_livraison ); CREATE INDEX idx_llx_livraison_ref ON llx_livraison (ref); +CREATE INDEX idx_llx_livraison_fk_commande ON llx_livraison (fk_commande); diff --git a/pgsql/tables/llx_models.sql b/pgsql/tables/llx_models.sql deleted file mode 100644 index 3f902ac2084..00000000000 --- a/pgsql/tables/llx_models.sql +++ /dev/null @@ -1,36 +0,0 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- ============================================================================ --- Copyright (C) 2005 Laurent Destailleur --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ============================================================================ - -create table llx_models -( - rowid SERIAL PRIMARY KEY, - "tms" timestamp, - "type" varchar(32), -- Fonction destinee au modele - "public" smallint DEFAULT 1 NOT NULL, -- Model publique ou privee - "fk_user" integer, -- Id utilisateur si privee, sinon null - "title" varchar(128), -- Titre modele - "content" text -- Texte du modele -); diff --git a/pgsql/tables/llx_propal.sql b/pgsql/tables/llx_propal.sql index 161f275c8ae..2c68d033a96 100644 --- a/pgsql/tables/llx_propal.sql +++ b/pgsql/tables/llx_propal.sql @@ -25,12 +25,14 @@ -- =================================================================== + create table llx_propal ( rowid SERIAL PRIMARY KEY, "fk_soc" integer, "fk_projet" integer DEFAULT 0, -- projet auquel est rattache la propale "ref" varchar(30) NOT NULL, -- propal number + "ref_client" varchar(30), -- customer order number "datec" timestamp, -- date de creation "datep" date, -- date de la propal "fin_validite" timestamp, -- date de fin de validite diff --git a/pgsql/tables/llx_propaldet.sql b/pgsql/tables/llx_propaldet.sql index ff3255642ae..399156e495d 100644 --- a/pgsql/tables/llx_propaldet.sql +++ b/pgsql/tables/llx_propaldet.sql @@ -29,10 +29,17 @@ create table llx_propaldet "fk_propal" integer, "fk_product" integer, "description" text, - "tva_tx" real DEFAULT 19.6, -- taux tva + "tva_tx" real, -- taux tva "qty" real, -- quantité "remise_percent" real DEFAULT 0, -- pourcentage de remise "remise" real DEFAULT 0, -- montant de la remise + "fk_remise_except" integer NULL, -- Lien vers table des remises fixes "subprice" real, -- prix avant remise - "price" real -- prix final + "price" real, -- prix final + "total_ht" real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale + "total_tva" real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale + "total_ttc" real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale + "info_bits" integer DEFAULT 0, -- TVA NPR ou non + "coef" real, -- coefficient de marge + "rang" integer DEFAULT 0 ); diff --git a/pgsql/tables/llx_societe.sql b/pgsql/tables/llx_societe.sql index 39c07cd8116..0b2fde1ca44 100644 --- a/pgsql/tables/llx_societe.sql +++ b/pgsql/tables/llx_societe.sql @@ -27,9 +27,8 @@ create table llx_societe ( idp SERIAL PRIMARY KEY, - "id" varchar(32), -- private id - "active" smallint DEFAULT 0, -- - "parent" integer DEFAULT 0, -- + "statut" smallint DEFAULT 0, -- statut + "parent" integer, "tms" timestamp, "datec" timestamp, -- creation date "datea" timestamp, -- activation date @@ -46,6 +45,7 @@ create table llx_societe "tel" varchar(20), -- phone number "fax" varchar(20), -- fax number "url" varchar(255), -- + "email" varchar(128), -- "fk_secteur" integer DEFAULT 0, -- "fk_effectif" integer DEFAULT 0, -- "fk_typent" integer DEFAULT 0, -- @@ -56,17 +56,17 @@ create table llx_societe "tva_intra" varchar(20), -- tva intracommunautaire "capital" real, -- capital de la société "description" text, -- - "fk_stcomm" smallint DEFAULT 0, -- commercial statut + "fk_stcomm" smallint DEFAULT 0, -- commercial statut "note" text, -- - "services" integer DEFAULT 0, -- + "services" smallint DEFAULT 0, -- "prefix_comm" varchar(5), -- prefix commercial - "client" integer DEFAULT 0, -- client oui/non - "fournisseur" smallint DEFAULT 0, -- fournisseur oui/non + "client" smallint DEFAULT 0, -- client 0/1/2 + "fournisseur" smallint DEFAULT 0, -- fournisseur 0/1 "rubrique" varchar(255), -- champ rubrique libre "fk_user_creat" integer, -- utilisateur qui a créé l'info "fk_user_modif" integer, -- utilisateur qui a modifié l'info "remise_client" real DEFAULT 0, -- remise systématique pour le client - "mode_reglement" integer DEFAULT 0, -- mode de réglement - "cond_reglement" integer DEFAULT 1 NOT NULL, -- condition de réglement - "tva_assuj" smallint DEFAULT 1 -- assujéti ou non à la TVA + "mode_reglement" smallint, -- mode de réglement + "cond_reglement" smallint, -- condition de réglement + "tva_assuj" smallint DEFAULT 1 -- assujéti ou non à la TVA ); diff --git a/pgsql/tables/llx_societe_adresse_livraison.sql b/pgsql/tables/llx_societe_adresse_livraison.sql index d1e9f520ca2..b85b0481d1e 100644 --- a/pgsql/tables/llx_societe_adresse_livraison.sql +++ b/pgsql/tables/llx_societe_adresse_livraison.sql @@ -36,7 +36,6 @@ create table llx_societe_adresse_livraison "address" varchar(255), -- company adresse "cp" varchar(10), -- zipcode "ville" varchar(50), -- town - "fk_departement" integer DEFAULT 0, -- "fk_pays" integer DEFAULT 0, -- "note" text, -- "fk_user_creat" integer, -- utilisateur qui a créé l'info diff --git a/pgsql/tables/llx_societe_remise_except.sql b/pgsql/tables/llx_societe_remise_except.sql index ede497e4e49..9e577568c24 100644 --- a/pgsql/tables/llx_societe_remise_except.sql +++ b/pgsql/tables/llx_societe_remise_except.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- Copyright (C) 2004 Rodolphe Quiedeville +-- Copyright (C) 2006 Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -23,11 +24,8 @@ -- $Source$ -- -- Remises exceptionnelles --- --- -- ============================================================================ - create table llx_societe_remise_except ( rowid SERIAL PRIMARY KEY, @@ -36,5 +34,5 @@ create table llx_societe_remise_except "amount_ht" real NOT NULL, "fk_user" integer NOT NULL, "fk_facture" integer, - "description" text + "description" varchar(255) NOT NULL ); diff --git a/pgsql/tables/llx_user.sql b/pgsql/tables/llx_user.sql index 05b65081a18..8dba693d7a0 100644 --- a/pgsql/tables/llx_user.sql +++ b/pgsql/tables/llx_user.sql @@ -47,6 +47,7 @@ create table llx_user "note" text, "datelastaccess" timestamp, "egroupware_id" integer, + "ldap_sid" varchar(255) DEFAULT NULL, UNIQUE(login) );