Skip to content
Snippets Groups Projects
Commit c307a63c authored by Damien's avatar Damien
Browse files

[FEAT] [PARA V2] display converted pdf for incoming Mail Attachments

parent fc2303ce
No related branches found
No related tags found
No related merge requests found
......@@ -80,8 +80,8 @@
<sup *ngIf="!showTopLeftPanel" class="nbRes" style="position: absolute;right: 6px;top: 5px;">{{signatureBook.documents.length - 1}}</sup>
<i *ngIf="showTopLeftPanel" class="fa fa-chevron-up" aria-hidden="true"></i>
</div>
<iframe *ngIf="leftViewerLink != '' && (signatureBook.documents[leftSelectedThumbnail].format == 'pdf' || leftSelectedThumbnail == 0)" id="leftPanelShowDocumentIframe" [src]="leftViewerLink | safeUrl" [ngStyle]="{'height': showTopLeftPanel ? '84%' : '99%'}"></iframe>
<div *ngIf="signatureBook.documents[leftSelectedThumbnail].format != 'pdf' && leftSelectedThumbnail > 0" [ngStyle]="{'height': showTopLeftPanel ? '79%' : '96%'}" class="visaNoPdfWarning">
<iframe *ngIf="leftViewerLink != '' && (leftSelectedThumbnail == 0 || signatureBook.documents[leftSelectedThumbnail].format == 'pdf' || signatureBook.documents[leftSelectedThumbnail].isConverted)" id="leftPanelShowDocumentIframe" [src]="leftViewerLink | safeUrl" [ngStyle]="{'height': showTopLeftPanel ? '84%' : '99%'}"></iframe>
<div *ngIf="leftSelectedThumbnail > 0 && signatureBook.documents[leftSelectedThumbnail].format != 'pdf' && !signatureBook.documents[leftSelectedThumbnail].isConverted" [ngStyle]="{'height': showTopLeftPanel ? '79%' : '96%'}" class="visaNoPdfWarning">
<div style="padding-top: 25%;">Aucun aperçu disponible<br/><sub>La version PDF de ce format n'a pas été trouvée.</sub></div>
<div class="visaPjView">
<a title="Télécharger la pièce jointe" href="index.php?display=true&module=attachments&page=view_attachment&res_id_master={{resId}}&id={{signatureBook.documents[leftSelectedThumbnail].res_id}}" target="_blank">
......
......@@ -202,8 +202,8 @@ class VisaController
$incomingMailAttachments = \ResModel::getAvailableLinkedAttachmentsIn([
'resIdMaster' => $resId,
'in' => ['incoming_mail_attachment'],
'select' => ['res_id', 'title', 'format']
'in' => ['incoming_mail_attachment', 'converted_pdf'],
'select' => ['res_id', 'res_id_version', 'title', 'format', 'attachment_type', 'path', 'filename']
]);
$documents = [
......@@ -216,11 +216,33 @@ class VisaController
]
];
foreach ($incomingMailAttachments as $value) {
if ($value['attachment_type'] == 'converted_pdf') {
continue;
}
$realId = 0;
if ($value['res_id'] == 0) {
$realId = $value['res_id_version'];
} elseif ($value['res_id_version'] == 0) {
$realId = $value['res_id'];
}
$viewerId = $realId;
$pathToFind = $value['path'] . str_replace(strrchr($value['filename'], '.'), '.pdf', $value['filename']);
$isConverted = false;
foreach ($incomingMailAttachments as $tmpKey => $tmpValue) {
if ($tmpValue['attachment_type'] == 'converted_pdf' && ($tmpValue['path'] . $tmpValue['filename'] == $pathToFind)) {
$viewerId = $tmpValue['res_id'];
$isConverted = true;
}
}
$documents[] = [
'res_id' => $value['res_id'],
'title' => $value['title'],
'format' => $value['format'],
'viewerLink' => "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master={$resId}&id={$value['res_id']}",
'isConverted' => $isConverted,
'viewerLink' => "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master={$resId}&id={$viewerId}",
'thumbnailLink' => "index.php?page=doc_thumb&module=thumbnails&res_id={$value['res_id']}&coll_id=attachments_coll&display=true&advanced=true"
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment