From f0f9e5fb53112c8ec031812d2f643cd5f8e92321 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Dec 2010 02:04:41 +0000 Subject: [PATCH] Fix: Link to source was wrong --- htdocs/comm/mailing/cibles.php | 37 ++++++++++++++++++++++++-- htdocs/societe/class/societe.class.php | 5 ++-- htdocs/user/class/user.class.php | 5 ++-- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 18f399067f5..96b6e8b9f07 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -417,7 +417,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0) print ''; print ' '; print ''; - // Url + // Source print ''; print ''; print '  '; @@ -439,7 +439,40 @@ if ($mil->fetch($_REQUEST["id"]) >= 0) print ''.$obj->nom.''; print ''.$obj->prenom.''; print ''.$obj->other.''; - print ''.$obj->source_url.''; + print ''; + if (empty($obj->source_id) || empty($obj->source_type)) + { + print $obj->source_url; // For backward compatibility + } + else + { + if ($obj->source_type == 'member') + { + include_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'); + $m=new Adherent($db); + $m->id=$obj->source_id; + print $m->getNomUrl(2); + } + else if ($obj->source_type == 'user') + { + include_once(DOL_DOCUMENT_ROOT.'/user/class/user.class.php'); + $m=new User($db); + $m->id=$obj->source_id; + print $m->getNomUrl(2); + } + else if ($obj->source_type == 'thirdparty') + { + include_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'); + $m=new Societe($db); + $m->id=$obj->source_id; + print $m->getNomUrl(2); + } + else + { + print $obj->source_url; + } + } + print ''; // Statut pour l'email destinataire (Attentioon != statut du mailing) if ($obj->statut == 0) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 214c0909495..7c8b4e25d5f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1294,7 +1294,7 @@ class Societe extends CommonObject /** * \brief Renvoie nom clicable (avec eventuellement le picto) - * \param withpicto Inclut le picto dans le lien + * \param withpicto Inclut le picto dans le lien (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) * \param option Sur quoi pointe le lien ('', 'customer', 'supplier', 'compta') * \param maxlen Longueur max libelle * \return string Chaine avec URL @@ -1330,7 +1330,8 @@ class Societe extends CommonObject $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'">'; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$this->nom,'company').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$this->nom,'company').$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($this->nom,$maxlen):$this->nom).$lienfin; return $result; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 59db5e91add..23ec2bf6d22 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1482,7 +1482,7 @@ class User extends CommonObject /** * \brief Return a link to the user card (with optionnaly the picto) - * \param withpicto Include picto in link + * \param withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) * \param option On what the link point to * \return string String with URL * \remarks Use this->id,this->nom, this->prenom @@ -1502,7 +1502,8 @@ class User extends CommonObject $lienfin=''; } - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.$this->getFullName($langs).$lienfin; return $result; }