diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 7cb641c77f9..d8cc8d554a2 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -174,7 +174,6 @@ if ($action == 'update') { if (GETPOSTISSET('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) { dolibarr_set_const($db, "PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", GETPOST('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); } - if (GETPOSTISSET('PDF_USE_A')) { dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity); } @@ -400,6 +399,13 @@ if ($conf->use_javascript_ajax) { } print ''; +// Show alias in thirdparty name +print ''.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").''; +if ($conf->use_javascript_ajax) { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY")); + print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')); +} + print ''; print ''; @@ -584,16 +590,6 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("DOC_SHOW_FIRST_SALES_REP", $arrval, $conf->global->DOC_SHOW_FIRST_SALES_REP); } -// Show alias in thirdparty name - -/* Disabled because not yet completely implemented (does not work when we force a contact on object) -print ''.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").''; -if ($conf->use_javascript_ajax) { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY")); - print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')); -} -*/ - // Show online payment link on invoices print ''.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").''; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index f71a6ed6d3c..789a65b93e4 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -12,7 +12,7 @@ * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2019 Lenin Rivas * Copyright (C) 2020 Nicolas ZABOURI - * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2021-2022 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -400,9 +400,16 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali } } } elseif ($thirdparty instanceof Contact) { - $socname = $thirdparty->socname; - if (($includealias || getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->name_alias)) { - // TODO PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME not completely implemented + if ($thirdparty->socid > 0) { + $thirdparty->fetch_thirdparty(); + $socname = $thirdparty->thirdparty->name; + if (($includealias || getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) { + if (getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME') == 2) { + $socname = $thirdparty->thirdparty->name_alias." - ".$thirdparty->thirdparty->name; + } else { + $socname = $thirdparty->thirdparty->name." - ".$thirdparty->thirdparty->name_alias; + } + } } } else { throw new InvalidArgumentException('Parameter 1 $thirdparty is not a Societe nor Contact'); diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 69f077d628f..df358b0bfd1 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2189,6 +2189,7 @@ ShowProjectLabel=Libellé du projet PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME=Inclure un alias dans le nom du tiers THIRDPARTY_ALIAS=Nom du tiers - Alias du tiers ALIAS_THIRDPARTY=Alias du tiers - Nom du tiers +MAIN_USE_COMPANY_NAME_OF_CONTACT=Use company name of contact PDF_USE_ALSO_LANGUAGE_CODE=Si vous souhaitez que certains textes de votre PDF soient dupliqués dans 2 langues différentes dans le même PDF généré, vous devez définir ici cette deuxième langue pour que le PDF généré contienne 2 langues différentes dans la même page, celle choisie lors de la génération du PDF et celle-ci (seuls quelques modèles PDF prennent en charge cette fonction). Gardez vide pour 1 langue par PDF. PDF_USE_A=Générer document PDF avec le format PDF/A à la place du format PDF standard FafaIconSocialNetworksDesc=Entrez ici le code d'une icône FontAwesome. Si vous ne savez pas ce qu'est FontAwesome, vous pouvez utiliser la valeur générique fa-address-book.