From 95aabd6ae3aa0c2b1eac72ec908a6b20190b82e8 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:38:34 +0100 Subject: [PATCH 1/6] add target attribute on getNomUrl --- htdocs/commande/class/commande.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c315a4fcd61..52938320bd6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3659,9 +3659,10 @@ class Commande extends CommonOrder * @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 $addlinktonotes Add link to notes + * @param string target attribute target for link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target='_self') { global $conf, $langs, $user; @@ -3730,6 +3731,11 @@ class Commande extends CommonOrder } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip"'; + + $target_value=array('_self','_blank','_parent','_top',); + if(in_array($target,$target_value)){ + $linkclose .= ' target="'.$target.'"'; + } } $linkstart = ' Date: Fri, 4 Feb 2022 13:42:07 +0000 Subject: [PATCH 2/6] Fixing style errors. --- htdocs/commande/class/commande.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 52938320bd6..42dad969086 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3662,7 +3662,7 @@ class Commande extends CommonOrder * @param string target attribute target for link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target='_self') + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target = '_self') { global $conf, $langs, $user; @@ -3731,10 +3731,10 @@ class Commande extends CommonOrder } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip"'; - + $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 993e0d852c45b62a81eb0fbab551a65fac013c38 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Fri, 4 Feb 2022 15:01:32 +0100 Subject: [PATCH 3/6] fix parameter name --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 42dad969086..cae5b638a0b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3659,7 +3659,7 @@ class Commande extends CommonOrder * @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 $addlinktonotes Add link to notes - * @param string target attribute target for link + * @param string $target attribute target for link * @return string String with URL */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target = '_self') From 4808442bc8325dd37daf9b91023ce4e78a099a76 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Tue, 15 Feb 2022 09:34:51 +0100 Subject: [PATCH 4/6] keep the default value for target in getnomurl to '' --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cae5b638a0b..c0f460935e6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3662,7 +3662,7 @@ class Commande extends CommonOrder * @param string $target attribute target for link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target = '_self') + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target = '') { global $conf, $langs, $user; From 660aa7b282fc3a008ea747dec77d7613079b67e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 17:10:00 +0100 Subject: [PATCH 5/6] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c0f460935e6..a656c34ca79 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3732,7 +3732,7 @@ class Commande extends CommonOrder $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip"'; - $target_value=array('_self','_blank','_parent','_top',); + $target_value=array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { $linkclose .= ' target="'.$target.'"'; } From d0ca8af6ee7334c6a97e13ac2dace4f02198fa84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 17:10:28 +0100 Subject: [PATCH 6/6] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a656c34ca79..042a1f219cd 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3734,7 +3734,7 @@ class Commande extends CommonOrder $target_value=array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { - $linkclose .= ' target="'.$target.'"'; + $linkclose .= ' target="'.dol_escape_htmltag($target).'"'; } }