Skip to content
Snippets Groups Projects
Commit da5c41f1 authored by Eileen McNaughton's avatar Eileen McNaughton
Browse files

#2895 handle case ids passed via url

parent bfeae56b
Branches
Tags
No related merge requests found
......@@ -114,4 +114,13 @@ class CRM_Case_Form_Task extends CRM_Core_Form_Task {
);
}
/**
* Get the token processor schema required to list any tokens for this task.
*
* @return array
*/
protected function getTokenSchema(): array {
return ['contactId', 'caseId'];
}
}
......@@ -33,6 +33,11 @@ class CRM_Case_Form_Task_Email extends CRM_Case_Form_Task {
/**
* List available tokens for this form.
*
* @todo - this is not standard behaviour. We should either stop filtering
* case tokens by type and just remove this function (which would allow
* domain tokens to show up too) or
* resolve https://lab.civicrm.org/dev/core/-/issues/2788
*
* @return array
* @throws \CRM_Core_Exception
*/
......@@ -70,14 +75,18 @@ class CRM_Case_Form_Task_Email extends CRM_Case_Form_Task {
* Get the result rows to email.
*
* @return array
*
* @throws \CRM_Core_Exception
*/
protected function getRows(): array {
// format contact details array to handle multiple emails from same contact
$rows = parent::getRows();
foreach ($rows as $index => $row) {
$rows[$index]['schema']['caseId'] = $this->getCaseID();
protected function getRowsForEmails(): array {
$formattedContactDetails = [];
foreach ($this->getEmails() as $details) {
$contactID = $details['contact_id'];
$index = $contactID . '::' . $details['email'];
$formattedContactDetails[$index] = $details;
$formattedContactDetails[$index]['schema'] = ['contactId' => $contactID, 'caseId' => $this->getCaseID()];
}
return $rows;
return $formattedContactDetails;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment