lint(stickler)

This commit is contained in:
Antonin MARCHAL 2021-04-26 20:06:45 +02:00
parent 14269ab8ee
commit 1d162cc62c
3 changed files with 15 additions and 26 deletions

View File

@ -2189,7 +2189,6 @@ class Product extends CommonObject
$separatedEntityPMP = true; $separatedEntityPMP = true;
} }
} }
//For MultiCompany Stocks Sharings stock_reel includes only stocks shared with this entity //For MultiCompany Stocks Sharings stock_reel includes only stocks shared with this entity
$separatedStock = false; $separatedStock = false;
if (!empty($conf->global->MULTICOMPANY_STOCK_SHARING_ENABLED)) { if (!empty($conf->global->MULTICOMPANY_STOCK_SHARING_ENABLED)) {
@ -2206,7 +2205,6 @@ class Product extends CommonObject
else { else {
$sql .= " p.stock,"; $sql .= " p.stock,";
} }
if ($separatedEntityPMP) { if ($separatedEntityPMP) {
$sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; $sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,";
} }
@ -2218,15 +2216,12 @@ class Product extends CommonObject
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
} }
if ($separatedEntityPMP) { if ($separatedEntityPMP) {
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "entity_product_pmp as ppe ON ppe.fk_product = p.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "entity_product_pmp as ppe ON ppe.fk_product = p.rowid";
} }
if ($separatedStock) { 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";
} }
if ($id) { if ($id) {
$sql .= " WHERE p.rowid = ".((int) $id); $sql .= " WHERE p.rowid = ".((int) $id);
} else { } else {
@ -2239,11 +2234,9 @@ class Product extends CommonObject
$sql .= " AND p.barcode = '".$this->db->escape($barcode)."'"; $sql .= " AND p.barcode = '".$this->db->escape($barcode)."'";
} }
} }
if ($separatedEntityPMP) { if ($separatedEntityPMP) {
$sql .= " AND ppe.entity = " . (int) $conf->entity; $sql .= " AND ppe.entity = " . (int) $conf->entity;
} }
if ($separatedStock) { if ($separatedStock) {
$sql .= " AND sp.fk_entrepot IN ( $sql .= " AND sp.fk_entrepot IN (
SELECT rowid SELECT rowid

View File

@ -633,15 +633,11 @@ class Entrepot extends CommonObject
if ($separatedPMP) { if ($separatedPMP) {
$sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe";
} }
$sql .= " WHERE ps.fk_entrepot = ".$this->id; $sql .= " WHERE ps.fk_entrepot = ".$this->id;
if ($separatedPMP) { if ($separatedPMP) {
$sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity;
} }
$sql .= " AND ps.fk_product = p.rowid"; $sql .= " AND ps.fk_product = p.rowid";
//print $sql; //print $sql;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {