0001606: Statement are not sent to general contact
[fa-stable.git] / includes / db / crm_contacts_db.inc
index 3b47790fb313b851fb289d9cf16469157eecc750..94a5a991594034f10bba5c8a1d81732171628f29 100644 (file)
@@ -110,7 +110,12 @@ function get_crm_persons($type=null, $action=null, $entity=null, $person=null, $
        else
                $sql .= " ORDER BY contact_id";
 
-       return db_query($sql, "Can't get crm persons");
+       $result = db_query($sql, "Can't get crm persons");
+       // fallback to general contacts
+       if (!db_num_rows($result) && $action && $action != 'general')
+               return get_crm_persons($type, 'general', $entity, $person, $unique);
+       else
+               return $result;
 }
 
 function get_crm_person($id)