Add and Manage Customers, Suppliers: contact persons where not removed when deleting...
[fa-stable.git] / includes / db / crm_contacts_db.inc
index 98862b73ae3c25d2a6ad338a34eef770e38850cb..b9a7eda8776492023eb8bd444e3efd7caa5303a3 100644 (file)
@@ -175,9 +175,9 @@ function update_person_contacts($id, $cat_ids, $entity_id=null, $type=null)
 
 function delete_entity_contacts($class, $entity)
 {
-       delete_crm_contacts(null, $class, $entity);
        // cleanup
        $res = get_crm_persons($class, null, $entity, null, true);
+       delete_crm_contacts(null, $class, $entity);
        while($person = db_fetch($res)) {
                $rels = get_person_contacts($person['id']);
                if (count($rels) == 0) {