added the desired stock field to the create/edit product UI

This commit is contained in:
Cédric Salvador 2013-05-30 16:32:48 +02:00
parent 1791a3188d
commit e36613f0f0
4 changed files with 24 additions and 5 deletions

View File

@ -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
LastWaitingSupplierOrders=Orders waiting for receptions
DesiredStock=Desired stock

View File

@ -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é

View File

@ -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

View File

@ -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 '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
print '<input name="seuil_stock_alerte" size="4" value="'.GETPOST('seuil_stock_alerte').'">';
print '</td></tr>';
// Stock desired level
print '<tr><td>'.$langs->trans("DesiredStock").'</td><td>';
print '<input name="desiredstock" size="4" value="'.GETPOST('desiredstock').'">';
print '</td></tr>';
}
else
{
print '<input name="seuil_stock_alerte" type="hidden" value="0">';
print '<input name="desiredstock" type="hidden" value="0">';
}
// Description (used in invoice, propal...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
@ -934,10 +941,15 @@ else
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td colspan="2">';
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
print '</td></tr>';
print "<tr>".'<td>'.$langs->trans("DesiredStock").'</td><td colspan="2">';
print '<input name="desiredstock" size="4" value="'.$object->desiredstock.'">';
print '</td></tr>';
}
else
{
print '<input name="seuil_stock_alerte" type="hidden" value="'.$object->seuil_stock_alerte.'">';
print '<input name="desiredstock" type="hidden" value="'.$object->desiredstock.'">';
}
if ($object->isservice())