👾 bug fix: project id

This commit is contained in:
Marc Michalsky forumZFD 2021-04-12 11:47:43 +02:00
parent 1954f90f79
commit 4bcc4cf1fb
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
2 changed files with 12 additions and 3 deletions

View file

@ -41,6 +41,15 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign {
* CiviCRM Campaign id
*/
public function __construct(array $values = [], int $id = NULL) {
// If the $values originally come from the TwingleProject.get API, they
// contain the internal CiviCRM id as 'id' and the external Twingle id as
// 'project_id'. In this case 'id' gets replaced with 'project_id'
if (isset($values['project_id'])) {
$values['id'] = $values['project_id'];
unset($values['project_id']);
}
parent::__construct($values, $id);
$this->prefix = 'twingle_project_';