diff --git a/api/js/etemplate/et2_widget_dialog.js b/api/js/etemplate/et2_widget_dialog.js index 973c95102b..599af10b68 100644 --- a/api/js/etemplate/et2_widget_dialog.js +++ b/api/js/etemplate/et2_widget_dialog.js @@ -736,8 +736,39 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return switch(response.type) { case 'error': - log.append("
"); - break; + jQuery("") + .text(response.data) + .appendTo(log); + + // Ask to retry / ignore / abort + et2_createWidget("dialog", { + callback:function(button) { + switch(button) + { + case 'dialog[cancel]': + cancel = true; + return update.call(index,''); + case 'dialog[skip]': + // Continue with next index + return update.call(index,''); + default: + // Try again with previous index + return update.call(index-1,''); + } + + }, + message: response.data, + title: '', + buttons: [ + // These ones will use the callback, just like normal + {text: egw.lang("Abort"),id:'dialog[cancel]',}, + {text: egw.lang("Retry"),id:'dialog[retry]'}, + {text: egw.lang("Skip"),id:'dialog[skip]', class:"ui-priority-primary", default: true} + ], + dialog_type: et2_dialog.ERROR_MESSAGE + }, parent); + // Early exit + return; default: if(response) { @@ -755,6 +786,7 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return if(typeof parameters != 'object') parameters = [parameters]; // Async request, we'll take the next step in the callback + // We can't pass index = 0, it looks like false and causes issues egw.json(_menuaction, parameters, update, index+1,true,index+1).sendRequest(); } else diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index b3192dc00e..255ad68d7c 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -1858,6 +1858,10 @@ div.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset button { .long_task .message { height: inherit; } +.long_task .message.error { + color: white; + background-color: red; +} div.ui-dialog div.ui-dialog-content > div[id] { width: 100%; } diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 925db44414..58db61e888 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -3494,13 +3494,26 @@ class mail_compose // Actually do the merge $folder = $merged_mail_id = null; - $results = $this->mail_bo->importMessageToMergeAndSend( - $document_merge, Vfs::PREFIX . $_REQUEST['document'], - // Send an extra non-numeric ID to force actual send of document - // instead of save as draft - array((int)$contact_id, ''), - $folder,$merged_mail_id - ); + try + { + $results = $this->mail_bo->importMessageToMergeAndSend( + $document_merge, Vfs::PREFIX . $_REQUEST['document'], + // Send an extra non-numeric ID to force actual send of document + // instead of save as draft + array((int)$contact_id, ''), + $folder,$merged_mail_id + ); + } + catch (Exception $e) + { + $contact = $document_merge->contacts->read((int)$contact_id); + //error_log(__METHOD__.' ('.__LINE__.') '.' ID:'.$val.' Data:'.array2string($contact)); + $email = ($contact['email'] ? $contact['email'] : $contact['email_home']); + $nfn = ($contact['n_fn'] ? $contact['n_fn'] : $contact['n_given'].' '.$contact['n_family']); + $response->error(lang('Sending mail to "%1" failed', "$nfn <$email>"). + "\n".$e->getMessage() + ); + } if($results['success']) {