From b7a3cdd7c6370aed259dfbb20e8e739eea7d823b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 01:16:06 +0200 Subject: [PATCH] Debug BOM module --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 8 ++++---- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 10 ++++++---- htdocs/install/mysql/tables/llx_bom_bomline.sql | 12 ++++++------ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ab8062889b1..0f2dfb5e52b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -133,7 +133,7 @@ if (empty($reshook)) $bomline = new BOMLine($db); $bomline->fk_bom = $id; - $bomline->fk_product = $prodid; + $bomline->fk_product = $idprod; $bomline->qty = $qty; $bomline->efficiency = $efficiency; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index f1dd4f03e06..de67cbc82e8 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -974,11 +974,11 @@ class BOMLine extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), + 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>-1, 'isameasure'=>'1',), - 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), + 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index defa2936c02..075e95fb0bd 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -239,17 +239,19 @@ create table llx_bom_bom_extrafields CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_bom integer, - fk_product integer, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - efficiency double(8,4) DEFAULT 1, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1; +ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL; create table llx_bom_bomline_extrafields diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index b9763c754e8..bafaaf73694 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -13,16 +13,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. - CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_bom integer, - fk_product integer, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - efficiency double(8,4) DEFAULT 1, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS -) ENGINE=innodb; \ No newline at end of file +) ENGINE=innodb;