diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 7e9adc49a8b..39922f4f1a9 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -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; + } }