Thomas Bruederli
2014-08-19 fc52af24f1418d6590a2d37a0d8cc31b123e38f6
program/steps/addressbook/save.inc
@@ -82,7 +82,7 @@
// do input checks (delegated to $CONTACTS instance)
if (!$CONTACTS->validate($a_record)) {
    $err = (array)$CONTACTS->get_error();
    $OUTPUT->show_message($err['message'] ? $err['message'] : 'formincomplete', 'warning');
    $OUTPUT->show_message($err['message'] ? Q($err['message']) : 'formincomplete', 'warning');
    $GLOBALS['EDIT_RECORD'] = $a_record;  // store submitted data to be used in edit form
    rcmail_overwrite_action($return_action);
    return;
@@ -134,11 +134,11 @@
    $record['email'] = reset($CONTACTS->get_col_values('email', $record, true));
    $record['name']  = rcube_addressbook::compose_list_name($record);
    foreach (array('name', 'email') as $col)
    foreach (array('name') as $col)
      $a_js_cols[] = Q((string)$record[$col]);
    // update the changed col in list
    $OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source);
    $OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source, $record);
    // show confirmation
    $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
@@ -179,18 +179,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']);
        $CONTACTS->add_to_group($plugin['group_id'], $plugin['ids']);
      }
    }
    else
      $counts = $CONTACTS->count();
    if ((string)$source === (string)$orig_source) {
      // add contact row or jump to the page where it should appear
@@ -202,7 +208,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