+/*
+ Delete selected contacts for given person
+*/
+function delete_crm_contacts($person_id = null, $type = null, $entity_id=null, $action = null)
+{
+ $sql = "DELETE FROM ".TB_PREF."crm_contacts WHERE ";
+
+ if ($person_id)
+ $where[] = 'person_id='.db_escape($person_id);
+ if ($type)
+ $where[] = 'type='.db_escape($type);
+ if ($entity_id)
+ $where[] = 'entity_id='.db_escape($entity_id);
+ if ($action)
+ $where[] = 'action='.db_escape($action);
+
+ return db_query($sql.implode(' AND ', $where), "Can't delete crm contact");
+}