diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ff21ea70bbb..85eda032d42 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4514,6 +4514,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr { $product->get_buyprice($idprodfournprice,0,0,0); $ret=$product->vatrate_supplier; + if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')'; } else { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8703350c737..6c5ebdd6e81 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1520,6 +1520,7 @@ class Product extends CommonObject // We do a first seach with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref) $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,"; $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression"; + $sql.= " ,pfp.default_vat_code"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$prodfournprice; if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; @@ -1555,6 +1556,7 @@ class Product extends CommonObject $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier + $this->default_vat_code = $obj->default_vat_code; // Vat code supplier $result=$obj->fk_product; return $result; } @@ -1563,6 +1565,7 @@ class Product extends CommonObject // We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc. $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression"; + $sql.= " ,pfp.default_vat_code"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.fk_product = ".$product_id; if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'"; @@ -1602,6 +1605,7 @@ class Product extends CommonObject $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier + $this->default_vat_code = $obj->default_vat_code; // Vat code supplier $result=$obj->fk_product; return $result; } diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index b707b3f19a6..8332da36eaa 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -51,7 +51,6 @@ $search_dateyear = GETPOST('search_dateyear', 'int'); $search_datemonth = GETPOST('search_datemonth', 'int'); $search_dateday = GETPOST('search_dateday', 'int'); $search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); -if (GETPOST('search_date', 'alpha')) $search_date = dol_stringtotime(GETPOST('search_date', 'alpha')); // For backward compatibility $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); @@ -63,7 +62,6 @@ if ($page < 0) $page = 0; $offset = $limit * $page; - /* * Actions */