diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 640db9bc372..598c4c73945 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -951,8 +951,8 @@ class BOM extends CommonObject
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.((int) $this->id)));
if (is_numeric($result)) {
- $this->error = $this->error;
- $this->errors = $this->errors;
+ $this->error = $objectline->error;
+ $this->errors = $objectline->errors;
return $result;
} else {
$this->lines = $result;
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index b30ed58e697..a5a3dbcad39 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4740,7 +4740,7 @@ if ($action == 'create') {
}
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2
print '
| '.$langs->transcountry("AmountLT2", $mysoc->country_code).' | ';
- print ''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).' |
';
+ print ''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).' | ';
}
// Revenue stamp
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index 790a7aace44..f42563ceb19 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -528,7 +528,7 @@ class Productbatch extends CommonObject
$sql .= " FROM ".$this->db->prefix()."product_lot as pl";
$sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = pl.fk_product";
$sql .= " LEFT JOIN ".$this->db->prefix()."product_batch AS pb ON pl.batch = pb.batch";
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock AS ps ON ps.rowid = pb.fk_product_stock";
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock AS ps ON ps.rowid = pb.fk_product_stock AND ps.fk_product = ".((int) $fk_product);
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND pl.fk_product = ".((int) $fk_product);
if ($fk_warehouse > 0) {