diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index b3873ae821f..5ad227ce788 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2fdb9d775f8..d3806c5dd17 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -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'); diff --git a/htdocs/product.class.php b/htdocs/product.class.php index a05f59bd5c1..8275df6444f 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -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� du produit - * \return int <0 si ko, 0 si ok mais rien trouv�, id_product si ok et trouv� + * \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� 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;