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
|
||||
if ($_POST["idprodfournprice"]) // >0 or -1
|
||||
{
|
||||
$qty = $_POST['qty'] ? $_POST['qty'] : $_POST['pqty'];
|
||||
|
||||
$product = new ProductFournisseur($db);
|
||||
$idprod=$product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']);
|
||||
$idprod=$product->get_buyprice($_POST['idprodfournprice'], $qty);
|
||||
if ($idprod > 0)
|
||||
{
|
||||
$product->fetch($idprod);
|
||||
$res=$product->fetch($idprod);
|
||||
|
||||
// cas special pour lequel on a les meme reference que le fournisseur
|
||||
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
||||
@ -120,9 +122,7 @@ if ($_POST['action'] == 'addline' && $user->rights->fournisseur->commande->creer
|
||||
$desc = $product->description;
|
||||
$desc.= $product->description && $_POST['np_desc'] ? "\n" : "";
|
||||
$desc.= $_POST['np_desc'];
|
||||
|
||||
$qty = $_POST['qty'] ? $_POST['qty'] : $_POST['pqty'];
|
||||
|
||||
|
||||
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"];
|
||||
|
||||
$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
|
||||
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
|
||||
* 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 qty Quantit<EFBFBD> du produit
|
||||
* \return int <0 si ko, 0 si ok mais rien trouv<EFBFBD>, id_product si ok et trouv<EFBFBD>
|
||||
* \brief Lit le prix pratique par un fournisseur
|
||||
* 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 qty Quantity asked
|
||||
* \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)
|
||||
{
|
||||
@ -766,12 +768,13 @@ class Product extends CommonObject
|
||||
}
|
||||
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
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -779,6 +782,7 @@ class Product extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
return $result;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user