forked from Dolibarr/dolibarr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW: tables for a new module, supplier contract (same a contrat but f…
…or supplier)
- Loading branch information
1 parent
42089e3
commit 25e32f8
Showing
8 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- ============================================================================ | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- ============================================================================ | ||
|
||
|
||
-- Delete orphans | ||
-- V4 DELETE llx_supplier_contractdet FROM llx_supplier_contractdet, llx_supplier_contract LEFT JOIN llx_societe ON llx_supplier_contract.fk_soc = llx_societe.rowid WHERE llx_supplier_contract.fk_supplier_contract = llx_supplier_contract.rowid AND llx_societe.rowid IS NULL; | ||
-- V4 DELETE llx_supplier_contract FROM llx_supplier_contract LEFT JOIN llx_societe ON llx_supplier_contract.fk_soc = llx_societe.rowid WHERE llx_societe.rowid IS NULL; | ||
-- V4 DELETE llx_supplier_contract FROM llx_supplier_contract LEFT JOIN llx_user ON llx_supplier_contract.fk_user_creat = llx_user.rowid WHERE llx_user.rowid IS NULL; | ||
|
||
ALTER TABLE llx_supplier_contract ADD UNIQUE INDEX uk_supplier_contract_ref (ref, entity); | ||
|
||
ALTER TABLE llx_supplier_contract ADD INDEX idx_supplier_contract_fk_soc (fk_soc); | ||
ALTER TABLE llx_supplier_contract ADD INDEX idx_supplier_contract_fk_user_creat (fk_user_creat); | ||
|
||
ALTER TABLE llx_supplier_contract ADD CONSTRAINT fk_supplier_contract_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); | ||
ALTER TABLE llx_supplier_contract ADD CONSTRAINT fk_supplier_contract_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
-- ============================================================================ | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- ============================================================================ | ||
|
||
create table llx_supplier_contract | ||
( | ||
rowid integer AUTO_INCREMENT PRIMARY KEY, | ||
ref varchar(255), -- contrat reference | ||
ref_customer varchar(255), -- customer contract ref | ||
ref_supplier varchar(255), -- supplier contract ref | ||
ref_ext varchar(255), -- external contract ref | ||
entity integer DEFAULT 1 NOT NULL, -- multi company id | ||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
date_creation DATETIME NOT NULL, | ||
date_contract datetime, | ||
fk_soc integer NOT NULL, | ||
fk_project integer, | ||
fk_user_creat integer NOT NULL default 0, | ||
fk_user_modif integer, | ||
fk_user_cloture integer, | ||
|
||
total_tva double(24,8) DEFAULT 0, -- total tax | ||
localtax1 double(24,8) DEFAULT 0, -- total local tax 2 | ||
localtax2 double(24,8) DEFAULT 0, -- total local tax 3 | ||
revenuestamp double(24,8) DEFAULT 0, -- amount total revenuestamp (usefull for proforma that must match invoice) | ||
total_ht double(24,8) DEFAULT 0, -- total without tax | ||
total_ttc double(24,8) DEFAULT 0, -- total with tax | ||
|
||
denormalized_lower_planned_end_date datetime, -- DENORMALIZED FIELD to store end date of last subscription | ||
|
||
signed_status smallint DEFAULT NULL, -- signed status NULL, 0 or 1 | ||
online_sign_ip varchar(48), | ||
online_sign_name varchar(64), | ||
|
||
note_private text, | ||
note_public text, | ||
model_pdf varchar(255), | ||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document | ||
import_key varchar(14), | ||
extraparams varchar(255) | ||
)ENGINE=innodb; |
20 changes: 20 additions & 0 deletions
20
htdocs/install/mysql/tables/llx_supplier_contract_extrafields.key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- =================================================================== | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- =================================================================== | ||
|
||
|
||
ALTER TABLE llx_supplier_contract_extrafields ADD INDEX idx_supplier_contract_extrafields (fk_object); |
25 changes: 25 additions & 0 deletions
25
htdocs/install/mysql/tables/llx_supplier_contract_extrafields.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- ======================================================================== | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- ======================================================================== | ||
|
||
create table llx_supplier_contract_extrafields | ||
( | ||
rowid integer AUTO_INCREMENT PRIMARY KEY, | ||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
fk_object integer NOT NULL, | ||
import_key varchar(14) -- import key | ||
) ENGINE=innodb; |
30 changes: 30 additions & 0 deletions
30
htdocs/install/mysql/tables/llx_supplier_contractdet.key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- ============================================================================ | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- ============================================================================ | ||
|
||
|
||
ALTER TABLE llx_supplier_contractdet ADD INDEX idx_supplier_contractdet_fk_supplier_contract (fk_supplier_contract); | ||
ALTER TABLE llx_supplier_contractdet ADD INDEX idx_supplier_contractdet_fk_product (fk_product); | ||
ALTER TABLE llx_supplier_contractdet ADD INDEX idx_supplier_contractdet_date_planned_opening (date_planned_opening); | ||
ALTER TABLE llx_supplier_contractdet ADD INDEX idx_supplier_contractdet_date_opening (date_opening); | ||
ALTER TABLE llx_supplier_contractdet ADD INDEX idx_supplier_contractdet_date_expiry (date_expiry); | ||
ALTER TABLE llx_supplier_contractdet ADD INDEX idx_supplier_contractdet_status (status); | ||
|
||
ALTER TABLE llx_supplier_contractdet ADD CONSTRAINT fk_supplier_contractdet_fk_supplier_contract FOREIGN KEY (fk_supplier_contract) REFERENCES llx_supplier_contract (rowid); | ||
ALTER TABLE llx_supplier_contractdet ADD CONSTRAINT fk_supplier_contractdet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); | ||
|
||
ALTER TABLE llx_supplier_contractdet ADD CONSTRAINT fk_supplier_contractdet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
-- ============================================================================ | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- ============================================================================ | ||
|
||
create table llx_supplier_contractdet | ||
( | ||
rowid integer AUTO_INCREMENT PRIMARY KEY, | ||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
|
||
fk_supplier_contract integer NOT NULL, | ||
fk_product integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits | ||
|
||
status smallint DEFAULT 0, | ||
|
||
label text, -- libelle du produit | ||
description text, | ||
fk_remise_except integer NULL, -- Lien vers table des remises fixes | ||
|
||
date_commande datetime, -- not used ? | ||
date_planned_opening datetime, | ||
date_opening datetime, -- date d'ouverture du service chez le client | ||
date_expiry datetime, | ||
date_cloture datetime, | ||
|
||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. | ||
tva_tx double(7,4) DEFAULT 0, -- taux tva | ||
localtax1_tx double(7,4) DEFAULT 0, -- local tax 1 rate | ||
localtax1_type varchar(10) NULL, -- localtax1 type | ||
localtax2_tx double(7,4) DEFAULT 0, -- local tax 2 rate | ||
localtax2_type varchar(10) NULL, -- localtax2 type | ||
qty real NOT NULL, -- quantity | ||
remise_percent real DEFAULT 0, -- pourcentage de remise | ||
subprice double(24,8) DEFAULT 0, -- prix unitaire | ||
price_ht real, -- prix final (obsolete) | ||
remise real DEFAULT 0, -- montant de la remise (obsolete) | ||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale | ||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale | ||
total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne | ||
total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne | ||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale | ||
product_type integer DEFAULT 1, -- Type of line (1=service by default) | ||
info_bits integer DEFAULT 0, -- TVA NPR ou non | ||
|
||
rang integer DEFAULT 0, | ||
buy_price_ht double(24,8) DEFAULT NULL, -- buying price | ||
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added was created (may be used to update buy_price_ht when future invoice will be created) | ||
|
||
fk_user_creat integer NOT NULL DEFAULT 0, | ||
fk_user_opening integer, | ||
fk_user_cloture integer, | ||
comment text, | ||
fk_unit integer DEFAULT NULL, | ||
|
||
fk_multicurrency integer, | ||
multicurrency_code varchar(3), | ||
multicurrency_subprice double(24,8) DEFAULT 0, | ||
multicurrency_total_ht double(24,8) DEFAULT 0, | ||
multicurrency_total_tva double(24,8) DEFAULT 0, | ||
multicurrency_total_ttc double(24,8) DEFAULT 0 | ||
)ENGINE=innodb; |
20 changes: 20 additions & 0 deletions
20
htdocs/install/mysql/tables/llx_supplier_contractdet_extrafields.key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- =================================================================== | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- =================================================================== | ||
|
||
|
||
ALTER TABLE llx_supplier_contractdet_extrafields ADD INDEX idx_supplier_contractdet_extrafields (fk_object); |
25 changes: 25 additions & 0 deletions
25
htdocs/install/mysql/tables/llx_supplier_contractdet_extrafields.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- =================================================================== | ||
-- Copyright (C) 2024 Support <[email protected]> | ||
-- | ||
-- 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 3 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, see <https://www.gnu.org/licenses/>. | ||
-- | ||
-- =================================================================== | ||
|
||
create table llx_supplier_contractdet_extrafields | ||
( | ||
rowid integer AUTO_INCREMENT PRIMARY KEY, | ||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
fk_object integer NOT NULL, -- object id | ||
import_key varchar(14) -- import key | ||
)ENGINE=innodb; |