make api call work for TwingleProject & TwingleEvent

This commit is contained in:
Marc Michalsky forumZFD 2020-12-15 14:55:23 +01:00
parent aaba5ce953
commit 1df6230bad
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -64,11 +64,17 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
$single = FALSE; $single = FALSE;
$result = civicrm_api3($this->className, 'get', [ $query = ['sequential' => 1,];
'sequential' => 1,
'is_active' => 1, switch($this->className) {
'project_id' => $this->values['id'], case 'TwingleProject':
]); $query['project_id'] = $this->values['id'];
break;
case 'TwingleEvent':
$query['event_id'] = $this->values['id'];
}
$result = civicrm_api3($this->className, 'get', $query);
// If there is more than one campaign for this entity, handle the duplicates // If there is more than one campaign for this entity, handle the duplicates
if ($result['count'] > 1) { if ($result['count'] > 1) {