4

I've only started trying to change some features of an existing CiviCRM database in a testsystem (using CiviCases). So I am still a beginner, I excuse myself if this is a silly question, and any hint will be appreciated :)

I want to include a feature that will exclude all the activities with the grouping value "system" from the case view. Right now, the case view is spammed with activities not relevant to the users (for example, "Case type changed from ... to ..."). The activities are given this grouping value in a table called civicrm_option_value.

So I suppose I have to include some filter into the file /civicrm/CRM/Case/Form/CaseView.php, accessing each activity's grouping and testing it for "system". Can you give me any hint how I can access the activities' grouping value?

Thanks in advance, emma

  • a non-dev CMS dependent option might be to achieve this part of your workflow via Drupal Views – petednz - fuzion Aug 24 at 21:01
4

The function that is responsible to build the list of activities on case is CRM_Case_BAO_Case::getCaseActivity(). It is very difficult to alter the function via custom module/plugin/extension.

I would create an extension that would alter the page callback for 'civicrm/ajax/activity' to custom function (eg CRM_ExtName_Page_AJAX::getCaseActivity using hook_civicrm_alterMenu hook. Copy CRM_Activity_Page_AJAX::getCaseActivity() into your custom php file i.e CRM_ExtName_Page_AJAX::getCaseActivity() and change the line below line to your custom function which will basically copy paste of CRM_Case_BAO_Case::getCaseActivity function with change the where clause to include your conditions

$activities = CRM_Case_BAO_Case::getCaseActivity($caseID, $params, $contactID, $context, $userID);

HTH

Pradeep

| improve this answer | |
  • Thank you, I will work myself into that! – emma Aug 25 at 12:33
  • I don't quite understand the "change the where clause to include your conditions" part, as the CRM_Activity_Page_AJAX::getCaseActivity() does not have a where clause. Can you tell me what exactly you mean by that? – emma Aug 25 at 13:42
  • I mean something like creating class gist.github.com/pradpnayak/c3152131f857ce2e80fcf79fa4df22be and changing the where clause in getCaseActivity() as per your needs – Pradeep Nayak Aug 25 at 14:09
2

In the end, I directly changed the CRM_Case_BAO_Case::getCaseActivity function instead of creating an extension.

Specifically, I changed this function's $where variable to:

    $where = "
            WHERE cca.case_id= %1
              AND ca.is_current_revision = 1
              AND cov.grouping = 'visible'";

Here, "cov" is the alias for the table civicrm_option_value. The alias is already predefined in the $from variable above.

I added the grouping value "visible" manually in the database to those activities that should be visible in the case view.

| improve this answer | |
  • so long as you have a good solid process for managing this during upgrades. i might get one of our folk to extensionize this if they and some users deem it useful - thanks for sharing – petednz - fuzion Sep 17 at 3:12
1

I've posted almost exactly the same question and got some pretty helpful answers.

Especially the extension mentioned here seems to be really useful (I have not tried it yet, though).

| improve this answer | |
  • Thank you! I'd prefer not to include the official new CiviCase extension, because I only want to change this very specific issue, and the rest should stay as it is. I may create a small extension only for this purpose myself. – emma Aug 26 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.