Fix: Some fix after patch merge.

This commit is contained in:
Laurent Destailleur 2013-04-05 22:38:46 +02:00
parent 49c9df3688
commit a5f72bfb4e
2 changed files with 28 additions and 36 deletions

View File

@ -3049,31 +3049,23 @@ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
/**
* Fonction qui renvoie si tva doit etre tva percue recuperable
*
* @param Societe $thirdparty_seller Objet societe vendeuse
* @param Societe $thirdparty_buyer Objet societe acheteuse
* @param Societe $thirdparty_seller Thirdparty seller
* @param Societe $thirdparty_buyer Thirdparty buyer
* @param int $idprod Id product
* @param int $idprodfournprice Id supplier price for product
* @return float 0 or 1
*/
function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod+0, $idprodfournprice=0)
function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
{
global $db;
if($idprodfournprice>0)
{
$sql = "SELECT pfp.recuperableonly";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE rowid = ".$idprodfournprice;
dol_syslog(get_class($this)."::get_default_npr sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$record = $this->db->fetch_array($resql);
if(isset($record['recuperableonly']))
return $record['recuperableonly'];
}
if ($idprodfournprice > 0)
{
$prodprice = new ProductFournisseur($db);
$prodprice->fetch_product_fournisseur_price($idprodfournprice);
return $prodprice->fourn_tva_npr;
}
elseif( $idprod > 0 )
elseif ($idprod > 0)
{
$prod = new Product($db);
$prod->fetch($idprod);
@ -3089,8 +3081,8 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod+0, $idpr
* Si le (pays vendeur = pays acheteur) alors TVA par defaut=TVA du produit vendu. Fin de regle.
* Sinon TVA proposee par defaut=0. Fin de regle.
*
* @param Societe $thirdparty_seller Objet societe vendeuse
* @param Societe $thirdparty_buyer Objet societe acheteuse
* @param Societe $thirdparty_seller Thirdparty seller
* @param Societe $thirdparty_buyer Thirdparty buyer
* @param int $local Localtax to process (1 or 2)
* @param int $idprod Id product
* @return float localtax, -1 si ne peut etre determine

View File

@ -295,7 +295,7 @@ class ProductFournisseur extends Product
function fetch_product_fournisseur_price($rowid)
{
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges";
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.recuperableonly as fourn_tva_npr";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.rowid = ".$rowid;
@ -306,21 +306,21 @@ class ProductFournisseur extends Product
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$this->product_fourn_price_id = $rowid;
$this->fourn_ref = $obj->ref_fourn;
$this->fourn_price = $obj->price;
$this->fourn_charges = $obj->charges;
$this->fourn_qty = $obj->quantity;
$this->fourn_remise_percent = $obj->remise_percent;
$this->fourn_remise = $obj->remise;
$this->fourn_unitprice = $obj->unitprice;
$this->fourn_unitcharges = $obj->unitcharges;
$this->tva_tx = $obj->tva_tx;
$this->product_id = $obj->fk_product; // deprecated
$this->fk_product = $obj->fk_product;
$this->fk_availability = $obj->fk_availability;
$this->fourn_tva_npr = $obj->recuperableonly;
return 1;
$this->product_fourn_price_id = $rowid;
$this->fourn_ref = $obj->ref_fourn;
$this->fourn_price = $obj->price;
$this->fourn_charges = $obj->charges;
$this->fourn_qty = $obj->quantity;
$this->fourn_remise_percent = $obj->remise_percent;
$this->fourn_remise = $obj->remise;
$this->fourn_unitprice = $obj->unitprice;
$this->fourn_unitcharges = $obj->unitcharges;
$this->tva_tx = $obj->tva_tx;
$this->product_id = $obj->fk_product; // deprecated
$this->fk_product = $obj->fk_product;
$this->fk_availability = $obj->fk_availability;
$this->fourn_tva_npr = $obj->fourn_tva_npr;
return 1;
}
else
{