From b22112db9ed336acf4b6a59cec0930001071db40 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 22 Mar 2023 10:19:41 +1300 Subject: [PATCH] [NFC] Add metadata about import jobs to MapField form This extra metadata has been part of a whole lot of PRs & somehow always winds up in conflict or otherwise so I'm adding it by itself, wihout any usage of it. Note that - this brings MapField into line with DataSource - there is nothing calling these functions as of this PR - it's just an attempt to get the extra metadata added to the forms/ parsers without conflict --- CRM/Activity/Import/Form/MapField.php | 9 +++++++++ CRM/Activity/Import/Parser/Activity.php | 1 + CRM/Contact/Import/Form/MapField.php | 9 +++++++++ CRM/Contact/Import/Parser/Contact.php | 1 + CRM/Contribute/Import/Form/MapField.php | 9 +++++++++ CRM/Contribute/Import/Parser/Contribution.php | 1 + CRM/Core/BAO/UserJob.php | 1 + CRM/Custom/Import/Form/MapField.php | 9 +++++++++ CRM/Custom/Import/Parser/Api.php | 1 + CRM/Event/Import/Form/MapField.php | 9 +++++++++ CRM/Event/Import/Parser/Participant.php | 1 + CRM/Member/Import/Parser/Membership.php | 2 ++ Civi/UserJob/UserJobInterface.php | 2 ++ 13 files changed, 55 insertions(+) diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index 6597972c63..2d79f4b555 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -20,6 +20,15 @@ */ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { + /** + * Get the name of the type to be stored in civicrm_user_job.type_id. + * + * @return string + */ + public function getUserJobType(): string { + return 'activity_import'; + } + /** * @var bool */ diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index 4f31f50c7e..0517dd1abb 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -40,6 +40,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Import_Parser { 'name' => 'activity_import', 'label' => ts('Activity Import'), 'entity' => 'Activity', + 'url' => 'civicrm/import/activity', ], ]; } diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index d64617b4be..79778edf73 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -24,6 +24,15 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { use CRM_Contact_Import_MetadataTrait; + /** + * Get the name of the type to be stored in civicrm_user_job.type_id. + * + * @return string + */ + public function getUserJobType(): string { + return 'contact_import'; + } + /** * An array of all contact fields with * formatted custom field names. diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index e86e99c39a..31fda9dfa1 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -91,6 +91,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { 'name' => 'contact_import', 'label' => ts('Contact Import'), 'entity' => 'Contact', + 'url' => 'civicrm/import/contact', ], ]; } diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 6721a4f836..5e73a7cd30 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -20,6 +20,15 @@ */ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { + /** + * Get the name of the type to be stored in civicrm_user_job.type_id. + * + * @return string + */ + public function getUserJobType(): string { + return 'contribution_import'; + } + /** * Should contact fields be filtered which determining fields to show. * diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 098bb90e6d..c915903bb5 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -52,6 +52,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { 'name' => 'contribution_import', 'label' => ts('Contribution Import'), 'entity' => 'Contribution', + 'url' => 'civicrm/import/contribution', ], ]; } diff --git a/CRM/Core/BAO/UserJob.php b/CRM/Core/BAO/UserJob.php index c9051d0b08..63fc46c0d5 100644 --- a/CRM/Core/BAO/UserJob.php +++ b/CRM/Core/BAO/UserJob.php @@ -144,6 +144,7 @@ class CRM_Core_BAO_UserJob extends CRM_Core_DAO_UserJob implements \Civi\Core\Ho * -label * -class * -entity + * -url * * @return array */ diff --git a/CRM/Custom/Import/Form/MapField.php b/CRM/Custom/Import/Form/MapField.php index 7a7b8726c6..df9e5a83a6 100644 --- a/CRM/Custom/Import/Form/MapField.php +++ b/CRM/Custom/Import/Form/MapField.php @@ -5,6 +5,15 @@ */ class CRM_Custom_Import_Form_MapField extends CRM_Import_Form_MapField { + /** + * Get the name of the type to be stored in civicrm_user_job.type_id. + * + * @return string + */ + public function getUserJobType(): string { + return 'custom_field_import'; + } + /** * Build the form object. * diff --git a/CRM/Custom/Import/Parser/Api.php b/CRM/Custom/Import/Parser/Api.php index 721113fc2e..2b2cbbcba2 100644 --- a/CRM/Custom/Import/Parser/Api.php +++ b/CRM/Custom/Import/Parser/Api.php @@ -26,6 +26,7 @@ class CRM_Custom_Import_Parser_Api extends CRM_Import_Parser { 'name' => 'custom_field_import', 'label' => ts('Multiple Value Custom Field Import'), 'entity' => 'Contact', + 'url' => 'civicrm/import/custom', ], ]; } diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index 16dbef549b..fe1c4dd2cd 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -20,6 +20,15 @@ */ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { + /** + * Get the name of the type to be stored in civicrm_user_job.type_id. + * + * @return string + */ + public function getUserJobType(): string { + return 'participant_import'; + } + /** * Set variables up before form is built. * diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index 923143d14c..3c50b9ced0 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -77,6 +77,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Import_Parser { 'name' => 'participant_import', 'label' => ts('Participant Import'), 'entity' => 'Participant', + 'url' => 'civicrm/import/participant', ], ]; } diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index 944119a186..84b6edb729 100644 --- a/CRM/Member/Import/Parser/Membership.php +++ b/CRM/Member/Import/Parser/Membership.php @@ -65,6 +65,8 @@ class CRM_Member_Import_Parser_Membership extends CRM_Import_Parser { 'name' => 'membership_import', 'label' => ts('Membership Import'), 'entity' => 'Membership', + 'url' => 'civicrm/import/membership', + ], ]; } diff --git a/Civi/UserJob/UserJobInterface.php b/Civi/UserJob/UserJobInterface.php index bf259bd2f5..4a5bbaade2 100644 --- a/Civi/UserJob/UserJobInterface.php +++ b/Civi/UserJob/UserJobInterface.php @@ -18,6 +18,8 @@ interface UserJobInterface { * - name * - id (generally the same as name) * - label + * - entity + * - url * * e.g. ['activity_import' => ['id' => 'activity_import', 'label' => ts('Activity Import'), 'name' => 'activity_import']] * -- 2.25.1