From 79f1c6f8091525aee2a6b64836c8f5e25dc7b79c Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sat, 03 Nov 2012 07:05:39 -0400
Subject: [PATCH] Fix count display after inserting a new contact
---
program/steps/addressbook/save.inc | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 038b905..e80f801 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -183,18 +183,24 @@
$insert_id = $plugin['result'];
if ($insert_id) {
+ $CONTACTS->reset();
+
// 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));
+ $counts = $CONTACTS->count();
+
if (!$plugin['abort']) {
- if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum))
+ if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($counts->count + 1 > $maxnum))
$OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
$CONTACTS->add_to_group($gid, $plugin['ids']);
}
}
+ else
+ $counts = $CONTACTS->count();
if ((string)$source === (string)$orig_source) {
// add contact row or jump to the page where it should appear
@@ -206,7 +212,7 @@
// update record count display
$CONTACTS->reset();
- $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text());
+ $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text($counts));
}
else {
// re-set iframe
--
Gitblit v1.9.1