';
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
print '
@@ -225,8 +226,8 @@ if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
- echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
-} else echo ' ';
+ print price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
+} else print ' ';
print '
';
if ($conf->global->PRODUCT_USE_UNITS)
@@ -242,7 +243,7 @@ if (!empty($line->remise_percent) && $line->special_code != 3) {
print '
';
diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php
index 5d44f37b910..b63a891973c 100644
--- a/htdocs/product/reassortlot.php
+++ b/htdocs/product/reassortlot.php
@@ -118,7 +118,7 @@ $title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,';
-$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tobatch,';
+$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,';
$sql.= ' ps.fk_entrepot,';
$sql.= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,';
$sql.= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,';
@@ -160,7 +160,7 @@ if ($search_warehouse) $sql .= natural_search("e.ref", $search_warehouse);
if ($search_batch) $sql .= natural_search("pb.batch", $search_batch);
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
$sql.= " p.fk_product_type, p.tms,";
-$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tobatch,";
+$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,";
$sql.= " ps.fk_entrepot,";
$sql.= " e.ref, e.lieu, e.fk_parent,";
$sql.= " pb.batch, pb.eatby, pb.sellby,";
@@ -206,21 +206,21 @@ if ($resql)
$texte.=' ('.$langs->trans("StocksByLotSerial").')';
$param='';
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
- if ($sall) $param.="&sall=".$sall;
- if ($tosell) $param.="&tosell=".$tosell;
- if ($tobuy) $param.="&tobuy=".$tobuy;
- if ($type) $param.="&type=".$type;
- if ($fourn_id) $param.="&fourn_id=".$fourn_id;
- if ($snom) $param.="&snom=".$snom;
- if ($sref) $param.="&sref=".$sref;
- if ($search_batch) $param.="&search_batch=".$search_batch;
- if ($sbarcode) $param.="&sbarcode=".$sbarcode;
- if ($search_warehouse) $param.="&search_warehouse=".$search_warehouse;
- if ($catid) $param.="&catid=".$catid;
- if ($toolowstock) $param.="&toolowstock=".$toolowstock;
- if ($search_sale) $param.="&search_sale=".$search_sale;
- if ($search_categ) $param.="&search_categ=".$search_categ;
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
+ if ($sall) $param.="&sall=".urlencode($sall);
+ if ($tosell) $param.="&tosell=".urlencode($tosell);
+ if ($tobuy) $param.="&tobuy=".urlencode($tobuy);
+ if ($type) $param.="&type=".urlencode($type);
+ if ($fourn_id) $param.="&fourn_id=".urlencode($fourn_id);
+ if ($snom) $param.="&snom=".urlencode($snom);
+ if ($sref) $param.="&sref=".urlencode($sref);
+ if ($search_batch) $param.="&search_batch=".urlencode($search_batch);
+ if ($sbarcode) $param.="&sbarcode=".urlencode($sbarcode);
+ if ($search_warehouse) $param.="&search_warehouse=".urlencode($search_warehouse);
+ if ($catid) $param.="&catid=".urlencode($catid);
+ if ($toolowstock) $param.="&toolowstock=".urlencode($toolowstock);
+ if ($search_sale) $param.="&search_sale=".urlencode($search_sale);
+ if ($search_categ) $param.="&search_categ=".urlencode($search_categ);
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
@@ -349,6 +349,8 @@ if ($resql)
$product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
+ $product_static->status=$objp->tosell;
+ $product_static->status_buy=$objp->tobuy;
$product_static->status_batch=$objp->tobatch;
$product_lot_static->batch=$objp->batch;
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index a3a97984ce9..ab3dfde9bf0 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -701,10 +701,12 @@ class Entrepot extends CommonObject
$label = '' . $langs->trans("ShowWarehouse").'';
$label.= ' ' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref);
- if (! empty($this->lieu))
+ if (! empty($this->lieu)) {
$label.= ' ' . $langs->trans('LocationSummary').': '.$this->lieu;
- if (isset($this->statut))
+ }
+ if (isset($this->statut)) {
$label.= ' ' . $langs->trans("Status").": ".$this->getLibStatut(5);
+ }
$url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id;
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index 1c7862f10f0..dea7580aeb7 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -195,12 +195,12 @@ if ($action == "correct_stock")
if ($product->hasbatch())
{
- $batch = GETPOST('batch_number');
+ $batch = GETPOST('batch_number', 'alphanohtml');
//$eatby=GETPOST('eatby');
//$sellby=GETPOST('sellby');
- $eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
- $sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
+ $eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int'));
+ $sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int'));
$result = $product->correct_stock_batch(
$user,
@@ -210,7 +210,7 @@ if ($action == "correct_stock")
GETPOST("label", 'san_alpha'),
GETPOST('unitprice'),
$eatby, $sellby, $batch,
- GETPOST('inventorycode'),
+ GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
$origin_id
); // We do not change value of stock for a correction
@@ -224,7 +224,7 @@ if ($action == "correct_stock")
GETPOST("mouvement"),
GETPOST("label", 'san_alpha'),
GETPOST('unitprice'),
- GETPOST('inventorycode'),
+ GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
$origin_id
); // We do not change value of stock for a correction
@@ -329,7 +329,7 @@ if ($action == "transfert_stock" && !$cancel)
else
{
$srcwarehouseid = $id;
- $batch = GETPOST('batch_number');
+ $batch = GETPOST('batch_number', 'alphanohtml');
$eatby = $d_eatby;
$sellby = $d_sellby;
}
@@ -356,7 +356,7 @@ if ($action == "transfert_stock" && !$cancel)
GETPOST("label", 'san_alpha'),
$pricedest,
$eatby, $sellby, $batch,
- GETPOST('inventorycode')
+ GETPOST('inventorycode', 'alphanohtml')
);
}
}
@@ -368,9 +368,9 @@ if ($action == "transfert_stock" && !$cancel)
$id,
GETPOST("nbpiece"),
1,
- GETPOST("label"),
+ GETPOST("label", 'san_alpha'),
$pricesrc,
- GETPOST('inventorycode')
+ GETPOST('inventorycode', 'alphanohtml')
);
// Add stock
@@ -379,9 +379,9 @@ if ($action == "transfert_stock" && !$cancel)
GETPOST("id_entrepot_destination"),
GETPOST("nbpiece"),
0,
- GETPOST("label"),
+ GETPOST("label", 'san_alpha'),
$pricedest,
- GETPOST('inventorycode')
+ GETPOST('inventorycode', 'alphanohtml')
);
}
if (!$error && $result1 >= 0 && $result2 >= 0)
@@ -424,7 +424,7 @@ $formother = new FormOther($db);
$formproduct = new FormProduct($db);
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
-$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
+$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tosell, p.tobuy, p.tobatch, p.fk_product_type as type, p.entity,";
$sql .= " e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
$sql .= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql .= " m.batch, m.price,";
@@ -976,6 +976,8 @@ if ($resql)
$productstatic->label = $objp->produit;
$productstatic->type = $objp->type;
$productstatic->entity = $objp->entity;
+ $productstatic->status = $objp->tosell;
+ $productstatic->status_buy = $objp->tobuy;
$productstatic->status_batch = $objp->tobatch;
$productlot->id = $objp->lotid;
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 4f851d8e1de..527afee2607 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -214,6 +214,8 @@ $sql.= " t.import_key,";
$sql.= " p.fk_product_type as product_type,";
$sql.= " p.ref as product_ref,";
$sql.= " p.label as product_label,";
+$sql.= " p.tosell,";
+$sql.= " p.tobuy,";
$sql.= " p.tobatch";
// Add fields for extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
@@ -300,7 +302,7 @@ if ($resql)
print '';
print '';
- print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'products', 0, '', '', $limit);
+ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'barcode', 0, '', '', $limit);
$topicmail = "Information";
$modelmail = "productlot";
@@ -418,6 +420,7 @@ if ($resql)
if ($obj)
{
$productlot->id = $obj->rowid;
+ $productlot->status = $obj->tosell;
$productlot->batch = $obj->batch;
// You can use here results
@@ -438,7 +441,10 @@ if ($resql)
$productstatic->type = $obj->product_type;
$productstatic->ref = $obj->product_ref;
$productstatic->label = $obj->product_label;
+ $productstatic->status = $obj->tosell;
+ $productstatic->status_buy = $obj->tobuy;
$productstatic->status_batch = $obj->tobatch;
+
print '
'.$productstatic->getNomUrl(1).'
';
if (!$i) $totalarray['nbfield']++;
}
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index b8f607cfc20..f01ad4c0b1b 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -229,7 +229,7 @@ if (empty($reshook))
dol_print_error($db, $object->error);
}
- // Create askprice
+ // Create supplier proposal
elseif ($action == 'add' && $user->rights->supplier_proposal->creer)
{
$object->socid = $socid;
@@ -630,7 +630,7 @@ if (empty($reshook))
elseif (GETPOST('idprodfournprice', 'alpha') > 0)
{
//$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
- $qtytosearch = -1; // We force qty to -1 to be sure to find if a supplier price exist
+ $qtytosearch = -1; // We force qty to -1 to be sure to find if the supplier price that exists
$idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch);
$res = $productsupplier->fetch($idprod);
}
@@ -660,7 +660,8 @@ if (empty($reshook))
$pu_ht = $productsupplier->fourn_pu;
if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value
- $fournprice = 0;
+ // If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used)
+ $fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1);
$buyingprice = 0;
$result = $object->addline(
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index b01b7181f75..5825b2ff9b7 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -388,7 +388,7 @@ class SupplierProposal extends CommonObject
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line
- * @param int $fk_fournprice Id supplier price
+ * @param int $fk_fournprice Id supplier price. If 0, we will take best price. If -1 we keep it empty.
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param array $array_option extrafields array
@@ -583,15 +583,16 @@ class SupplierProposal extends CommonObject
// infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
- // by external module, take lowest buying price
+ // When fk_fournprice is 0, we take the lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
- $this->line->fk_fournprice = $fk_fournprice;
+ $this->line->fk_fournprice = ($fk_fournprice > 0 ? $fk_fournprice : 0); // If fk_fournprice is -1, we will not use fk_fournprice
}
$this->line->pa_ht = $pa_ht;
+ //var_dump($this->line->fk_fournprice);exit;
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php
index 9f3deb9e93f..5dd3521b4e1 100644
--- a/htdocs/variants/card.php
+++ b/htdocs/variants/card.php
@@ -148,9 +148,9 @@ if ($action != 'edit') {
print '
';
print '';
}
-print '
';
+print '
';
print '
';
-print '
'.$langs->trans('Ref').'
';
+print '
'.$langs->trans('Ref').'
';
print '
';
if ($action == 'edit') {
print '';
@@ -160,7 +160,7 @@ if ($action == 'edit') {
print '