thomascube
2010-04-13 8e3a6039cfefb8f351d2696ebdcfa26cc5d4cef9
program/include/rcube_contacts.php
@@ -212,7 +212,7 @@
      if ($col == 'ID' || $col == $this->primary_key)
      {
        $ids = !is_array($value) ? explode(',', $value) : $value;
        $add_where[] = $this->primary_key.' IN ('.join(',', $ids).')';
        $add_where[] = 'c.' . $this->primary_key.' IN ('.join(',', $ids).')';
      }
      else if ($strict)
        $add_where[] = $this->db->quoteIdentifier($col).'='.$this->db->quote($value);
@@ -336,6 +336,10 @@
        
      $insert_id = $this->db->insert_id('contacts');
    }
    // also add the newly created contact to the active group
    if ($insert_id && $this->group_id)
      $this->add_to_group($this->group_id, $insert_id);
    return $insert_id;
  }
@@ -398,6 +402,13 @@
  {
    if (is_array($ids))
      $ids = join(',', $ids);
    // delete all group members linked with these contacts
    if ($this->groups) {
      $this->db->query(
        "DELETE FROM ".get_table_name('contactgroupmembers')."
         WHERE  contact_id IN (".$ids.")");
    }
    $this->db->query(
      "UPDATE ".$this->db_name."
@@ -492,6 +503,7 @@
   *
   * @param string  Group identifier
   * @param array   List of contact identifiers to be added
   * @return int    Number of contacts added
   */
  function add_to_group($group_id, $ids)
  {
@@ -527,6 +539,7 @@
   *
   * @param string  Group identifier
   * @param array   List of contact identifiers to be removed
   * @return int    Number of deleted group members
   */
  function remove_from_group($group_id, $ids)
  {