👾 bug fix: don't call APIWrapper twice
no more double soft credits
This commit is contained in:
parent
e5a0400b34
commit
6a29b0b37c
1 changed files with 25 additions and 11 deletions
|
@ -15,18 +15,32 @@ function twinglecampaign_civicrm_config(&$config) {
|
||||||
_twinglecampaign_civix_civicrm_config($config);
|
_twinglecampaign_civix_civicrm_config($config);
|
||||||
|
|
||||||
// This dispatchers add event listeners to TwingleDonation.submit
|
// 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.
|
// donations to TwingleCampaigns and create soft credits for event initiators.
|
||||||
|
|
||||||
|
// Do only add listeners once
|
||||||
|
if (!in_array(
|
||||||
|
["CRM_TwingleCampaign_Utils_APIWrapper", "PREPARE"],
|
||||||
|
Civi::dispatcher()->getListeners('civi.api.prepare'))
|
||||||
|
) {
|
||||||
Civi::dispatcher()->addListener(
|
Civi::dispatcher()->addListener(
|
||||||
'civi.api.prepare',
|
'civi.api.prepare',
|
||||||
['CRM_TwingleCampaign_Utils_APIWrapper', 'PREPARE'],
|
['CRM_TwingleCampaign_Utils_APIWrapper', 'PREPARE'],
|
||||||
-100
|
-100
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do only add listeners once
|
||||||
|
if (!in_array(
|
||||||
|
["CRM_TwingleCampaign_Utils_APIWrapper", "RESPOND"],
|
||||||
|
Civi::dispatcher()->getListeners('civi.api.respond')
|
||||||
|
)) {
|
||||||
Civi::dispatcher()->addListener(
|
Civi::dispatcher()->addListener(
|
||||||
'civi.api.respond',
|
'civi.api.respond',
|
||||||
['CRM_TwingleCampaign_Utils_APIWrapper', 'RESPOND'],
|
['CRM_TwingleCampaign_Utils_APIWrapper', 'RESPOND'],
|
||||||
-100
|
-100
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue