From 71ef7ccd0dba188e4380fee1441e985d5a6ce879 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 1 Oct 2021 10:06:29 -0600 Subject: [PATCH] Fix some merge action bugs: - default document wasn't working properly, missing caption - Email documents were giving "Unable to generate merge file" --- api/src/Storage/Merge.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/api/src/Storage/Merge.php b/api/src/Storage/Merge.php index 0b738c062e..eddafce704 100644 --- a/api/src/Storage/Merge.php +++ b/api/src/Storage/Merge.php @@ -2144,11 +2144,11 @@ abstract class Merge $file['path'] = $default_doc; } $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)), - 'group' => 1, - 'postSubmit' => true, // download needs post submit (not Ajax) to work + 'group' => 1 ); + self::document_editable_action($documents['document'], $file); if ($file['mime'] == 'message/rfc822') { self::document_mail_action($documents['document'], $file); @@ -2303,6 +2303,7 @@ abstract class Merge private static function document_mail_action(Array &$action, $file) { unset($action['postSubmit']); + unset($action['onExecute']); // Lots takes a while, confirm $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'], 'merge' => get_called_class(), ); - $action = array_merge($action_base, $action, array( - '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 - )); + + $action = array_merge( + $action_base, + array( + '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 + ); } /**