Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Extensions
form-processor
Commits
8c80681e
Commit
8c80681e
authored
Dec 23, 2020
by
jaapjansma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue Mailing group and Parent Mailing Group.
parent
156759e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
CHANGELOG.md
CHANGELOG.md
+3
-1
Civi/FormProcessor/Type/MailingGroupType.php
Civi/FormProcessor/Type/MailingGroupType.php
+13
-6
Civi/FormProcessor/Type/ParentMailingGroupType.php
Civi/FormProcessor/Type/ParentMailingGroupType.php
+19
-7
info.xml
info.xml
+2
-2
No files found.
CHANGELOG.md
View file @
8c80681e
Version 1.21
(not yet released)
Version 1.21
============
*
Fixed issue Mailing group and Parent Mailing Group.
Version 1.20
============
...
...
Civi/FormProcessor/Type/MailingGroupType.php
View file @
8c80681e
...
...
@@ -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
;
}
...
...
Civi/FormProcessor/Type/ParentMailingGroupType.php
View file @
8c80681e
...
...
@@ -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
)
{
}
...
...
info.xml
View file @
8c80681e
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment