From 19ddbb4ec46ca4e15d94b43d8fcc6d826b38cc66 Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Thu, 12 Nov 2020 17:37:37 +0100 Subject: [PATCH] process event data (urls, start date, status) --- CRM/TwingleCampaign/BAO/TwingleEvent.php | 22 ++++- CRM/TwingleCampaign/resources/campaigns.json | 80 ++++++++++++------- CRM/TwingleCampaign/resources/dictionary.json | 7 +- 3 files changed, 78 insertions(+), 31 deletions(-) diff --git a/CRM/TwingleCampaign/BAO/TwingleEvent.php b/CRM/TwingleCampaign/BAO/TwingleEvent.php index 4578777..9314f75 100644 --- a/CRM/TwingleCampaign/BAO/TwingleEvent.php +++ b/CRM/TwingleCampaign/BAO/TwingleEvent.php @@ -226,19 +226,26 @@ class TwingleEvent extends Campaign { if ($direction == self::IN) { - // Change timestamp into DateTime string + // Change timestamps into DateTime strings if ($values['updated_at']) { $values['updated_at'] = self::getDateTime($values['updated_at']); } + if ($values['confirmed_at']) { $values['confirmed_at'] = self::getDateTime($values['confirmed_at']); + $values['status_id'] = 'In Progress'; } + else { + $values['status_id'] = 'Planned'; + } + if ($values['created_at']) { $values['created_at'] = self::getDateTime($values['created_at']); } + if ($values['user_name']) { $values['user_name'] = $this->matchContact( $values['user_name'], @@ -246,6 +253,19 @@ class TwingleEvent extends Campaign { ); } + // Set campaign status + if ($values['deleted']) { + $values['status_id'] = 'Cancelled'; + } + + // Set URLs + if (is_array($values['urls'])) { + $values['url_internal'] = $values['urls']['show_internal']; + $values['url_external'] = $values['urls']['show_external']; + $values['url_edit_internal'] = $values['urls']['edit_internal']; + $values['url_edit_external'] = $values['urls']['edit_internal']; + } + } elseif ($direction == self::OUT) { diff --git a/CRM/TwingleCampaign/resources/campaigns.json b/CRM/TwingleCampaign/resources/campaigns.json index cbfa4af..387b1bf 100644 --- a/CRM/TwingleCampaign/resources/campaigns.json +++ b/CRM/TwingleCampaign/resources/campaigns.json @@ -117,21 +117,6 @@ "help_post": "Choose the project type. Allow users to create own events or to pay a membership fee.", "default_value": "default" }, - "twingle_project_project_target": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project target", - "name": "twingle_project_project_target", - "is_required": 0, - "is_searchable": 1, - "data_type": "Money", - "html_type": "Text", - "text_length": 32, - "is_active": 1, - "is_view": 0, - "weight": 7, - "help_post": "Donation target of the Project", - "default_value": "0" - }, "twingle_project_allow_more": { "custom_group_id": "Twingle_Project_Information", "label": "Twingle Project allow more", @@ -327,19 +312,6 @@ "is_view": 1, "weight": 6 }, - "twingle_event_target": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Target", - "name": "twingle_event_target", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 10, - "is_active": 1, - "is_view": 1, - "weight": 6 - }, "twingle_event_is_public": { "custom_group_id": "Twingle_Event_Information", "label": "Twingle Event is public", @@ -402,6 +374,58 @@ "is_active": 1, "is_view": 1, "weight": 11 + }, + "twingle_event_url_internal": { + "custom_group_id": "Twingle_Event_Information", + "label": "Twingle Event Internal URL", + "name": "twingle_event_url_internal", + "is_required": 0, + "is_searchable": 0, + "data_type": "String", + "html_type": "Text", + "text_length": 256, + "is_active": 1, + "is_view": 1, + "weight": 12 + }, + "twingle_event_url_external": { + "custom_group_id": "Twingle_Event_Information", + "label": "Twingle Event External URL", + "name": "twingle_event_url_external", + "is_required": 0, + "is_searchable": 0, + "data_type": "String", + "html_type": "Text", + "text_length": 256, + "is_active": 1, + "is_view": 1, + "weight": 13 + }, + "twingle_event_url_edit_internal": { + "custom_group_id": "Twingle_Event_Information", + "label": "Twingle Event Edit Internal URL", + "name": "twingle_event_url_edit_internal", + "is_required": 0, + "is_searchable": 0, + "data_type": "String", + "html_type": "Text", + "text_length": 256, + "is_active": 1, + "is_view": 1, + "weight": 14 + }, + "twingle_event_url_edit_external": { + "custom_group_id": "Twingle_Event_Information", + "label": "Twingle Event Edit External URL", + "name": "twingle_event_url_edit_external", + "is_required": 0, + "is_searchable": 0, + "data_type": "String", + "html_type": "Text", + "text_length": 256, + "is_active": 1, + "is_view": 1, + "weight": 15 } } } diff --git a/CRM/TwingleCampaign/resources/dictionary.json b/CRM/TwingleCampaign/resources/dictionary.json index 85f3b4a..150deff 100644 --- a/CRM/TwingleCampaign/resources/dictionary.json +++ b/CRM/TwingleCampaign/resources/dictionary.json @@ -1,10 +1,13 @@ { "TwingleProject": { "name": "title", - "last_update": "last_modified_date" + "last_update": "last_modified_date", + "project_target": "goal_revenue" }, "TwingleEvent": { "description": "title", - "updated_at": "last_modified_date" + "updated_at": "last_modified_date", + "created_at": "start_date", + "target": "goal_revenue" } } \ No newline at end of file