From 33d5fa38efcc82efb610c5017401e2ce48a822aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Feb 2016 13:29:37 +0100 Subject: [PATCH] Fix pdfBuildThirdpartyName must return main name. Alias should be an option. --- htdocs/core/lib/pdf.lib.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 62a92f4d5ac..34ff6103f11 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -340,22 +340,21 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) /** * Returns the name of the thirdparty * - * @param Societe|Contact $thirdparty Contact or thirdparty - * @param Translate $outputlangs Output language + * @param Societe|Contact $thirdparty Contact or thirdparty + * @param Translate $outputlangs Output language + * @param int $includealias 1=Include alias name after name * @return string */ -function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs) +function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0) { - //Recipient name + // Recipient name $socname = ''; - // On peut utiliser le nom de la societe du contact if ($thirdparty instanceof Societe) { - if (!empty($thirdparty->name_alias)) { - $socname = $thirdparty->name_alias."\n"; - } - $socname .= $thirdparty->name; + if ($includealias && !empty($thirdparty->name_alias)) { + $socname .= "\n".$thirdparty->name_alias; + } } elseif ($thirdparty instanceof Contact) { $socname = $thirdparty->socname; } else {