* Invoices (EPL): allow to use Invoices app as viewer for e-invoices in Mail (without rights for Invoices app itself)

This commit is contained in:
ralf 2024-12-23 13:36:19 +01:00
parent 528df740e5
commit fbcedf0adf
2 changed files with 9 additions and 6 deletions

View File

@ -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);

View File

@ -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
}];
}
});