Merge pull request #12399 from defrance/patch-145

NEW add PDF certificate if present on document folder
This commit is contained in:
Laurent Destailleur 2020-04-13 16:23:10 +02:00 committed by GitHub
commit 7178fbc358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -355,7 +355,24 @@ 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);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// 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' => 'INVOICE',
'ContactInfo' => $this->emetteur->email
);
$pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// Set $this->atleastonediscount if you have at least one discount
for ($i = 0; $i < $nblines; $i++)