Commit 8c80681e authored by jaapjansma's avatar jaapjansma

Fixed issue Mailing group and Parent Mailing Group.

parent 156759e7
Version 1.21 (not yet released)
Version 1.21
============
* Fixed issue Mailing group and Parent Mailing Group.
Version 1.20
============
......
......@@ -36,6 +36,10 @@ class MailingGroupType extends AbstractType implements OptionListInterface {
0 => E::ts('Single value'),
1 => E::ts('Multiple values'),
]),
new Specification('visibility', 'Integer', E::ts('Restrict to'), FALSE, 0, NULL, [
'Public Pages' => E::ts('Public Pages'),
'User and User Admin Only' => E::ts('User and User Admin Only'),
]),
]);
}
......@@ -116,14 +120,17 @@ class MailingGroupType extends AbstractType implements OptionListInterface {
if ($return) {
return $return;
}
$groups = civicrm_api3('Group', 'get', [
'is_active' => 1,
'group_type' => 2,
'options' => ['limit' => 0],
]);
$groupsParams['is_active'] = 1;
$groupsParams['options']['limit'] = 0;
if ($this->configuration->get('visibility')) {
$groupsParams['visibility'] = $this->configuration->get('visibility');
}
$groups = civicrm_api3('Group', 'get', $groupsParams);
$return = [];
foreach ($groups['values'] as $group) {
$return[$group['id']] = $group['title'];
if (in_array(2, $group['group_type'])) {
$return[$group['id']] = $group['title'];
}
}
return $return;
}
......
......@@ -27,7 +27,7 @@ class ParentMailingGroupType extends AbstractType implements OptionListInterface
* @return bool
*/
public function isMultiple() {
return FALSE;
return $this->configuration->get('multiple') == 1 ? TRUE : FALSE;
}
/**
......@@ -41,7 +41,6 @@ class ParentMailingGroupType extends AbstractType implements OptionListInterface
$parentGroupsApi = civicrm_api3('Group', 'get', [
'return' => ["title", "description"],
'is_active' => 1,
'group_type' => "Mailing List",
'children' => ['IS NOT NULL' => 1],
'options' => ['limit' => 0],
]);
......@@ -61,6 +60,14 @@ class ParentMailingGroupType extends AbstractType implements OptionListInterface
}
return new SpecificationBag([
new Specification('parent_group_id', 'Integer', E::ts('Parent Mailing Group'), TRUE, NULL, NULL, $parentGroups, FALSE),
new Specification('multiple', 'Boolean', E::ts('Multiple'), FALSE, 0, NULL, [
0 => E::ts('Single value'),
1 => E::ts('Multiple values'),
]),
new Specification('visibility', 'Integer', E::ts('Restrict to'), FALSE, 0, NULL, [
'Public Pages' => E::ts('Public Pages'),
'User and User Admin Only' => E::ts('User and User Admin Only'),
]),
]);
}
......@@ -105,15 +112,20 @@ class ParentMailingGroupType extends AbstractType implements OptionListInterface
return;
}
try {
$childrenApi = civicrm_api3('Group', 'get', [
'return' => ["title"],
$groupsParams = [
'return' => ["title", "group_type"],
'parents' => ['LIKE' => $parentGroupId],
'is_active' => 1,
'options' => ['limit' => 0],
]);
$childGroups = [];
];
if ($this->configuration->get('visibility')) {
$groupsParams['visibility'] = $this->configuration->get('visibility');
}
$childrenApi = civicrm_api3('Group', 'get', $groupsParams);
foreach ($childrenApi['values'] as $childId => $child) {
$this->_childGroups[$childId] = $child['title'];
if (in_array(2, $child['group_type'])) {
$this->_childGroups[$childId] = $child['title'];
}
}
} catch (\CiviCRM_API3_Exception $ex) {
}
......
......@@ -16,8 +16,8 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
<url desc="Action-Provider Extension">https://lab.civicrm.org/extensions/action-provider</url>
</urls>
<releaseDate>2020-12-14</releaseDate>
<version>1.21-dev</version>
<releaseDate>2020-12-23</releaseDate>
<version>1.21</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment