Fix: Can't add product line to supplier order.
This commit is contained in:
parent
692264409b
commit
534c8d8dbf
@ -100,11 +100,13 @@ if ($_POST['action'] == 'addline' && $user->rights->fournisseur->commande->creer
|
|||||||
// Ecrase $txtva par celui du produit
|
// Ecrase $txtva par celui du produit
|
||||||
if ($_POST["idprodfournprice"]) // >0 or -1
|
if ($_POST["idprodfournprice"]) // >0 or -1
|
||||||
{
|
{
|
||||||
|
$qty = $_POST['qty'] ? $_POST['qty'] : $_POST['pqty'];
|
||||||
|
|
||||||
$product = new ProductFournisseur($db);
|
$product = new ProductFournisseur($db);
|
||||||
$idprod=$product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']);
|
$idprod=$product->get_buyprice($_POST['idprodfournprice'], $qty);
|
||||||
if ($idprod > 0)
|
if ($idprod > 0)
|
||||||
{
|
{
|
||||||
$product->fetch($idprod);
|
$res=$product->fetch($idprod);
|
||||||
|
|
||||||
// cas special pour lequel on a les meme reference que le fournisseur
|
// cas special pour lequel on a les meme reference que le fournisseur
|
||||||
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
||||||
@ -121,8 +123,6 @@ if ($_POST['action'] == 'addline' && $user->rights->fournisseur->commande->creer
|
|||||||
$desc.= $product->description && $_POST['np_desc'] ? "\n" : "";
|
$desc.= $product->description && $_POST['np_desc'] ? "\n" : "";
|
||||||
$desc.= $_POST['np_desc'];
|
$desc.= $_POST['np_desc'];
|
||||||
|
|
||||||
$qty = $_POST['qty'] ? $_POST['qty'] : $_POST['pqty'];
|
|
||||||
|
|
||||||
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"];
|
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"];
|
||||||
|
|
||||||
$tva_tx = get_default_tva($societe,$mysoc,$product->tva_tx,$product->id);
|
$tva_tx = get_default_tva($societe,$mysoc,$product->tva_tx,$product->id);
|
||||||
|
|||||||
@ -634,7 +634,9 @@ if ($user->statut < 1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dol_syslog("Access to ".$_SERVER["PHP_SELF"],LOG_INFO);
|
dol_syslog("Access to ".$_SERVER["PHP_SELF"]);
|
||||||
|
//Another call for easy debugg
|
||||||
|
//dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST));
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1');
|
if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1');
|
||||||
|
|||||||
@ -709,11 +709,13 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Lit le prix pratique par un fournisseur
|
* \brief Lit le prix pratique par un fournisseur
|
||||||
* On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref)
|
* On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref)
|
||||||
* \param prodfournprice Id du tarif = rowid table product_fournisseur_price
|
* \param prodfournprice Id du tarif = rowid table product_fournisseur_price
|
||||||
* \param qty Quantit<EFBFBD> du produit
|
* \param qty Quantity asked
|
||||||
* \return int <0 si ko, 0 si ok mais rien trouv<EFBFBD>, id_product si ok et trouv<EFBFBD>
|
* \param product_id Filter on a particular product id
|
||||||
|
* \param fourn_ref Filter on a supplier ref
|
||||||
|
* \return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve
|
||||||
*/
|
*/
|
||||||
function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0)
|
function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0)
|
||||||
{
|
{
|
||||||
@ -766,12 +768,13 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return -1; // Ce produit existe chez ce fournisseur mais qt<EFBFBD> insuffisante
|
return -1; // Ce produit existe chez ce fournisseur mais qte insuffisante
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
|
dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -779,6 +782,7 @@ class Product extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
|
dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user