From 7a94e4380104f09a4955360778406069f29c2870 Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Tue, 29 Sep 2020 16:12:35 +0200 Subject: [PATCH] set values and attributes in the right order --- api/v3/TwingleSync/models/TwingleProject.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/v3/TwingleSync/models/TwingleProject.php b/api/v3/TwingleSync/models/TwingleProject.php index 7079108..cb3d743 100644 --- a/api/v3/TwingleSync/models/TwingleProject.php +++ b/api/v3/TwingleSync/models/TwingleProject.php @@ -43,14 +43,21 @@ class TwingleProject { $this->values = $values; $this->project_id = $this->values['id']; + // Set timestamp + $this->timestamp = $this->values['last_update']; + // Translate values if values come from CiviCRM Campaign API if ($translate) { $this->values = $this->translateValues(TRUE); $this->id = $values['id']; + } else { + // Format data types for import into CiviCRM + $this->formatForImport($this->values); } - // Format data types of the values for import into CiviCRM - $this->formatForImport($this->values); + // Add necessary values + $this->values['campaign_type_id'] = 'twingle_project'; + $this->values['title'] = $this->values['name']; // Fetch custom field mapping once self::init();