From fbcedf0adfb4b900cfa42c356ed2ac4da7d7c113 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 23 Dec 2024 13:36:19 +0100 Subject: [PATCH] * Invoices (EPL): allow to use Invoices app as viewer for e-invoices in Mail (without rights for Invoices app itself) --- mail/inc/class.mail_ui.inc.php | 6 ++++-- mail/js/app.js | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 76a2cc219c..984bfd6552 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2638,8 +2638,10 @@ $filter['before']= date("d-M-Y", $cutoffdate2); if (empty($attachmentHTML[$key]['mime_data'])) { $attachmentHTML[$key]['mime_url'] = Egw::link('/index.php',$linkData); - // always check invoices too and then add mime_data unconditionally - if (Link::get_mime_info($attachmentHTML[$key]['type'], 'invoices')) + + // always check invoices (or it's EPL viewer) too and then add mime_data unconditionally + if (Link::get_mime_info($attachmentHTML[$key]['type'], + !empty($GLOBALS['egw_info']['user']['apps']['invoices']) ? 'invoices' : 'stylite')) { $attachmentHTML[$key]['mime_data'] = Link::set_data($value['mimeType'], 'EGroupware\\Api\\Mail::getAttachmentAccount', [$acc_id, $mailbox, $uid, $value['partID'], $value['is_winmail'] ?? false, true], true); diff --git a/mail/js/app.js b/mail/js/app.js index a21ad76cc8..71715e0451 100755 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1264,14 +1264,15 @@ app.classes.mail = AppJS.extend( sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [collabora, ...actions]; } } - // if mime-type is supported by invoices, add it at the end - if (egw.get_mime_info(_item.type, 'invoices')) + // if mime-type is supported by invoices (or the EPL viewer), add it at the end + const invoices_app = this.egw.user('apps')['invoices'] ? 'invoices' : 'stylite'; + if (egw.get_mime_info(_item.type, invoices_app)) { sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [...actions, { - id: 'invoices', + id: invoices_app, label: 'invoices', icon: 'invoices/navbar', - value: 'invoices' + value: invoices_app }]; } });