👾 bug fix: don't call APIWrapper twice

no more double soft credits
This commit is contained in:
Marc Michalsky forumZFD 2021-03-08 19:00:50 +01:00
parent e5a0400b34
commit 6a29b0b37c
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -15,18 +15,32 @@ function twinglecampaign_civicrm_config(&$config) {
_twinglecampaign_civix_civicrm_config($config);
// This dispatchers add event listeners to TwingleDonation.submit
// (de.systopia.twingle) and call an API-Wrapper which maps incoming Twingle
// (de.systopia.twingle) to call an API-Wrapper which maps incoming Twingle
// donations to TwingleCampaigns and create soft credits for event initiators.
Civi::dispatcher()->addListener(
'civi.api.prepare',
['CRM_TwingleCampaign_Utils_APIWrapper', 'PREPARE'],
-100
);
Civi::dispatcher()->addListener(
'civi.api.respond',
['CRM_TwingleCampaign_Utils_APIWrapper', 'RESPOND'],
-100
);
// Do only add listeners once
if (!in_array(
["CRM_TwingleCampaign_Utils_APIWrapper", "PREPARE"],
Civi::dispatcher()->getListeners('civi.api.prepare'))
) {
Civi::dispatcher()->addListener(
'civi.api.prepare',
['CRM_TwingleCampaign_Utils_APIWrapper', 'PREPARE'],
-100
);
}
// Do only add listeners once
if (!in_array(
["CRM_TwingleCampaign_Utils_APIWrapper", "RESPOND"],
Civi::dispatcher()->getListeners('civi.api.respond')
)) {
Civi::dispatcher()->addListener(
'civi.api.respond',
['CRM_TwingleCampaign_Utils_APIWrapper', 'RESPOND'],
-100
);
}
}