diff --git a/drupal/sites/all/modules/civicrm/CRM/Core/DAO/Mapping.php b/drupal/sites/all/modules/civicrm/CRM/Core/DAO/Mapping.php
index 9a4e3ad636..f4832c0768 100644
--- a/drupal/sites/all/modules/civicrm/CRM/Core/DAO/Mapping.php
+++ b/drupal/sites/all/modules/civicrm/CRM/Core/DAO/Mapping.php
@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Mapping.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b25f314a77515ccdcff0c3bbf8e07fd2)
+ * (GenCodeChecksum:89c538397697d0633134470f9e8ac880)
*/
/**
@@ -23,6 +23,13 @@ class CRM_Core_DAO_Mapping extends CRM_Core_DAO {
*/
public static $_tableName = 'civicrm_mapping';
+ /**
+ * Field to show when displaying a record.
+ *
+ * @var string
+ */
+ public static $_labelField = 'name';
+
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
@@ -256,7 +263,8 @@ public static function indices($localize = TRUE) {
0 => 'name',
],
'localizable' => FALSE,
- 'sig' => 'civicrm_mapping::0::name',
+ 'unique' => TRUE,
+ 'sig' => 'civicrm_mapping::1::name',
],
];
return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
diff --git a/drupal/sites/all/modules/civicrm/CRM/Core/DAO/MappingField.php b/drupal/sites/all/modules/civicrm/CRM/Core/DAO/MappingField.php
index d004323ec0..368760145e 100644
--- a/drupal/sites/all/modules/civicrm/CRM/Core/DAO/MappingField.php
+++ b/drupal/sites/all/modules/civicrm/CRM/Core/DAO/MappingField.php
@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/MappingField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3df2e91108cdb428e82485a6640e1721)
+ * (GenCodeChecksum:1648502957f4cc8a6cf10f5967833360)
*/
/**
@@ -23,6 +23,13 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
*/
public static $_tableName = 'civicrm_mapping_field';
+ /**
+ * Field to show when displaying a record.
+ *
+ * @var string
+ */
+ public static $_labelField = 'name';
+
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
diff --git a/drupal/sites/all/modules/civicrm/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php b/drupal/sites/all/modules/civicrm/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php
deleted file mode 100644
index 97cbd89b3b..0000000000
--- a/drupal/sites/all/modules/civicrm/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php
+++ /dev/null
@@ -1,42 +0,0 @@
-getFieldByName('name')->setRequired(TRUE);
- }
-
- /**
- * @param string $entity
- * @param string $action
- *
- * @return bool
- */
- public function applies($entity, $action) {
- return strpos($entity, 'Mapping') === 0 && $action === 'create';
- }
-
-}
diff --git a/drupal/sites/all/modules/civicrm/xml/schema/Core/Mapping.xml b/drupal/sites/all/modules/civicrm/xml/schema/Core/Mapping.xml
index f629d6b0d5..281a0bcd24 100644
--- a/drupal/sites/all/modules/civicrm/xml/schema/Core/Mapping.xml
+++ b/drupal/sites/all/modules/civicrm/xml/schema/Core/Mapping.xml
@@ -5,6 +5,7 @@
Mapping
civicrm_mapping
Store field mappings in import or export for reuse
+ name
1.2
id
diff --git a/drupal/sites/all/modules/civicrm/xml/schema/Core/MappingField.xml b/drupal/sites/all/modules/civicrm/xml/schema/Core/MappingField.xml
index 10cf1c4d54..af6c0ef907 100644
--- a/drupal/sites/all/modules/civicrm/xml/schema/Core/MappingField.xml
+++ b/drupal/sites/all/modules/civicrm/xml/schema/Core/MappingField.xml
@@ -5,6 +5,7 @@
MappingField
civicrm_mapping_field
Individual field mappings for Mapping
+ name
1.2
id
diff --git a/drupal/sites/default/civicrm/extensions/wmf-civicrm/Managed/UserJobTemplates.mgd.php b/drupal/sites/default/civicrm/extensions/wmf-civicrm/Managed/UserJobTemplates.mgd.php
new file mode 100644
index 0000000000..c6c269af4c
--- /dev/null
+++ b/drupal/sites/default/civicrm/extensions/wmf-civicrm/Managed/UserJobTemplates.mgd.php
@@ -0,0 +1,739 @@
+setLoadOptions([
+ 'id',
+ 'name',
+ 'label',
+ ])
+ ->addWhere('name', '=', 'soft_credit_type_id')
+ ->addSelect('options')
+ ->execute()->first()['options'];
+foreach ($softCreditTypes as $type) {
+ if ($type['name'] === 'workplace') {
+ $workplaceTypeID = $type['id'];
+ }
+ if ($type['name'] === 'matched_gift') {
+ $matchedTypeID = $type['id'];
+ }
+}
+
+$individualDedupeRule = CRM_Core_DAO::singleValueQuery("SELECT name FROM civicrm_dedupe_rule_group WHERE is_reserved = 1 AND contact_type = 'Individual' AND used = 'General'");
+/**
+ * Templates for Matching Gift imports
+ */
+$entities = [
+ [
+ // This name doubles as a label from the _ onwards. The Mapping name
+ // must match UserJob name but UserJob pre-pends a import_
+ 'name' => 'import_Matching Gifts Organizations',
+ 'entity' => 'UserJob',
+ 'cleanup' => 'unused',
+ 'update' => 'never',
+ 'params' => [
+ 'version' => 4,
+ 'match' => ['name'],
+ 'values' => [
+ 'job_type' => 'contribution_import',
+ 'status_id' => 2,
+ 'is_template' => TRUE,
+ 'name' => 'import_Matching Gifts Organizations',
+ 'metadata' => [
+ 'submitted_values' => [
+ 'contactType' => NULL,
+ 'contactSubType' => NULL,
+ 'dateFormats' => '2',
+ 'dataSource' => 'CRM_Import_DataSource_CSV',
+ 'use_existing_upload' => NULL,
+ 'dedupe_rule_id' => NULL,
+ 'onDuplicate' => '1',
+ 'disableUSPS' => NULL,
+ 'doGeocodeAddress' => NULL,
+ 'multipleCustomData' => NULL,
+ 'mapper' => [
+ ['financial_type_id'],
+ ['contribution_extra.gateway_txn_id'],
+ ['total_amount'],
+ [''],
+ ['fee_amount'],
+ ['receive_date'],
+ ['payment_instrument_id'],
+ ['check_number'],
+ ['contribution_contact_id'],
+ ['organization_name'],
+ [''],
+ [''],
+ [''],
+ [''],
+ [''],
+ [''],
+ ['']
+ ],
+ 'skipColumnHeader' => '1',
+ 'fieldSeparator' => ','
+ ],
+ 'template_id' => 307,
+ 'Template' => [],
+ 'DataSource' => [
+ 'column_headers' => [
+ 'Batch',
+ 'Contribution Type',
+ 'Transaction ID',
+ 'Total Amount',
+ 'Source',
+ 'Fee Amount',
+ 'Postmark Date',
+ 'Received Date',
+ 'Payment Instrument',
+ 'Check Number',
+ 'Restrictions',
+ 'Gift Source',
+ 'Direct Mail Appeal',
+ 'Organization CID',
+ 'Organization Name',
+ 'Employer of',
+ 'Soft Credit to First Name',
+ 'Soft Credit to Last Name',
+ 'Street Address',
+ 'Additional Address 1',
+ 'Additional Address 2',
+ 'City',
+ 'State/Province',
+ 'Postal Code',
+ 'Country',
+ 'Phone',
+ 'Email',
+ 'AC Flag',
+ 'Do Not Email',
+ 'Do Not Mail',
+ 'Do Not Phone',
+ 'Do Not SMS',
+ 'Is Opt Out'
+ ],
+ 'number_of_columns' => 33
+ ],
+ 'entity_configuration' => [
+ 'Contribution' => [
+ 'action' => 'create'
+ ],
+ 'Contact' => [
+ 'action' => 'select',
+ 'contact_type' => 'Organization',
+ 'dedupe_rule' => 'OrganizationUnsupervised'
+ ],
+ 'SoftCreditContact' => [
+ 'contact_type' => 'Individual',
+ 'soft_credit_type_id' => $matchedTypeID,
+ 'action' => 'save',
+ 'dedupe_rule' => $individualDedupeRule,
+ 'entity' => [
+ 'entity_data' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ]
+ ],
+ 'import_mappings' => [
+ [
+ 'name' => 'Gift_Information.import_batch_number',
+ 'default_value' => NULL,
+ 'column_number' => 0,
+ 'entity_data' => [
+ ]
+ ],
+ [
+ 'name' => 'financial_type_id',
+ 'default_value' => NULL,
+ 'column_number' => 1,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'contribution_extra.gateway_txn_id',
+ 'default_value' => NULL,
+ 'column_number' => 2,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'total_amount',
+ 'default_value' => NULL,
+ 'column_number' => 3,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 4,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'fee_amount',
+ 'default_value' => NULL,
+ 'column_number' => 5,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'contribution_extra.Postmark_Date',
+ 'default_value' => NULL,
+ 'column_number' => 6,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'receive_date',
+ 'default_value' => NULL,
+ 'column_number' => 7,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'payment_instrument_id',
+ 'default_value' => NULL,
+ 'column_number' => 8,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'check_number',
+ 'default_value' => NULL,
+ 'column_number' => 9,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'Gift_Data.Fund',
+ 'default_value' => NULL,
+ 'column_number' => 10,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'Gift_Data.Campaign',
+ 'default_value' => NULL,
+ 'column_number' => 11,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'Gift_Data.Appeal',
+ 'default_value' => NULL,
+ 'column_number' => 12,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'contribution_contact_id',
+ 'default_value' => NULL,
+ 'column_number' => 13,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'organization_name',
+ 'default_value' => NULL,
+ 'column_number' => 14,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 15,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => 'soft_credit.contact.first_name',
+ 'default_value' => NULL,
+ 'column_number' => 16,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.last_name',
+ 'default_value' => NULL,
+ 'column_number' => 17,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.street_address',
+ 'default_value' => NULL,
+ 'column_number' => 18,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.supplemental_address_1',
+ 'default_value' => NULL,
+ 'column_number' => 19,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.supplemental_address_2',
+ 'default_value' => NULL,
+ 'column_number' => 20,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.city',
+ 'default_value' => NULL,
+ 'column_number' => 21,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.state_province_id',
+ 'default_value' => NULL,
+ 'column_number' => 22,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.postal_code',
+ 'default_value' => NULL,
+ 'column_number' => 23,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.address_primary.country_id',
+ 'default_value' => NULL,
+ 'column_number' => 24,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.phone_primary.phone',
+ 'default_value' => NULL,
+ 'column_number' => 25,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => 'soft_credit.contact.email_primary.email',
+ 'default_value' => NULL,
+ 'column_number' => 26,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $matchedTypeID,
+ ]
+ ]
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 27,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 28,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 29,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 30,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 31,
+ 'entity_data' => []
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 32,
+ 'entity_data' => []
+ ]
+ ]
+ ],
+ ],
+ ],
+ ],
+ [
+ 'name' => 'import_Matching Gifts Individuals',
+ 'entity' => 'UserJob',
+ 'cleanup' => 'unused',
+ 'update' => 'never',
+ 'params' => [
+ 'version' => 4,
+ 'match' => ['name'],
+ 'values' => [
+ 'job_type' => 'contribution_import',
+ 'status_id' => 2,
+ 'is_template' => TRUE,
+ 'name' => 'import_Matching Gifts Individuals',
+ 'metadata' => [
+ 'submitted_values' => [
+ 'contactType' => NULL,
+ 'contactSubType' => NULL,
+ 'dateFormats' => '2',
+ 'dataSource' => 'CRM_Import_DataSource_CSV',
+ 'use_existing_upload' => NULL,
+ 'dedupe_rule_id' => NULL,
+ 'onDuplicate' => '1',
+ 'disableUSPS' => NULL,
+ 'doGeocodeAddress' => NULL,
+ 'multipleCustomData' => NULL,
+ 'mapper' => [
+ ['financial_type_id'],
+ ['contribution_extra.gateway_txn_id'],
+ ['total_amount'],
+ [''],
+ ['fee_amount'],
+ ['receive_date'],
+ ['payment_instrument_id'],
+ ['check_number'],
+ ['contribution_source'],
+ [''],
+ [''],
+ [''],
+ [''],
+ [''],
+ [''],
+ [''],
+ ],
+ 'skipColumnHeader' => '1',
+ 'fieldSeparator' => ',',
+ ],
+ 'DataSource' => [
+ 'column_headers' => [
+ 'Batch',
+ 'Contribution Type',
+ 'Transaction ID',
+ 'Total Amount',
+ 'Source',
+ 'Fee Amount',
+ 'Postmark Date',
+ 'Received Date',
+ 'Payment Instrument',
+ 'Check Number',
+ 'Restrictions',
+ 'Gift Source',
+ 'Direct Mail Appeal',
+ 'First Name',
+ 'Last Name',
+ 'Employee of',
+ 'Organization Soft Credit CID',
+ 'Soft Credit to Organization',
+ 'Street Address',
+ 'Additional Address 1',
+ 'Additional Address 2',
+ 'City',
+ 'State/Province',
+ 'Postal Code',
+ 'Country',
+ 'Phone',
+ 'Email',
+ 'AC Flag',
+ 'Do Not Email',
+ 'Do Not Mail',
+ 'Do Not Phone',
+ 'Do Not SMS',
+ 'Is Opt Out',
+ ],
+ 'number_of_columns' => 33,
+ ],
+ 'entity_configuration' => [
+ 'Contribution' => [
+ 'action' => 'create',
+ ],
+ 'Contact' => [
+ 'action' => 'save',
+ 'contact_type' => 'Individual',
+ 'dedupe_rule' => $individualDedupeRule,
+ ],
+ 'SoftCreditContact' => [
+ 'contact_type' => 'Organization',
+ 'soft_credit_type_id' => $workplaceTypeID,
+ 'action' => 'save',
+ 'dedupe_rule' => 'Organization_Name',
+ 'entity' => [
+ 'entity_data' => [
+ 'soft_credit_type_id' => $workplaceTypeID,
+ ],
+ ],
+ ],
+ ],
+ 'import_mappings' => [
+ [
+ 'name' => 'Gift_Information.import_batch_number',
+ 'default_value' => NULL,
+ 'column_number' => 0,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'financial_type_id',
+ 'default_value' => NULL,
+ 'column_number' => 1,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'contribution_extra.gateway_txn_id',
+ 'default_value' => NULL,
+ 'column_number' => 2,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'total_amount',
+ 'default_value' => NULL,
+ 'column_number' => 3,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 4,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'fee_amount',
+ 'default_value' => NULL,
+ 'column_number' => 5,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'contribution_extra.Postmark_Date',
+ 'default_value' => NULL,
+ 'column_number' => 6,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'receive_date',
+ 'default_value' => NULL,
+ 'column_number' => 7,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'payment_instrument_id',
+ 'default_value' => NULL,
+ 'column_number' => 8,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'check_number',
+ 'default_value' => NULL,
+ 'column_number' => 9,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'Gift_Data.Fund',
+ 'default_value' => NULL,
+ 'column_number' => 10,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'contribution_source',
+ 'default_value' => NULL,
+ 'column_number' => 11,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'Gift_Data.Appeal',
+ 'default_value' => NULL,
+ 'column_number' => 12,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'first_name',
+ 'default_value' => NULL,
+ 'column_number' => 13,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'last_name',
+ 'default_value' => NULL,
+ 'column_number' => 14,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 15,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'soft_credit.contact.id',
+ 'default_value' => NULL,
+ 'column_number' => 16,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $workplaceTypeID,
+ ],
+ ],
+ ],
+ [
+ 'name' => 'soft_credit.contact.organization_name',
+ 'default_value' => NULL,
+ 'column_number' => 17,
+ 'entity_data' => [
+ 'soft_credit' => [
+ 'soft_credit_type_id' => $workplaceTypeID,
+ ],
+ ],
+ ],
+ [
+ 'name' => 'address_primary.street_address',
+ 'default_value' => NULL,
+ 'column_number' => 18,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'address_primary.supplemental_address_1',
+ 'default_value' => NULL,
+ 'column_number' => 19,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'address_primary.supplemental_address_2',
+ 'default_value' => NULL,
+ 'column_number' => 20,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'address_primary.city',
+ 'default_value' => NULL,
+ 'column_number' => 21,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'address_primary.state_province_id',
+ 'default_value' => NULL,
+ 'column_number' => 22,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'address_primary.postal_code',
+ 'default_value' => NULL,
+ 'column_number' => 23,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'address_primary.country_id',
+ 'default_value' => NULL,
+ 'column_number' => 24,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'phone_primary.phone',
+ 'default_value' => NULL,
+ 'column_number' => 25,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => 'email_primary.email',
+ 'default_value' => NULL,
+ 'column_number' => 26,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 27,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 28,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 29,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 30,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 31,
+ 'entity_data' => [],
+ ],
+ [
+ 'name' => '',
+ 'default_value' => NULL,
+ 'column_number' => 32,
+ 'entity_data' => [],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+];
+foreach ($entities as $template) {
+ $entities[] = [
+ 'name' => substr($template['name'], 7),
+ 'entity' => 'Mapping',
+ 'cleanup' => 'unused',
+ 'update' => 'never',
+ 'params' => [
+ 'version' => 4,
+ 'match' => ['name'],
+ 'values' => [
+ 'mapping_id:name' => 'Import Contribution',
+ 'name' => substr($template['name'], 7),
+ ],
+ ],
+ ];
+ foreach ($template['params']['values']['metadata']['submitted_values']['mapper'] as $column => $field) {
+ $entities[] = [
+
+ 'name' => $template['name'] . '_' . $column,
+ 'entity' => 'MappingField',
+ 'cleanup' => 'unused',
+ 'update' => 'never',
+ 'params' => [
+ 'version' => 4,
+ 'match' => ['mapping_id', 'column_number'],
+ 'values' => [
+ 'mapping_id.name' => substr($template['name'], 7),
+ 'name' => $field[0],
+ 'column_number' => $column,
+ ],
+ ],
+ ];
+ }
+}
+
+return $entities;
diff --git a/drupal/sites/default/civicrm/extensions/wmf-civicrm/tests/data/matching_gifts_individuals.csv b/drupal/sites/default/civicrm/extensions/wmf-civicrm/tests/data/matching_gifts_individuals.csv
new file mode 100644
index 0000000000..b818e916ce
--- /dev/null
+++ b/drupal/sites/default/civicrm/extensions/wmf-civicrm/tests/data/matching_gifts_individuals.csv
@@ -0,0 +1,4 @@
+Batch,Contribution Type,Transaction ID,Total Amount,Source,Fee Amount,Postmark Date,Received Date,Payment Instrument,Check Number,Restrictions,Gift Source,Direct Mail Appeal,First Name,Last Name,Employee of,Organization Soft Credit CID,Soft Credit to Organization,Street Address,Additional Address 1,Additional Address 2,City,State/Province,Postal Code,Country,Phone,Email,AC Flag,Do Not Email,Do Not Mail,Do Not Phone,Do Not SMS,Is Opt Out
+456,Engage,789,78,78.00 USD,,,,Check,33,Restricted - Foundation,Payroll Deduction,,Minnie,Mouse,,1,,,,,,,,,,,,,,,,
+456,Engage,,22,22.00 USD,3,,,Check,33,Unrestricted - General,Community Gift,,Mickey,Mouse,,,Disney,,,,,,,,,mickey@example.com,,,,,,
+456,Engage,,1000,1000.00 USD,,,,Check,33,Unrestricted - General,Benefactor Gift,,Donald,Duck,,12,,,,,,,,,,,,,,,,
diff --git a/drupal/sites/default/civicrm/extensions/wmf-civicrm/tests/data/matching_gifts_organizations.csv b/drupal/sites/default/civicrm/extensions/wmf-civicrm/tests/data/matching_gifts_organizations.csv
new file mode 100644
index 0000000000..d353564ba0
--- /dev/null
+++ b/drupal/sites/default/civicrm/extensions/wmf-civicrm/tests/data/matching_gifts_organizations.csv
@@ -0,0 +1,4 @@
+Batch,Contribution Type,Transaction ID,Total Amount,Source,Fee Amount,Postmark Date,Received Date,Payment Instrument,Check Number,Restrictions,Gift Source,Direct Mail Appeal,Organization CID,Organization Name,Employer of,Soft Credit to First Name,Soft Credit to Last Name,Street Address,Additional Address 1,Additional Address 2,City,State/Province,Postal Code,Country,Phone,Email,AC Flag,Do Not Email,Do Not Mail,Do Not Phone,Do Not SMS,Is Opt Out
+123,Engage,123,5,5 USD,,1/26/23,1/26/23,Check,123,Restricted - Foundation,Matching Gift,,,Disney,,Mickey,Mouse,,,,,,,,,,,,,,,
+123,Engage,,6,6 USD,3,1/27/23,1/26/23,Check,124,Restricted - Foundation,Matching Gift,,,Scrouge Bank,,Minnie,Mouse,,,,,,,,,,,,,,,
+123,Engage,,7,7 USD,,1/28/23,1/26/23,Check,125,Restricted - Foundation,Matching Gift,,,Big Business,,Donald,Duck,,,,,,,,,donald@example.com,,,,,,