CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • CiviCase behaviour when deleting clients from the database
Pages: [1]

Author Topic: CiviCase behaviour when deleting clients from the database  (Read 7465 times)

nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
CiviCase behaviour when deleting clients from the database
January 09, 2013, 04:42:21 am
We've come across a difficulty using CiviCase, and while I can understand the behaviour, I wonder if it should be amended.

When a contact is deleted from the database (in this case a contact was entered twice in error, and an operator chose to delete rather than merge the two contacts) and the contact is a client in a case, the database change is to remove the linkage entry in the civicrm_case_contact table but not to delete the case entry in civicrm_case. I can understand why this would make sense in a situation where multiple clients are associated with the same case, as you wouldn't want the case to be deleted 'out from under' the remaining clients.

However, the resulting effects of this are that the case still exists in the civicrm_case table, and associated custom values also remain behind, with no way of deleting them from the GUI. We cannot get to the case because no client is associated with it. Searching for all cases in the GUI gives 155 results, whereas there are 156 rows in civicrm_case and 155 rows in civicrm_case_contact.

When building a report using the Case Detail template however, the 'missing' case is listed, so that report shows 156 cases, one of which has no contact name associated with it. A discrepency between the search and the report is clearly a bad thing, which confuses users.

In general in civicrm deleting a high level object, such as contact, also deletes associated lower level constructs, such as relationships or activities, associated with that object. As I said earlier, I can understand why that could be dangerous where a case is associated with multiple clients, but couldn't the 'delete contact' action, having deleted the entry in civicrm_case_contact then check to see if any other contact is associated with the case in question, and delete it if and only if the deleted contact was the last or only contact associated with the case?

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: CiviCase behaviour when deleting clients from the database
January 09, 2013, 09:52:13 am
Hi Nick, that would make sense to me. Can you raise an issue in the issue tracker?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviCase behaviour when deleting clients from the database
January 09, 2013, 09:59:36 am

In addition to filing an issue would be great if you can investigate and also submit a patch to implement it

we can help out as needed on IRC. I've also asked DaveD to respond to this since he's quite fluent with CiviCase

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: CiviCase behaviour when deleting clients from the database
January 09, 2013, 04:16:38 pm
The suggestion sounds good to me.

Originally you couldn't have multiple clients per case, so I don't think that's the reason. At the time there was no trash concept in civi for contacts, but the audit trail concept was important for civicase. So my guess is that this current mixture instead of using the behaviour which you've noted about other objects was the way it got implemented, and then it was just never revisited.

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: CiviCase behaviour when deleting clients from the database
January 09, 2013, 04:19:23 pm
One more comment: I believe using the full-text search feature allows you to find the orphan cases in the UI, if you know what to search for, and then delete from there.

sushant

  • I post frequently
  • ***
  • Posts: 126
  • Karma: 8
  • CiviCRM version: v3.2.x,v3.3.x v4.0.x, v4.x,trunk
  • CMS version: Drupal 6/7 ,joomla 1.5,1.6
  • MySQL version: 5.1.51
  • PHP version: 5.3.3
Re: CiviCase behaviour when deleting clients from the database
May 29, 2013, 11:18:32 pm
Hi here is the issue with patch

http://issues.civicrm.org/jira/browse/CRM-12726

Hth
S
CiviCRM Priority Support
http://support.civigardens.com/
http://osseed.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • CiviCase behaviour when deleting clients from the database

This forum was archived on 2017-11-26.