This commit is contained in:
Anthony Berton 2022-10-27 22:50:30 +02:00
parent cacb642bc0
commit 16a606ebaa

View File

@ -400,6 +400,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
} }
} }
} elseif ($thirdparty instanceof Contact) { } elseif ($thirdparty instanceof Contact) {
if ($thirdparty->socid > 0) {
$thirdparty->fetch_thirdparty(); $thirdparty->fetch_thirdparty();
$socname = $thirdparty->thirdparty->name; $socname = $thirdparty->thirdparty->name;
if (($includealias || getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) { if (($includealias || getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) {
@ -410,6 +411,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
$socname = $thirdparty->thirdparty->name." - ".$thirdparty->thirdparty->name_alias; $socname = $thirdparty->thirdparty->name." - ".$thirdparty->thirdparty->name_alias;
} }
} }
}
} else { } else {
throw new InvalidArgumentException('Parameter 1 $thirdparty is not a Societe nor Contact'); throw new InvalidArgumentException('Parameter 1 $thirdparty is not a Societe nor Contact');
} }