Standardize code

This commit is contained in:
Laurent Destailleur
2025-04-24 00:51:47 +02:00
parent 1435c02986
commit e034b4b0ef
5 changed files with 38 additions and 14 deletions

View File

@@ -5354,8 +5354,8 @@ abstract class CommonObject
print "<!-- begin printObjectLines() -->\n";
foreach ($this->lines as $line) {
//Line extrafield
$line->fetch_optionals();
// Line extrafield. TODO Remove this. extrafields should be already loaded.
//$line->fetch_optionals();
if (is_object($hookmanager)) {
if (empty($line->fk_parent_line)) {
@@ -5366,7 +5366,7 @@ abstract class CommonObject
$reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
}
if (empty($reshook) && $buyer !== null) {
if (empty($reshook)) {
$this->printObjectLine($action, $line, '', $num, $i, $dateSelector, $seller, $buyer, $selected, $extrafields, $defaulttpldir);
}
@@ -5387,7 +5387,7 @@ abstract class CommonObject
* @param int $i I
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param ?Societe $buyer Object of buyer third party
* @param int $selected ID line selected
* @param ?ExtraFields $extrafields Object of extrafields
* @param string $defaulttpldir Directory where to find the template (deprecated)
@@ -6348,7 +6348,6 @@ abstract class CommonObject
$sql .= " WHERE type_object = '".$this->db->escape($element)."'";
$sql .= " AND fk_object = ".((int) $this->id);
//dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
@@ -10716,11 +10715,10 @@ abstract class CommonObject
'@phan-var-force CommonObjectLine $newline';
$newline->setVarsFromFetchObj($obj);
// Note: extrafields load of line not yet supported
/*
if (empty($noextrafields)) {
// Load extrafields of line
}*/
// Load also extrafields for the line
if (empty($noextrafields)) {
$newline->fetch_optionals();
}
$this->lines[] = $newline;
}