Skip to content
Snippets Groups Projects
Commit 6eb05e3c authored by jaapjansma's avatar jaapjansma
Browse files

Fixed #22: Typo in Activity: Get most Recent activity. And loading of...

Fixed #22: Typo in Activity: Get most Recent activity. And loading of configuration of an action when it contains multiple values. Such as activity type.
parent f43774ba
No related branches found
Tags 1.100
No related merge requests found
Version 1.93 (not yet released)
Version 1.93
------------
* Fixed #22: Typo in Activity: Get most Recent activity. And loading of configuration of an action when it contains multiple values. Such as activity type.
* Fixed bug with action Contact: add tags.
* Added is_opt_out parameter to CreateUpdateIndividual action see !73
* Added action Contact: Remove From Group see !74
......
......@@ -77,7 +77,7 @@ class GetMostRecentActivity extends AbstractAction {
protected function doAction(ParameterBagInterface $parameters, ParameterBagInterface $output) {
$id = $parameters->getParameter('id');
$record_type_ids = $this->configuration->getParameter('record_type');
$activity_type_ids = $this->configuration->getParameter('activity_type');
$activity_type_ids = $this->configuration->getParameter('activity_type_id');
$status_ids = $this->configuration->getParameter('status_id');
$error = $this->configuration->getParameter('error');
$sql =<<< SQL
......
......@@ -5,9 +5,9 @@ namespace Civi\ActionProvider\Parameter;
use \Civi\ActionProvider\Parameter\ParameterBagInterface;
class ParameterBag implements ParameterBagInterface, \IteratorAggregate {
protected $parameters = array();
/**
* Get the parameter.
*/
......@@ -16,7 +16,7 @@ class ParameterBag implements ParameterBagInterface, \IteratorAggregate {
return $this->parameters[$name];
}
return null;
}
}
/**
* Tests whether the parameter with the name exists.
*/
......@@ -26,21 +26,21 @@ class ParameterBag implements ParameterBagInterface, \IteratorAggregate {
}
return false;
}
/**
* Sets parameter.
* Sets parameter.
*/
public function setParameter($name, $value) {
$this->parameters[$name] = $value;
}
public function getIterator() {
return new \ArrayIterator($this->parameters);
}
/**
* Converts the object to an array.
*
*
* @return array
*/
public function toArray() {
......@@ -52,11 +52,18 @@ class ParameterBag implements ParameterBagInterface, \IteratorAggregate {
*
* @return \Civi\ActionProvider\Parameter\ParameterBag
*/
public function fromArray($data) {
public function fromArray($data, SpecificationBag $specificationBag=null) {
foreach($data as $key => $val) {
$spec = null;
if ($specificationBag) {
$spec = $specificationBag->getSpecificationByName($key);
}
if ($spec && $spec->isMultiple() && !is_array($val)) {
$val = explode(",", $val);
}
$this->setParameter($key, $val);
}
return $this;
}
}
......@@ -40,4 +40,16 @@ interface SpecificationInterface {
*/
public function validate($value);
/**
* @return bool
*/
public function isMultiple();
/**
* @param bool $multiple
*
* @return \Civi\ActionProvider\Parameter\SpecificationInterface
*/
public function setMultiple($multiple);
}
......@@ -13,8 +13,8 @@
<url desc="Documentation">https://lab.civicrm.org/extensions/action-provider/wikis/home</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2022-04-08</releaseDate>
<version>1.93-dev</version>
<releaseDate>2022-05-23</releaseDate>
<version>1.93</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