[Frontaccounting-cvs_updates] /hg/p/frontaccounting/mercurial: Bug no 2409 and 2410. Fixed hea...
Brought to you by:
frontaccounting,
itronics
From: FrontAccounting <fro...@us...> - 2013-09-02 11:29:07
|
details: http://frontaccounting.hg.sourceforge.net:8000/hgroot/frontaccounting/frontaccounting/hg/p/frontaccounting/mercurial/rev/f94090b7de22 changeset: 3295:f94090b7de22 user: Joe date: Mon Sep 02 13:28:27 2013 +0200 description: Bug no 2409 and 2410. Fixed headers and sql error when deleting a category. diffstat: admin/crm_categories.php | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diffs (37 lines): diff -r 93fb33771bae -r f94090b7de22 admin/crm_categories.php --- a/admin/crm_categories.php Sat Aug 31 09:32:50 2013 +0200 +++ b/admin/crm_categories.php Mon Sep 02 13:28:27 2013 +0200 @@ -52,11 +52,20 @@ } } +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_foreign_table($selected_id, 'crm_relations', 'category_id')) + if (key_in_crm_contacts($selected_id)) { $cancel_delete = 1; display_error(_("Cannot delete this category because there are contacts related to it.")); @@ -83,9 +92,9 @@ $result = get_crm_categories(check_value('show_inactive')); start_form(); -start_table(TABLESTYLE, "width=50%"); +start_table(TABLESTYLE, "width=70%"); -$th = array(_("Type id"), _("Action id"), _("Short Name"), _("Description"), "", " "); +$th = array(_("Category Type"), _("Category Subtype"), _("Short Name"), _("Description"), "", " "); inactive_control_column($th); table_header($th); |