add certificate if present on document folder

This commit is contained in:
BENKE Charlene 2019-11-09 15:20:36 +01:00 committed by GitHub
parent ab26356e92
commit 53fd8328bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -357,6 +357,20 @@ 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");
if ($cert) {
$info = array(
'Name' => $this->emetteur->name,
'Location' => getCountry($this->emetteur->country_code, 0),
'Reason' => 'FACTURE',
'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