Skip to content
Snippets Groups Projects
Commit d7813e7d authored by ErikHommel's avatar ErikHommel
Browse files

fix issue 6757

parent 49068771
No related branches found
No related tags found
No related merge requests found
......@@ -64,22 +64,17 @@ class PetitionEmailPrefs extends AbstractAction {
* @throws
*/
private function setEmailPreferences($contactId) {
//todo use FormProcessor, for now use API call from be.aivlapi extension
$newsGroup = $this->getGroupTitle(\Civi::settings()->get('aivl_monthly_newsletter_group_id'));
$actionGroup = $this->getGroupTitle(\Civi::settings()->get('aivl_monthly_actions_group_id'));
if ($newsGroup && $actionGroup) {
try {
civicrm_api3("AivlEmailPreferences", "set", [
'contact_id' => $contactId,
$newsGroup => "1",
$actionGroup => "1",
]);
}
catch (\CiviCRM_API3_Exception $ex) {
\Civi::log()->warning(E::ts('Could not add contact with ID to newsletter and monthly
actions groups when processing petition in ') . __METHOD__ . E::ts( ", error message
from API: ") . $ex->getMessage());
}
try {
civicrm_api3("FormProcessor", "email_preferences", [
'contact_id' => $contactId,
'newsletter_and_actions' => "1",
'more_information' => "1",
]);
}
catch (\CiviCRM_API3_Exception $ex) {
\Civi::log()->warning(E::ts('Could not add contact with ID to newsletter and monthly
actions groups when processing petition in ') . __METHOD__ . E::ts( ", error message
from API FormProcessor email_preferences: ") . $ex->getMessage());
}
}
......
......@@ -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-08-18</releaseDate>
<version>1.6</version>
<releaseDate>2020-09-23</releaseDate>
<version>1.7</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment