From 9f2b5c4913695ec11fdf20e4871acf56b269276f Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Tue, 29 Sep 2020 14:15:34 +0200 Subject: [PATCH] add deactivate() function to deactivate a project --- api/v3/TwingleSync/models/TwingleProject.php | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/api/v3/TwingleSync/models/TwingleProject.php b/api/v3/TwingleSync/models/TwingleProject.php index 43c6068..84a39bf 100644 --- a/api/v3/TwingleSync/models/TwingleProject.php +++ b/api/v3/TwingleSync/models/TwingleProject.php @@ -271,6 +271,27 @@ class TwingleProject { } } + /** + * Deactivate a project + * + * @return bool + * @throws \CiviCRM_API3_Exception + */ + public function deactivate() { + $result = civicrm_api3('Campaign', 'create', [ + 'title' => $this->values['title'], + 'id' => $this->id, + 'is_active' => '0', + ]); + + if ($result['is_error'] == 0) { + return TRUE; + } + else { + return FALSE; + } + } + public function syncSettings() { }