Skip to content
Snippets Groups Projects
Commit 904ca519 authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with action get activity and the retrieval of the target and assignee contact ids.

parent 1edd77df
No related branches found
Tags 1.24.1
No related merge requests found
Version 1.48 (not yet released)
Version 1.48
------------
* Fixed issue with action get activity and the retrieval of the target and assignee contact ids.
Version 1.47
------------
......
......@@ -47,6 +47,43 @@ class GetActivity extends AbstractGetSingleAction {
return $bag;
}
/**
* Returns the specification of the output parameters of this action.
*
* This function could be overriden by child classes.
*
* @return SpecificationBag
*/
public function getOutputSpecification() {
$bag = parent::getOutputSpecification();
$target_contact_id = $bag->getSpecificationByName('target_contact_id');
if ($target_contact_id instanceof Specification) {
$target_contact_id->setMultiple(TRUE);
}
return $bag;
}
protected function setOutputFromEntity($entity, ParameterBagInterface $output) {
parent::setOutputFromEntity($entity, $output);
$sql = "SELECT DISTINCT contact_id, record_type_id FROM civicrm_activity_contact WHERE activity_id = %1 AND record_type_id IN (1,3)";
$sqlParams[1] = array($entity['id'], 'Integer');
$dao = \CRM_Core_DAO::executeQuery($sql, $sqlParams);
$target_contact_ids = array();
$assignee_contact_id = null;
while($dao->fetch()) {
if ($dao->record_type_id == 1) {
$assignee_contact_id = $dao->contact_id;
} elseif ($dao->record_type_id == 3) {
$target_contact_ids[] = $dao->contact_id;
}
}
$output->setParameter('target_contact_id', $target_contact_ids);
if ($assignee_contact_id) {
$output->setParameter('assignee_contact_id', $assignee_contact_id);
}
}
}
......@@ -13,8 +13,8 @@
<url desc="Documentation">https://lab.civicrm.org/jaapjansma/action-provider/wikis/home</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-01-21</releaseDate>
<version>1.48-dev</version>
<releaseDate>2021-01-28</releaseDate>
<version>1.48</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment