Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Partners
CiviCooP
AIVL
aivlspecificactions
Commits
f94e28c4
Commit
f94e28c4
authored
Mar 01, 2021
by
ErikHommel
Browse files
fix issue 7766 - sign petition only once
parent
86c034a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Civi/Aivlspecificactions/Actions/PetitionActivity.php
View file @
f94e28c4
...
...
@@ -68,9 +68,37 @@ class PetitionActivity extends AbstractAction {
* @throws ExecutionException
*/
public
function
doAction
(
ParameterBagInterface
$parameters
,
ParameterBagInterface
$output
)
{
$this
->
addPetitionActivity
(
$parameters
,
$output
);
// temporarily: add to Nieuwsbrief group if more information ticked
$this
->
addNieuwsbrief
(
$parameters
);
if
(
!
$this
->
signedPetitionEarlier
(
$parameters
))
{
$this
->
addPetitionActivity
(
$parameters
,
$output
);
// temporarily: add to Nieuwsbrief group if more information ticked
$this
->
addNieuwsbrief
(
$parameters
);
}
else
{
throw
new
ExecutionException
(
E
::
ts
(
'Petition was already signed by this contact'
));
}
}
/**
* Methdo to check if the contact already signed this petition
*
* @param $parameters
* @return bool
*/
private
function
signedPetitionEarlier
(
$parameters
)
{
$contactId
=
$parameters
->
getParameter
(
'contact_id'
);
$campaignId
=
$parameters
->
getParameter
(
'campaign_id'
);
$activityTypeId
=
$this
->
configuration
->
getParameter
(
'activity_type_id'
);
if
(
$contactId
&&
$campaignId
&&
$activityTypeId
)
{
$count
=
civicrm_api3
(
'Activity'
,
'getcount'
,
[
'activity_type_id'
=>
$activityTypeId
,
'campaign_id'
=>
$campaignId
,
'target_contact_id'
=>
$contactId
,
]);
if
(
$count
>
0
)
{
return
TRUE
;
}
}
return
FALSE
;
}
/**
...
...
info.xml
View file @
f94e28c4
...
...
@@ -14,9 +14,9 @@
<url
desc=
"Support"
>
https://civicoop.org
</url>
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
2021-0
1-20
</releaseDate>
<version>
1.1
2
</version>
<develStage>
beta
</develStage>
<releaseDate>
2021-0
3-01
</releaseDate>
<version>
1.1
3
</version>
<develStage>
stable
</develStage>
<compatibility>
<ver>
4.7
</ver>
</compatibility>
...
...
@@ -28,7 +28,7 @@
<classloader>
<psr4
prefix=
"Civi\"
path=
"Civi"
/>
</classloader>
<comments>
Extension is being
developed
</comments>
<comments>
Extension is being
used in live
</comments>
<civix>
<namespace>
CRM/Aivlspecificactions
</namespace>
</civix>
...
...
Write
Preview
Supports
Markdown
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