diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-07-06 12:54:56 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-07-06 12:54:56 +0000 |
| commit | e7260b5f6658cdb9496a69f448ae2235aaaf4be3 (patch) | |
| tree | f66ca686f268c1f613f56390cb9be4464208045f /roundcubemail/program/steps | |
| parent | 72ee3440e23c40c53e915ca8185b4fdf47ed25c1 (diff) | |
- Fixed issues related to creating contacts in source which isn't currently selected (#1487990)
git-svn-id: https://svn.roundcube.net/trunk@4913 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
| -rw-r--r-- | roundcubemail/program/steps/addressbook/save.inc | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/roundcubemail/program/steps/addressbook/save.inc b/roundcubemail/program/steps/addressbook/save.inc index e1986efeb..a3fdde9f6 100644 --- a/roundcubemail/program/steps/addressbook/save.inc +++ b/roundcubemail/program/steps/addressbook/save.inc @@ -216,6 +216,8 @@ if (!empty($cid)) // insert a new contact else { + $source = get_input_value('_source', RCUBE_INPUT_GPC); + // show notice if existing contacts with same e-mail are found $existing = false; foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) { @@ -226,7 +228,7 @@ else { } $plugin = $RCMAIL->plugins->exec_hook('contact_create', array( - 'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); + 'record' => $a_record, 'source' => $source)); $a_record = $plugin['record']; // insert record and send response @@ -235,11 +237,11 @@ else { else $insert_id = $plugin['result']; - if ($insert_id) { // add new contact to the specified group if ($CONTACTS->groups && $CONTACTS->group_id) { - $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source)); + $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array( + 'group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source)); if (!$plugin['abort']) { if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum)) @@ -249,16 +251,25 @@ else { } } - // add contact row or jump to the page where it should appear - $CONTACTS->reset(); - $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id); + // Name of the addressbook already selected on the list + $orig_source = get_input_value('_orig_source', RCUBE_INPUT_GPC); + + if ((string)$source === (string)$orig_source) { + // add contact row or jump to the page where it should appear + $CONTACTS->reset(); + $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id); - rcmail_js_contacts_list($result, 'parent.'); - $OUTPUT->command('parent.contact_list.select', html_identifier($insert_id)); + rcmail_js_contacts_list($result, 'parent.'); + $OUTPUT->command('parent.contact_list.select', html_identifier($insert_id)); - // update record count display - $CONTACTS->reset(); - $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text()); + // update record count display + $CONTACTS->reset(); + $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text()); + } + else { + // re-set iframe + $OUTPUT->command('parent.show_contentframe'); + } // show confirmation $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); |
