fix(code)eldy's remarks
This commit is contained in:
parent
b573d81e45
commit
5fd0c1b810
@ -436,3 +436,6 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity
|
||||
|
||||
UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1;
|
||||
|
||||
-- For MultiCompany PMP per entity
|
||||
ALTER TABLE llx_product_perentity ADD pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export
|
||||
|
||||
|
||||
@ -604,7 +604,7 @@ if ($action == 'create') {
|
||||
|
||||
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,";
|
||||
if ($separatedPMP) {
|
||||
$sql .= " ppe.pmp as ppmp,";
|
||||
$sql .= " pa.pmp as ppmp,";
|
||||
} else {
|
||||
$sql .= " p.pmp as ppmp,";
|
||||
}
|
||||
@ -615,7 +615,7 @@ if ($action == 'create') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
|
||||
|
||||
if ($separatedPMP) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa";
|
||||
}
|
||||
|
||||
$sql .= " WHERE ps.fk_product = p.rowid";
|
||||
@ -623,7 +623,7 @@ if ($action == 'create') {
|
||||
$sql .= " AND ps.fk_entrepot = ".$object->id;
|
||||
|
||||
if ($separatedPMP) {
|
||||
$sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity;
|
||||
$sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity;
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -621,18 +621,18 @@ class Entrepot extends CommonObject
|
||||
}
|
||||
|
||||
if ($separatedPMP) {
|
||||
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ppe.pmp) as value";
|
||||
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * pa.pmp) as value";
|
||||
} else {
|
||||
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product as p";
|
||||
if ($separatedPMP) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa";
|
||||
}
|
||||
$sql .= " WHERE ps.fk_entrepot = ".$this->id;
|
||||
if ($separatedPMP) {
|
||||
$sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity;
|
||||
$sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity;
|
||||
}
|
||||
$sql .= " AND ps.fk_product = p.rowid";
|
||||
//print $sql;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user