From 3ea6cd1c66a75d3fc38c870cfa759578414d4fec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 08:53:29 +0200 Subject: [PATCH] Fix missing columns --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_product.sql | 2 ++ htdocs/product/inventory/inventory.php | 6 +++--- test/phpunit/PdfDocTest.php | 7 +++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 92e2c3cf757..37719c015c5 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -403,6 +403,8 @@ UPDATE llx_propal SET date_signature = date_cloture WHERE date_signature IS NULL ALTER TABLE llx_product ADD COLUMN batch_mask VARCHAR(32) NULL; +ALTER TABLE llx_product ADD COLUMN lifetime INTEGER NULL; +ALTER TABLE llx_product ADD COLUMN qc_frequency INTEGER NULL; insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (210, 'conferenceorbooth', 'internal', 'MANAGER', 'Conference or Booth manager', 1); insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (211, 'conferenceorbooth', 'external', 'SPEAKER', 'Conference Speaker', 1); diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index da8c2ff693c..73b4473a5a4 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -94,6 +94,8 @@ create table llx_product fk_default_warehouse integer DEFAULT NULL, canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, -- see dictionnary c_product_nature + lifetime integer DEFAULT NULL, + qc_frequency integer DEFAULT NULL, hidden tinyint DEFAULT 0, -- Not used. Deprecated. import_key varchar(14), -- Import key model_pdf varchar(255), -- model save dodument used diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ecad54a4a73..331dcb997c7 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -609,7 +609,7 @@ if ($object->id > 0) { print ''; } - // Request to show lines of inventory (prefilled during creation) + // Request to show lines of inventory (prefilled after start/validate step) $sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,'; $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; @@ -641,8 +641,8 @@ if ($object->id > 0) { $product_static = $cacheOfProducts[$obj->fk_product]; } else { $product_static = new Product($db); - $product_static->fetch($obj->fk_product); - + $result = $product_static->fetch($obj->fk_product, '', '', '', 1, 1, 1); +var_dump($result); $option = 'nobatch'; $option .= ',novirtual'; $product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock() diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index 039bbe69288..e744aef3c2f 100644 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -141,8 +141,11 @@ class PdfDocTest extends PHPUnit\Framework\TestCase $db=$this->savdb; $localproduct=new Product($this->savdb); - $localproduct->fetch(0, 'PIDRESS'); - $product_id=$localproduct->id; + $result = $localproduct->fetch(0, 'PIDRESS'); + if ($result < 0) { + print "\n".__METHOD__." Failed to make the fetch of product PIDRESS. ".$localproduct->error; die(1); + } + $product_id = $localproduct->id; if ($product_id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(1); }