From 2859ff46b53a4f96e902ec5912d038bcdd589d4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Jun 2021 12:08:11 +0200 Subject: [PATCH] Fix link of type of membership --- .../adherents/class/adherent_type.class.php | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 1cb9fcdb12c..ad24b9f1c05 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -656,19 +656,19 @@ class AdherentType extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $maxlen length max label - * @param int $notooltip 1=Disable tooltip - * @return string String with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $maxlen length max label + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ - public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $langs; $result = ''; - $label = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("MemberType").''; $label .= ' '.$this->getLibStatut(4); $label .= '
'.$langs->trans("Label").': '.$this->label; @@ -676,7 +676,22 @@ class AdherentType extends CommonObject $label .= '
'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription); } - $linkstart = ''; + $option = ''; + + $url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id); + + if ($option != 'nolink') { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { + $add_save_lastsearch_values = 1; + } + if ($add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } + } + + $linkstart = ''; $linkend = ''; $result .= $linkstart;