Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9948

list of cases incomplete for a contact tab

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Hi,

      Issue: on the tab, it's written 6 cases, but when you click on the tab, it only displays 3.

      I displayed the sql queries to find the issue, and it is because to find the case, you find first the cases of the activities

      simplified query:

      SELECT civicrm_case.id FROM civicrm_contact contact_a
      LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id
      INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id

      INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id)
      AND case_activity.is_current_revision = 1

      WHERE ( contact_a.id = 394 )
      AND civicrm_case.is_deleted = 0
      AND (contact_a.is_deleted = 0) LIMIT 0, 20 ;

      So by doing that, you get all the cases that are related to an activity, and because they are plenty of duplicates (for cases having several activities) and that you limit to 20, you don't have all the activities, so you don't have all the cases

      I am not sure how to solve that.

      url: /civicrm/contact/view/case?reset=1&snippet=1&force=1&cid=394

      ---------------------- complete query ------------------------
      SELECT civicrm_case.id FROM civicrm_contact contact_a LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 21976 AND case_relationship.case_id = civicrm_case.id ) LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND case_relation_type.id = case_relationship.relationship_type_id ) INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id AND case_activity.is_current_revision = 1 ) LEFT JOIN civicrm_option_group option_group_case_status ON (option_group_case_status.name = 'case_status') LEFT JOIN civicrm_option_value case_status ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_type ON (option_group_case_type.name = 'case_type') LEFT JOIN civicrm_option_value case_type ON (civicrm_case.case_type_id = case_type.value AND option_group_case_type.id = case_type.option_group_id ) WHERE ( contact_a.id = 394 AND civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0) LIMIT 0, 20;

        Attachments

          Activity

            People

            • Assignee:
              xavier xavier dutoit
              Reporter:
              xavier xavier dutoit
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: