X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fcrm_categories.php;h=6db43e58179830e1148302964cc380d7be2bec6c;hb=a31195793c023906ab5da62f06ab84aefed445c3;hp=f043443af4e680f70cc2c13b16fab6654c9a5071;hpb=fc24ee893402902fc58632dabb5d7c2594e191d0;p=fa-stable.git diff --git a/admin/crm_categories.php b/admin/crm_categories.php index f043443a..6db43e58 100644 --- a/admin/crm_categories.php +++ b/admin/crm_categories.php @@ -52,20 +52,11 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') } } -function key_in_crm_contacts($id) // extra function for testing foreign concatenated key. Joe 02.09.2013. -{ - $row = get_crm_category($id); - $sql = "SELECT COUNT(*) FROM ".TB_PREF."crm_contacts WHERE type='".$row['type']."' AND action='".$row['action']."'"; - $result = db_query($sql, "check relations for crm_contacts failed"); - $contacts = db_fetch($result); - return $contacts[0]; -} - if ($Mode == 'Delete') { $cancel_delete = 0; - if (key_in_crm_contacts($selected_id)) + if (is_crm_category_used($selected_id)) { $cancel_delete = 1; display_error(_("Cannot delete this category because there are contacts related to it.")); @@ -159,4 +150,3 @@ submit_add_or_update_center($selected_id == -1, '', 'both'); end_form(); end_page(); -?>