Fix use of extrafield of type link with CommonObjectLine (#29957)
* define default getNomUrl() in CommonObjectLine class * Fix mistakes (pre-commit...) and precise function description * Fix CommonObjectLine::getNomUrl to be useable with existing * Update commonobjectline.class.php * Update commonobjectline.class.php * Update commonobjectline.class.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
1857b22aed
commit
f2b33ffd55
1 changed files with 21 additions and 0 deletions
|
|
@ -330,4 +330,25 @@ abstract class CommonObjectLine extends CommonObject
|
|||
{
|
||||
return -1; // NOK because nothing done.
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable link of object line (with eventually picto)
|
||||
* May (should) also return information about the associated "parent" object.
|
||||
* To overload
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0)
|
||||
{
|
||||
$parent_element_properties = getElementProperties($this->parent_element);
|
||||
$parent_classname = $parent_element_properties['classname'];
|
||||
$parent_element = new $parent_classname($this->db);
|
||||
$parentattribute = $this->fk_parent_attribute;
|
||||
if ($parentattribute) {
|
||||
$parent_element->fetch($this->$parentattribute);
|
||||
}
|
||||
|
||||
return $parent_element->getNomUrl($withpicto).' - Line #'.$this->id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue