Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aivlspecificactions
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
Partners
CiviCooP
AIVL
aivlspecificactions
Commits
99117721
Commit
99117721
authored
4 years ago
by
ErikHommel
Browse files
Options
Downloads
Patches
Plain Diff
fix issue 7337 - temp group id
parent
51495dd5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Civi/Aivlspecificactions/Actions/PetitionActivity.php
+49
-3
49 additions, 3 deletions
Civi/Aivlspecificactions/Actions/PetitionActivity.php
info.xml
+2
-2
2 additions, 2 deletions
info.xml
with
51 additions
and
5 deletions
Civi/Aivlspecificactions/Actions/PetitionActivity.php
+
49
−
3
View file @
99117721
...
...
@@ -31,6 +31,7 @@ class PetitionActivity extends AbstractAction {
$specs
->
addSpecification
(
new
Specification
(
'campaign_id'
,
'Integer'
,
E
::
ts
(
'Campaign ID'
),
FALSE
,
NULL
));
$specs
->
addSpecification
(
new
Specification
(
'contact_id'
,
'Integer'
,
E
::
ts
(
'Contact ID'
),
TRUE
,
NULL
));
$specs
->
addSpecification
(
new
Specification
(
'petition_flag'
,
'Integer'
,
E
::
ts
(
'Petition Flag'
),
FALSE
,
0
));
$specs
->
addSpecification
(
new
Specification
(
'more_information'
,
'Integer'
,
E
::
ts
(
'More Information'
),
FALSE
,
0
));
return
$specs
;
}
...
...
@@ -38,9 +39,24 @@ class PetitionActivity extends AbstractAction {
* @return SpecificationBag
*/
public
function
getConfigurationSpecification
()
{
// get all active groups to add to the options of each specification
$activeGroups
=
[];
try
{
$apiGroups
=
civicrm_api3
(
'Group'
,
'get'
,
[
'is_active'
=>
1
,
'options'
=>
[
'limit'
=>
0
],
'return'
=>
[
'title'
],
]);
foreach
(
$apiGroups
[
'values'
]
as
$groupId
=>
$group
)
{
$activeGroups
[
$groupId
]
=
$group
[
'title'
];
}
}
catch
(
\CiviCRM_API3_Exception
$ex
)
{
}
$specs
=
new
SpecificationBag
();
$specs
->
addSpecification
(
new
OptionGroupByNameSpecification
(
'activity_type_id'
,
'activity_type'
,
E
::
ts
(
'Activity Type'
),
TRUE
));
$specs
->
addSpecification
(
new
OptionGroupByNameSpecification
(
'status_id'
,
'activity_status'
,
E
::
ts
(
'Activity Status'
),
TRUE
));
$specs
->
addSpecification
(
new
Specification
(
"news_group_id"
,
"Integer"
,
E
::
ts
(
"Nieuwsbrief Groep"
),
TRUE
,
NULL
,
NULL
,
$activeGroups
));
return
$specs
;
}
...
...
@@ -52,9 +68,39 @@ class PetitionActivity extends AbstractAction {
* @throws ExecutionException
*/
public
function
doAction
(
ParameterBagInterface
$parameters
,
ParameterBagInterface
$output
)
{
$activityId
=
$this
->
addPetitionActivity
(
$parameters
,
$output
);
if
(
$activityId
)
{
$output
->
setParameter
(
'activity_id'
,
(
int
)
$activityId
);
$this
->
addPetitionActivity
(
$parameters
,
$output
);
// temporarily: add to Nieuwsbrief group if more information ticked
$this
->
addNieuwsbrief
(
$parameters
);
}
/**
* Method to add contact to newsletter group (temp until we fixed email preferences
*
* @link https://issues.civicoop.org/issues/7337)
* @param ParameterBagInterface $parameters
* @throws \CiviCRM_API3_Exception
*/
private
function
addNieuwsbrief
(
ParameterBagInterface
$parameters
)
{
$groupId
=
$this
->
configuration
->
getParameter
(
'news_group_id'
);
$moreInfo
=
$parameters
->
getParameter
(
'more_information'
);
$contactId
=
$parameters
->
getParameter
(
'contact_id'
);
if
(
$moreInfo
&&
$groupId
&&
$contactId
)
{
// first check if contact is already in group, if not add
$count
=
civicrm_api3
(
'GroupContact'
,
'getcount'
,
[
'group_id'
=>
$groupId
,
'status'
=>
"Added"
,
'contact_id'
=>
$contactId
,
]);
if
(
$count
==
0
)
{
try
{
civicrm_api3
(
'GroupContact'
,
'create'
,
[
'group_id'
=>
$groupId
,
'contact_id'
=>
$contactId
,
]);
}
catch
(
\CiviCRM_API3_Exception
$ex
)
{
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
info.xml
+
2
−
2
View file @
99117721
...
...
@@ -14,8 +14,8 @@
<url
desc=
"Support"
>
https://civicoop.org
</url>
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
2020-1
1
-1
8
</releaseDate>
<version>
1.
8
</version>
<releaseDate>
2020-1
2
-1
6
</releaseDate>
<version>
1.
9
</version>
<develStage>
beta
</develStage>
<compatibility>
<ver>
4.7
</ver>
...
...
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