mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
Debug SQL
This commit is contained in:
@@ -208,10 +208,9 @@ DELETE FROM llx_const WHERE name = 'STOCK_ALLOW_NEGATIVE_TRANSFER' AND value = 1
|
||||
ALTER TABLE llx_links ADD COLUMN share varchar(128) NULL AFTER objectid;
|
||||
ALTER TABLE llx_links ADD COLUMN share_pass varchar(32) NULL AFTER share;
|
||||
|
||||
-- Dispatcher for virtual products
|
||||
ALTER TABLE llx_expeditiondet ADD COLUMN fk_parent integer NULL AFTER fk_product;
|
||||
ALTER TABLE llx_expeditiondet ADD COLUMN fk_parent integer NULL AFTER fk_product; -- for sublines
|
||||
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_parent (fk_parent);
|
||||
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_parent FOREIGN KEY (fk_parent) REFERENCES llx_expeditiondet (rowid);
|
||||
--ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
--ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_parent FOREIGN KEY (fk_parent) REFERENCES llx_expeditiondet (rowid);
|
||||
|
||||
UPDATE llx_expeditiondet as ed LEFT JOIN llx_commandedet ON ed.fk_elementdet = llx_commandedet.rowid SET ed.fk_product = llx_commandedet.fk_product WHERE ed.fk_product IS NULL AND ed.element_type = 'commande';
|
||||
UPDATE llx_expeditiondet as ed SET ed.fk_product = (SELECT cd.fk_product FROM llx_commandedet as cd WHERE cd.rowid = ed.fk_elementdet AND ed.element_type = 'commande') AND ed.fk_product IS NULL;
|
||||
|
||||
@@ -22,6 +22,7 @@ ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_expedition (fk_expe
|
||||
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_elementdet (fk_elementdet);
|
||||
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_product (fk_product);
|
||||
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_parent (fk_parent);
|
||||
|
||||
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_expedition FOREIGN KEY (fk_expedition) REFERENCES llx_expedition (rowid);
|
||||
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_parent FOREIGN KEY (fk_parent) REFERENCES llx_expeditiondet (rowid);
|
||||
--ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
--ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_parent FOREIGN KEY (fk_parent) REFERENCES llx_expeditiondet (rowid);
|
||||
|
||||
@@ -26,7 +26,7 @@ create table llx_expeditiondet
|
||||
fk_element integer, -- ID of main source object
|
||||
fk_elementdet integer, -- ID of line of source object (proposal, sale order)
|
||||
element_type varchar(50) DEFAULT 'commande' NOT NULL, -- Type of source object ('commande', ...)
|
||||
fk_product integer, -- ID of product. If empy, you can retreive it using fk_element/element_type link
|
||||
fk_product integer, -- ID of product. If empy, you can retreive it using fk_element/element_type link.
|
||||
fk_parent integer, -- ID of parent line
|
||||
qty real, -- Quantity
|
||||
fk_unit integer, -- ID of unit code
|
||||
|
||||
Reference in New Issue
Block a user