-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-21829: Show Related Cases For Organizations #101
base: master
Are you sure you want to change the base?
CRM-21829: Show Related Cases For Organizations #101
Conversation
54dc0d3
to
2b32e73
Compare
2b32e73
to
e209b54
Compare
civicase.php
Outdated
AND %1 = CASE | ||
WHEN (rtype.contact_type_a = 'Organization') THEN rel.contact_id_a | ||
ELSE rel.contact_id_b | ||
END"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really should have this kind of code in a separate class. That way we could create tests if need be and also help us get rid of the clutter here. Most of the hooks implemented in this extension are slowly starting to get out of control, I think they would really benefit if you could refactor your code into a separate class/classes, as you see fit. The idea is to keep business logic out of the extension's main file and have classes that do the bulk of the work.
</table> | ||
<script type="text/javascript"> | ||
cj('form.CRM_Admin_Form_Setting_Case table.form-layout tbody').append(cj('#civicaseRelatedCasesTab')); | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing new-line at end of file.
civicase.php
Outdated
'id' => 'related_case', | ||
'url' => CRM_Utils_System::url('civicrm/case/contact-case-tab', array( | ||
'cid' => $context['contact_id'], | ||
'related_cids' => implode(',', getOrganizationRelatedCaseContactIds($context['contact_id'])), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could pose problems in the long term, if there's an organization with a lot of members. Like on ATL. And each member could have several related cases. I think it'd be better if you just send a flag to tell if the organization has related cases or not and look for the actual related id's when the form is being built (or preprocessed).
CRM/Civicase/Page/ContactCaseTab.php
Outdated
@@ -10,6 +10,10 @@ class CRM_Civicase_Page_ContactCaseTab extends CRM_Core_Page { | |||
public function run() { | |||
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); | |||
$this->assign('cid', $cid); | |||
// For Related cases tab (optional) | |||
$related_cids = CRM_Utils_Request::retrieve('related_cids', 'String'); | |||
if($related_cids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use braces for if statements, even if they only have a single line.
eb1c767
to
b08c612
Compare
@MiyaNoctem |
@colemanw |
There's no screenshots on this PR but from the description I gather that it is meant to add a new tab to the contact summary screen showing "Related Cases" in addition to "Cases". That seems slightly weird from a UI perspective, kinda particular to one client's workflow perhaps? But it raises the question of why only Organizations get this treatment. Other contact types have relationships too... |
Overview
This is a continuation of the PR that was initially added to core here. The code is updated to be a part of CiviCase extension. The requirements for the task are as follows.
Within the organisation contact type, we need to add a new tab called "Related Cases"
In this tab, we should display all the cases that are related to any member associated (has a relationship - we will only consider first degree relationships) with that organisation (open and closed just like the normal for a contact)
Before
There is no way to view cases of users related to an organization from organization contact view page.
After
Organization view page has a new tab, Related Cases, which displays cases of contacts related to the organization.