From 99cbb273c8fd1a606753d128a0d80d591b068aa7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Apr 2020 16:21:47 +0200 Subject: [PATCH] Update pdf_crabe.modules.php --- .../core/modules/facture/doc/pdf_crabe.modules.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 986b0de2b88..e816c6460d9 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -357,15 +357,18 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $cert=file_get_contents(DOL_DATA_ROOT."/users/".$user->id."/certificates/signature.crt"); - // si l'utilisateur n'a pas de certificat, on prend le certificat - if (!$cert) - $cert=file_get_contents(DOL_DATA_ROOT."/mycompany/certificates/signature.crt"); + // Set certificate + $cert=empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + // If use has no certificate, we try to take the company one + if (!$cert) { + $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; + } + // If a certificate is found if ($cert) { $info = array( 'Name' => $this->emetteur->name, 'Location' => getCountry($this->emetteur->country_code, 0), - 'Reason' => 'FACTURE', + 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);