Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
action-provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
action-provider
Commits
114a9de9
Commit
114a9de9
authored
4 years ago
by
jaapjansma
Browse files
Options
Downloads
Patches
Plain Diff
Fixed #11: Action for retrieving the group and when it doesn't exists create it based on the title
parent
1342d2e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
Civi/ActionProvider/Action/Group/Create.php
+15
-1
15 additions, 1 deletion
Civi/ActionProvider/Action/Group/Create.php
with
16 additions
and
1 deletion
CHANGELOG.md
+
1
−
0
View file @
114a9de9
Version 1.50 (not yet released)
------------
*
Create/Update group action also checks on the title. (#11)
*
Added summary to create event action (!32 and #10)
Version 1.49
...
...
This diff is collapsed.
Click to expand it.
Civi/ActionProvider/Action/Group/Create.php
+
15
−
1
View file @
114a9de9
...
...
@@ -25,7 +25,10 @@ class Create extends AbstractAction {
*/
public
function
getConfigurationSpecification
()
{
$visibilityOptions
=
\CRM_Contact_DAO_Group
::
buildOptions
(
'visibility'
);
$checkTitle
=
new
Specification
(
'check_for_title'
,
'Boolean'
,
E
::
ts
(
'Check title for existence'
),
false
,
false
);
$checkTitle
->
setDescription
(
E
::
ts
(
'Check whether the group already exists based on the title'
));
return
new
SpecificationBag
([
$checkTitle
,
new
OptionGroupSpecification
(
'group_type'
,
'group_type'
,
E
::
ts
(
'Group type'
),
FALSE
),
new
Specification
(
'visibility'
,
'String'
,
E
::
ts
(
'Visibility'
),
FALSE
,
null
,
null
,
$visibilityOptions
),
]);
...
...
@@ -92,6 +95,17 @@ class Create extends AbstractAction {
// Get the contact and the event.
if
(
$parameters
->
doesParameterExists
(
'id'
))
{
$groupApiParams
[
'id'
]
=
$parameters
->
getParameter
(
'id'
);
}
elseif
(
$this
->
configuration
->
getParameter
(
'check_for_title'
))
{
try
{
$groupApiParams
[
'id'
]
=
civicrm_api3
(
'Group'
,
'getvalue'
,
[
'return'
=>
'id'
,
'is_active'
=>
1
,
'is_hidden'
=>
0
,
'title'
=>
$parameters
->
getParameter
(
'title'
)
]);
}
catch
(
\CiviCRM_API3_Exception
$ex
)
{
// Do nothing
}
}
$groupApiParams
[
'title'
]
=
$parameters
->
getParameter
(
'title'
);
$groupApiParams
[
'description'
]
=
$parameters
->
getParameter
(
'description'
);
...
...
@@ -121,4 +135,4 @@ class Create extends AbstractAction {
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment