diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 71dfc2d8c68..831ed26d937 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -88,4 +88,5 @@ ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s SelectWarehouseForStockDecrease=Choose warehouse to use for stock decrease SelectWarehouseForStockIncrease=Choose warehouse to use for stock increase NoStockAction=No stock action -LastWaitingSupplierOrders=Orders waiting for receptions \ No newline at end of file +LastWaitingSupplierOrders=Orders waiting for receptions +DesiredStock=Desired stock diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index df80fe6f1a8..15029f07ec6 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -89,3 +89,4 @@ SelectWarehouseForStockDecrease=Sélectionner l'entrepôt à utiliser pour la d SelectWarehouseForStockIncrease=Sélectionner l'entrepôt à utiliser pour l'incrémentation du stock NoStockAction=Pas d'action sur l'entrepôt LastWaitingSupplierOrders=Commandes en attente de réception +DesiredStock=Stock désiré diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7ff3d662ab3..998b58cc980 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -83,7 +83,8 @@ class Product extends CommonObject var $pmp; //! Stock alert var $seuil_stock_alerte; - + //! Ask for replenishment when $desiredstock < $stock_reel + public $desiredstock; //! Duree de validite du service var $duration_value; //! Unite de duree @@ -165,6 +166,7 @@ class Product extends CommonObject $this->nbphoto = 0; $this->stock_reel = 0; $this->seuil_stock_alerte = 0; + $this->desiredstock = 0; $this->canvas = ''; } @@ -489,6 +491,7 @@ class Product extends CommonObject $sql.= ",duration = '" . $this->duration_value . $this->duration_unit ."'"; $sql.= ",accountancy_code_buy = '" . $this->accountancy_code_buy."'"; $sql.= ",accountancy_code_sell= '" . $this->accountancy_code_sell."'"; + $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null"); $sql.= " WHERE rowid = " . $id; dol_syslog(get_class($this)."update sql=".$sql); @@ -1135,7 +1138,7 @@ class Product extends CommonObject $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; - $sql.= " datec, tms, import_key, entity"; + $sql.= " datec, tms, import_key, entity, desiredstock"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = '".$id."'"; else @@ -1199,6 +1202,7 @@ class Product extends CommonObject $this->accountancy_code_sell = $obj->accountancy_code_sell; $this->seuil_stock_alerte = $obj->seuil_stock_alerte; + $this->desiredstock = $obj->desiredstock; $this->stock_reel = $obj->stock; $this->pmp = $obj->pmp; @@ -2199,7 +2203,8 @@ class Product extends CommonObject 'stock'=>$this->stock_warehouse[1]->real, // Stock 'stock_alert'=>$this->seuil_stock_alerte, // Stock alert 'fullpath' => $compl_path.$label, // Label - 'type'=>$type // Nb of units that compose parent product + 'type'=>$type, // Nb of units that compose parent product + 'desiredstock' => $this->desiredstock ); // Recursive call if child is an array diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index aa262f9a6c2..5baf7d00e1e 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -187,6 +187,7 @@ if (empty($reshook)) $object->duration_value = GETPOST('duration_value'); $object->duration_unit = GETPOST('duration_unit'); $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0; + $object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0; $object->canvas = GETPOST('canvas'); $object->weight = GETPOST('weight'); $object->weight_units = GETPOST('weight_units'); @@ -256,6 +257,7 @@ if (empty($reshook)) $object->status = GETPOST('statut'); $object->status_buy = GETPOST('statut_buy'); $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); + $object->desiredstock = GETPOST('desiredstock'); $object->duration_value = GETPOST('duration_value'); $object->duration_unit = GETPOST('duration_unit'); $object->canvas = GETPOST('canvas'); @@ -723,12 +725,17 @@ else print ''.$langs->trans("StockLimit").''; print ''; print ''; + // Stock desired level + print ''.$langs->trans("DesiredStock").''; + print ''; + print ''; } else { print ''; + print ''; } - + // Description (used in invoice, propal...) print ''.$langs->trans("Description").''; @@ -934,10 +941,15 @@ else print "".''.$langs->trans("StockLimit").''; print ''; print ''; + + print "".''.$langs->trans("DesiredStock").''; + print ''; + print ''; } else { print ''; + print ''; } if ($object->isservice())