From dddb9dee612e56298869422700aff0fba187a842 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 10 Aug 2014 10:39:25 +0200 Subject: Fix errors when adding/updating contacts in active search (#1490015) --- program/steps/addressbook/save.inc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'program/steps/addressbook/save.inc') diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index 94556f96b..e0e38d4d9 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -148,6 +148,15 @@ if (!empty($cid)) { $result = $plugin['result']; if ($result) { + // show confirmation + $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); + + // in search mode, just reload the list (#1490015) + if ($_REQUEST['_search']) { + $OUTPUT->command('parent.command', 'list'); + $OUTPUT->send('iframe'); + } + // LDAP DN change if (is_string($result) && strlen($result)>1) { $newcid = $result; @@ -168,8 +177,6 @@ if (!empty($cid)) { // update the changed col in list $OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source, $record); - // show confirmation - $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); $RCMAIL->overwrite_action('show'); } else { @@ -228,8 +235,11 @@ else { $counts = $CONTACTS->count(); } - if ((string)$source === (string)$orig_source) { - // add contact row or jump to the page where it should appear + // show confirmation + $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); + + // add contact row to the list + if (empty($_REQUEST['_search']) && (string)$source === (string)$orig_source) { $CONTACTS->reset(); $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id); @@ -240,13 +250,11 @@ else { $CONTACTS->reset(); $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text($counts)); } + // just refresh the list (#1490015) else { - // re-set iframe - $OUTPUT->command('parent.show_contentframe'); + $OUTPUT->command('parent.command', 'list'); } - // show confirmation - $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); $OUTPUT->send('iframe'); } else { -- cgit v1.2.3