diff --git a/CRM/Certificate/Service/CertificateDownloader.php b/CRM/Certificate/Service/CertificateDownloader.php index 719372d..2746dff 100644 --- a/CRM/Certificate/Service/CertificateDownloader.php +++ b/CRM/Certificate/Service/CertificateDownloader.php @@ -1,5 +1,6 @@ certificate->download_type == DownloadType::FILE_DOWNLOAD) { + $file = \CRM_Core_BAO_File::getEntityFile(CRM_Certificate_DAO_CompuCertificate::getTableName(), $this->certificate->id); + if (!empty($file)) { + CRM_Utils_System::redirect(end($file)['url']); + } + return; + } + $generatedTemplate = $this->certificateGenerator->generate($this->certificate->template_id, $this->contactId, $this->entityId); return $this->render($generatedTemplate); }