Fix regression when adding a product with multicompany
This commit is contained in:
parent
2eddc02deb
commit
d43e043b48
@ -2236,7 +2236,7 @@ class Product extends CommonObject
|
||||
// Check parameters
|
||||
if (!$id && !$ref && !$ref_ext && !$barcode) {
|
||||
$this->error = 'ErrorWrongParameters';
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error);
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2286,7 +2286,7 @@ class Product extends CommonObject
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
if ($separatedStock) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as sp ON sp.fk_product = p.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
|
||||
}
|
||||
if ($id) {
|
||||
$sql .= " WHERE p.rowid = ".((int) $id);
|
||||
@ -2300,9 +2300,6 @@ class Product extends CommonObject
|
||||
$sql .= " AND p.barcode = '".$this->db->escape($barcode)."'";
|
||||
}
|
||||
}
|
||||
if ($separatedStock) {
|
||||
$sql .= " AND sp.fk_entrepot IN (SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
|
||||
}
|
||||
if ($separatedStock) {
|
||||
$sql .= " GROUP BY p.rowid, p.ref, p.ref_ext, p.label, p.description, p.url, p.note_public, p.note, p.customcode, p.fk_country, p.fk_state, p.lifetime, p.qc_frequency, p.price, p.price_ttc,";
|
||||
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user