diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 09908ac86f5..c29cc803836 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -54,6 +54,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN desc_fourn text after ref_f ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment; +ALTER TABLE llx_stock_mouvement ADD COLUMN fk_project integer; ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search; diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index 1e78e7a9820..fdeab913268 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -33,6 +33,7 @@ create table llx_stock_mouvement fk_user_author integer, -- Id user making movement label varchar(255), -- Comment on movement inventorycode varchar(128), -- Code used to group different movement line into one operation (may be an inventory, a mass picking) + fk_project integer, fk_origin integer, origintype varchar(32), model_pdf varchar(255) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 57138a75153..21ed7f4085e 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -204,3 +204,7 @@ ListInventory=List StockSupportServices=Stock management supports Services StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service" ReceiveProducts=Receive items +StockIncreaseAfterCorrectTransfer=Increase after correction/transfer +StockDecreaseAfterCorrectTransfer=Decrease after correction/transfer +StockIncrease=Stock increase +StockDecrease=Stock decrease diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 9012262d163..395c192311f 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -44,6 +44,13 @@ class MouvementStock extends CommonObject public $product_id; public $warehouse_id; public $qty; + + /** + * @var int Type of movement + * 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer), + * 2=output (stock decrease), 3=input (stock increase) + * Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2. + */ public $type; public $tms = ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 053fe3a458b..1d8999d319c 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -478,11 +478,11 @@ if (! empty($search_movement)) $sql.= natural_search('m.label', $search_mov if (! empty($search_inventorycode)) $sql.= natural_search('m.inventorycode', $search_inventorycode); if (! empty($search_product_ref)) $sql.= natural_search('p.ref', $search_product_ref); if (! empty($search_product)) $sql.= natural_search('p.label', $search_product); -if ($search_warehouse > 0) $sql.= " AND e.rowid = '".$db->escape($search_warehouse)."'"; +if ($search_warehouse != '' && $search_warehouse != '-1') $sql.= natural_search('e.rowid', $search_warehouse, 2); if (! empty($search_user)) $sql.= natural_search('u.login', $search_user); if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch); if ($search_qty != '') $sql.= natural_search('m.value', $search_qty, 1); -if ($search_type_mouvement) $sql.= " AND m.type_mouvement = '".$db->escape($search_type_mouvement)."'"; +if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natural_search('m.type_mouvement', $search_type_mouvement, 2); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -843,13 +843,14 @@ if ($resql) // Type of movement print ''; //print ''; - print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; + print ajax_combobox('search_type_mouvement'); // TODO: add new function $formentrepot->selectTypeOfMovement(...) like // print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); print '';