From 9a05c16edc615eae9acd997294f95503c44c1b0f Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 3 Apr 2023 11:50:06 +0200 Subject: [PATCH] NEW : Stock limit for alert and desired optimal stock by product and warehouse import --- htdocs/core/modules/modProduct.class.php | 25 ++++++++++++++++++++++++ htdocs/langs/en_US/stocks.lang | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 560ca3d7277..5446fa56a57 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -620,6 +620,31 @@ class modProduct extends DolibarrModules $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref'); if (!empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled + if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { + + // Import products limit and desired stock by product and warehouse + $r++; + $this->import_code[$r] = $this->rights_class.'_stock_by_warehouse'; + $this->import_label[$r] = "ProductStockWarehouse"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('pwp'=>MAIN_DB_PREFIX.'product_warehouse_properties'); + $this->import_fields_array[$r] = array('pwp.fk_product'=>"Product*", + 'pwp.fk_entrepot'=>"Warehouse*", 'pwp.seuil_stock_alerte'=>"StockLimit", + 'pwp.desiredstock'=>"DesiredStock"); + $this->import_convertvalue_array[$r] = array( + 'pwp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + ,'pwp.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'Entrepot') + ); + $this->import_examplevalues_array[$r] = array('pwp.fk_product'=>"ref:PRODUCT_REF or id:123456", + 'pwp.fk_entrepot'=>"ref:WAREHOUSE_REF or id:123456", + 'pwp.seuil_stock_alerte'=>"100", + 'pwp.desiredstock'=>"110" + ); + $this->import_updatekeys_array[$r] = array('pwp.fk_product'=>'Product', 'pwp.fk_entrepot'=>'Warehouse'); + + } + if (!empty($conf->fournisseur->enabled)) { // Import suppliers prices (note: this code is duplicated in module Service) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 1b54e53d6de..df0420947e3 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -173,6 +173,7 @@ OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a prod ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted +ProductStockWarehouse=Stock limit for alert and desired optimal stock by product and warehouse AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock AddStockLocationLine=Decrease quantity then click to add another warehouse for this product InventoryDate=Inventory date @@ -240,4 +241,4 @@ InventoryRealQtyHelp=Set value to 0 to reset qty
Keep field empty, or remove UpdateByScaning=Update by scaning UpdateByScaningProductBarcode=Update by scan (product barcode) UpdateByScaningLot=Update by scan (lot|serial barcode) -DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement. \ No newline at end of file +DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement.