Merge pull request #22242 from fboitel/fboitel-dev-scrutinizer-12/09/2022

Fix scrutinizer 3
This commit is contained in:
Laurent Destailleur 2022-09-20 01:34:11 +02:00 committed by GitHub
commit 821d22e94d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 17 deletions

View File

@ -973,7 +973,7 @@ class Delivery extends CommonObject
$sqlSourceLine .= ", p.ref, p.label";
$sqlSourceLine .= " FROM ".MAIN_DB_PREFIX.$this->linkedObjectsIds[0]['type']."det as st";
$sqlSourceLine .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON st.fk_product = p.rowid";
$sqlSourceLine .= " WHERE fk_".$this->linked_object[0]['type']." = ".((int) $this->linked_object[0]['linkid']);
$sqlSourceLine .= " WHERE fk_".$this->linked_objects[0]['type']." = ".((int) $this->linked_objects[0]['linkid']);
$resultSourceLine = $this->db->query($sqlSourceLine);
if ($resultSourceLine) {
@ -986,12 +986,12 @@ class Delivery extends CommonObject
// Get lines of sources alread delivered
$sql = "SELECT ld.fk_origin_line, sum(ld.qty) as qty";
$sql .= " FROM ".MAIN_DB_PREFIX."deliverydet as ld, ".MAIN_DB_PREFIX."delivery as l,";
$sql .= " ".MAIN_DB_PREFIX.$this->linked_object[0]['type']." as c";
$sql .= ", ".MAIN_DB_PREFIX.$this->linked_object[0]['type']."det as cd";
$sql .= " ".MAIN_DB_PREFIX.$this->linked_objects[0]['type']." as c";
$sql .= ", ".MAIN_DB_PREFIX.$this->linked_objects[0]['type']."det as cd";
$sql .= " WHERE ld.fk_delivery = l.rowid";
$sql .= " AND ld.fk_origin_line = cd.rowid";
$sql .= " AND cd.fk_".$this->linked_object[0]['type']." = c.rowid";
$sql .= " AND cd.fk_".$this->linked_object[0]['type']." = ".((int) $this->linked_object[0]['linkid']);
$sql .= " AND cd.fk_".$this->linked_objects[0]['type']." = c.rowid";
$sql .= " AND cd.fk_".$this->linked_objects[0]['type']." = ".((int) $this->linked_objects[0]['linkid']);
$sql .= " AND ld.fk_origin_line = ".((int) $objSourceLine->rowid);
$sql .= " GROUP BY ld.fk_origin_line";

View File

@ -120,13 +120,12 @@ class ExpenseReportIk extends CommonObject
public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
return $result;
}
/**
* Update object into database
*

View File

@ -171,6 +171,19 @@ class ExpenseReportRule extends CommonObject
}
/**
* Load object lines in memory from the database
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetchLines()
{
$this->lines = array();
$result = $this->fetchLinesCommon();
return $result;
}
/**
* Update object into database
*

View File

@ -198,15 +198,15 @@ if ($action=='downfield' || $action=='upfield')
}
}
*/
if ($action == 'builddoc') {
// Build import file
$result = $objimport->build_file($user, GETPOST('model', 'alpha'), $datatoimport, $array_match_file_to_database);
if ($result < 0) {
setEventMessages($objimport->error, $objimport->errors, 'errors');
} else {
setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs');
}
}
// if ($action == 'builddoc') {
// // Build import file
// $result = $objimport->build_file($user, GETPOST('model', 'alpha'), $datatoimport, $array_match_file_to_database);
// if ($result < 0) {
// setEventMessages($objimport->error, $objimport->errors, 'errors');
// } else {
// setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs');
// }
// }
if ($action == 'deleteprof') {
if (GETPOST("id", 'int')) {