Fix some problems with merging into email files:

- Use correct merge sub-class when merging multiple entries
- Accept merge placeholders in to/cc/bcc fields (displayed as invalid, but still accepted)
- Use merge placeholders to pull addresses from associated entry
This commit is contained in:
Nathan Gray 2015-05-19 19:24:02 +00:00
parent a480dfc022
commit 69f1fc4696
3 changed files with 13 additions and 6 deletions

View File

@ -1883,7 +1883,7 @@ abstract class bo_merge
$action['nm_action'] = 'long_task';
$action['popup'] = egw_link::get_registry('mail', 'edit_popup');
$action['message'] = lang('insert in %1',egw_vfs::decodePath($file['name']));
$action['menuaction'] = 'mail.mail_compose.ajax_merge&document='.$file['path'];
$action['menuaction'] = 'mail.mail_compose.ajax_merge&document='.$file['path'].'&merge='. get_called_class();
}
/**

View File

@ -120,7 +120,10 @@ class etemplate_widget_taglist extends etemplate_widget
self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($lists))),'');
}
}
else if($this->type == 'taglist-email' && !preg_match(etemplate_widget_url::EMAIL_PREG, $val))
else if($this->type == 'taglist-email' && !preg_match(etemplate_widget_url::EMAIL_PREG, $val) &&
// Allow merge placeholders. Might be a better way to do this though.
!preg_match('/{{.+}}|\$\$.+\$\$/',$val)
)
{
self::set_validation_error($form_name,lang("'%1' has an invalid format",$val),'');
}

View File

@ -3382,7 +3382,14 @@ class mail_compose
public function ajax_merge($contact_id)
{
$response = egw_json_response::get();
$document_merge = new addressbook_merge();
if(class_exists($_REQUEST['merge']) && is_subclass_of($_REQUEST['merge'],'bo_merge'))
{
$document_merge = new $_REQUEST['merge']();
}
else
{
$document_merge = new addressbook_merge();
}
$this->mail_bo->openConnection();
if(($error = $document_merge->check_document($_REQUEST['document'],'')))
@ -3391,9 +3398,6 @@ class mail_compose
return;
}
// Merge does not work correctly (missing to) if current app is not addressbook
//$GLOBALS['egw_info']['flags']['currentapp'] = 'addressbook';
// Actually do the merge
$folder = $merged_mail_id = null;
$results = $this->mail_bo->importMessageToMergeAndSend(