-
-
Notifications
You must be signed in to change notification settings - Fork 814
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-21520: Implement Search Action to Add Contacts to Case #11371
CRM-21520: Implement Search Action to Add Contacts to Case #11371
Conversation
.val('') | ||
.crmEntityRef({create: false}); | ||
}); | ||
})(cj, CRM); |
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.
What's the reason for adding a simple textfield from the formbuilder and then javascripting it into an entityref after the fact? Why not just add an entityref from the getgo?
CRM/Case/FormBuilder.php
Outdated
} | ||
return $roleTypes; | ||
} | ||
} |
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.
I don't really understand the purpose of breaking these 2 functions into a separate file. What's wrong with doing this in the CRM_Case_Form_AddToCaseAsRole
class?
@@ -0,0 +1 @@ | |||
{include file="CRM/Caseroles/Form/AddToCaseAsRole.tpl"} |
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 file seems quite useless. What's the purpose of not putting the contents of templates/CRM/Case/Form/AddToCaseAsRole.tpl
here?
Part of the functionality included corresponded to the ability to add a contact to a case from within the Contact's detail view, via an action. This functionality is outside of the scope of the current ticket, and thus is removed.
Now that we're only using one form, we don't need to have the FormBuilder class. Removed the class and sent the building code to the AddToCaseAsRole class.
CRM/Case/Form/AddToCaseAsRole.php
Outdated
*/ | ||
public function buildQuickForm() { | ||
|
||
$this->add('text', 'assign_to', ts('Assign to')); |
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.
Your recent changes look good, but I'm still curious to know why the javascript is necessary instead of simply doing
$this->addEntityRef('assign_to', ts('Assign to'), array('api' => array('params' => array('contact_type' => 'Individual'))), TRUE);
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.
Hi @colemanw,
Thanks for the feedback. I'm working on this, I should be able to commit the change later today.
Thanks again!
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.
Looks good. But it appears you still need to remove this redundant form element.
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.
I removed the redundant element, thanks for pointing it out. I also added a PR to the user guide repository documenting the functionality.
CRM/Case/Form/AddToCaseAsRole.php
Outdated
'role_type', | ||
ts('Relationship Type'), | ||
array('' => ts('- select type -')) + $roleTypes, | ||
FALSE, |
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.
I think $required
should be TRUE.
CRM/Case/xml/Menu/Case.xml
Outdated
<path>civicrm/case/add-contact</path> | ||
<page_callback>CRM_Case_Form_AddContact</page_callback> | ||
<title>AddContact</title> | ||
<access_arguments>access CiviCRM</access_arguments> |
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.
I think access_arguments should be access my cases and activities
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.
Actually, what is this entry? I don't think this class exists. Can this be removed?
CRM/Case/Form/AddToCaseAsRole.php
Outdated
|
||
$url = CRM_Utils_System::url( | ||
'civicrm/contact/view/case', | ||
sprintf('cid=%d&id=%d', $clients[0], $caseId) |
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 is missing a few arguments so the redirect doesn't quite work. IMO an array is more readable than sprintf. Recommend changing to:
array(
'cid' => $clients[0],
'id' => $caseId,
'reset' => 1,
'action' => 'view',
)
I've implemented the suggestions you made. Thanks for the input. Do you think this is ready now to be merged? |
…add-contacts-to-case CRM-21520: Implement Search Action to Add Contacts to Case
Overview
From search results, the user can do a set of actions. In this actions menu, we need to add a new option: "Add contacts to Case". Once the user selects this option, they will see a form where they can select a case (an existing case) and also assign a case role to all selected users.
Before
It was not possible to add contacts to a case in bulk.
After
Added functionality:
Documentation
PR documenting new functionality on user guide:
civicrm/civicrm-user-guide#245