From 0cc8e6873ffd10bd679e4c976e2979f59feb0b72 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:44:47 +0100 Subject: [PATCH 1/4] add attribute target on getNomurl() --- htdocs/societe/class/societe.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a49bf478763..319c4dbfa46 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2529,9 +2529,10 @@ class Societe extends CommonObject * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $noaliasinname 1=Do not add alias into the link ref + * @param string $target add attribute target * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0) + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target='_self') { global $conf, $langs, $hookmanager; @@ -2703,6 +2704,10 @@ class Societe extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip refurl"'; + $target_value=array('_self','_blank','_parent','_top',); + if(in_array($target,$target_value)){ + $linkclose .= ' target="'.$target.'"'; + } /* $hookmanager->initHooks(array('thirdpartydao')); From 7e6279e94236d9c6e1b0a249f4c0bcf55bf99989 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 4 Feb 2022 13:48:25 +0000 Subject: [PATCH 2/4] Fixing style errors. --- htdocs/societe/class/societe.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 319c4dbfa46..48d43a34a4f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2532,7 +2532,7 @@ class Societe extends CommonObject * @param string $target add attribute target * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target='_self') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '_self') { global $conf, $langs, $hookmanager; @@ -2705,8 +2705,8 @@ class Societe extends CommonObject $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip refurl"'; $target_value=array('_self','_blank','_parent','_top',); - if(in_array($target,$target_value)){ - $linkclose .= ' target="'.$target.'"'; + if (in_array($target, $target_value)) { + $linkclose .= ' target="'.$target.'"'; } /* From 1bc80df6438a3a4433f2e42afce85fa7cf073920 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Tue, 15 Feb 2022 09:32:27 +0100 Subject: [PATCH 3/4] keep the default value for target in getnomurl to '' --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 48d43a34a4f..bb475a03fdd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2532,7 +2532,7 @@ class Societe extends CommonObject * @param string $target add attribute target * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '_self') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '') { global $conf, $langs, $hookmanager; From d38df4b8a0ab1d55fc084926efe6edd178a6a945 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 17:11:32 +0100 Subject: [PATCH 4/4] Update societe.class.php --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bb475a03fdd..b7e9dd61a84 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2704,9 +2704,9 @@ class Societe extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip refurl"'; - $target_value=array('_self','_blank','_parent','_top',); + $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { - $linkclose .= ' target="'.$target.'"'; + $linkclose .= ' target="'.dol_escape_htmltag($target).'"'; } /*