From 02ebcdfed2717c8a65ba65fdbdd0924c0fbf7aa5 Mon Sep 17 00:00:00 2001 From: eldy Date: Sun, 9 Oct 2011 20:12:05 +0200 Subject: [PATCH] New: Add label of project with ref on element pages --- htdocs/core/class/html.form.class.php | 17 ++++++++++------- htdocs/projet/class/project.class.php | 7 ++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 67e27610c42..34a5aded138 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2239,10 +2239,10 @@ class Form /** * Show a form to select a project * - * @param page Page - * @param socid Id societe - * @param selected Id projet pre-selectionne - * @param htmlname Nom du formulaire select + * @param int $page Page + * @param int $socid Id third party + * @param int $selected Id pre-selected project + * @param string $htmlname Name of select field * @return void */ function form_project($page, $socid, $selected='', $htmlname='projectid') @@ -2267,12 +2267,15 @@ class Form } else { - if ($selected) { + if ($selected) + { $projet = new Project($this->db); $projet->fetch($selected); //print ''.$projet->title.''; - print $projet->getNomUrl(0); - } else { + print $projet->getNomUrl(0,'',1); + } + else + { print " "; } } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b12edb2fb37..4583e20a4a5 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -634,10 +634,11 @@ class Project extends CommonObject * Renvoie nom clicable (avec eventuellement le picto) * * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * @param string $option Variante ('', 'nolink') + * @param string $option Variant ('', 'nolink') + * @param int $addlabel 0=Default, 1=Add label into string * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0,$option='',$addlabel=0) { global $langs; @@ -658,7 +659,7 @@ class Project extends CommonObject if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; + if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin.(($addlabel && $this->title)?' - '.$this->title:''); return $result; }