Fix some merge action bugs:

- default document wasn't working properly, missing caption
- Email documents were giving "Unable to generate merge file"
This commit is contained in:
nathan 2021-10-01 10:06:29 -06:00
parent 806aa542a1
commit 71ef7ccd0d

View File

@ -2144,11 +2144,11 @@ abstract class Merge
$file['path'] = $default_doc; $file['path'] = $default_doc;
} }
$documents['document'] = array( $documents['document'] = array(
'icon' => Api\Vfs::mime_icon($file['mime']), 'icon' => Api\Vfs::mime_icon($file['mime']),
'caption' => Api\Vfs::decodePath(Api\Vfs::basename($default_doc)), 'caption' => Api\Vfs::decodePath(Api\Vfs::basename($default_doc)),
'group' => 1, 'group' => 1
'postSubmit' => true, // download needs post submit (not Ajax) to work
); );
self::document_editable_action($documents['document'], $file);
if ($file['mime'] == 'message/rfc822') if ($file['mime'] == 'message/rfc822')
{ {
self::document_mail_action($documents['document'], $file); self::document_mail_action($documents['document'], $file);
@ -2303,6 +2303,7 @@ abstract class Merge
private static function document_mail_action(Array &$action, $file) private static function document_mail_action(Array &$action, $file)
{ {
unset($action['postSubmit']); unset($action['postSubmit']);
unset($action['onExecute']);
// Lots takes a while, confirm // Lots takes a while, confirm
$action['confirm_multiple'] = lang('Do you want to send the message to all selected entries, WITHOUT further editing?'); $action['confirm_multiple'] = lang('Do you want to send the message to all selected entries, WITHOUT further editing?');
@ -2347,12 +2348,18 @@ abstract class Merge
'document' => $file['path'], 'document' => $file['path'],
'merge' => get_called_class(), 'merge' => get_called_class(),
); );
$action = array_merge($action_base, $action, array(
'icon' => Api\Vfs::mime_icon($file['mime']), $action = array_merge(
'caption' => Api\Vfs::decodePath($file['name']), $action_base,
'onExecute' => 'javaScript:app.' . $GLOBALS['egw_info']['flags']['currentapp'] . '.merge', array(
'merge_data' => $edit_attributes 'icon' => Api\Vfs::mime_icon($file['mime']),
)); 'caption' => Api\Vfs::decodePath($file['name']),
'onExecute' => 'javaScript:app.' . $GLOBALS['egw_info']['flags']['currentapp'] . '.merge',
'merge_data' => $edit_attributes
),
// Merge in provided action last, so we can customize if needed (eg: default document)
$action
);
} }
/** /**