From 25fb91b42e9ce65ad153b1dea95b5d72085189d3 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 30 Mar 2023 16:06:13 +1300 Subject: [PATCH] Import templates Set created_id, expires_date appropriately This tweaks just-merged userJob functionality. When creating an import job it is not correct to use the created_id or expires_date from the template - but these should be set appropriately, rather than left blank --- CRM/Import/Form/DataSource.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Import/Form/DataSource.php b/CRM/Import/Form/DataSource.php index 3668ac1dae..3decffef26 100644 --- a/CRM/Import/Form/DataSource.php +++ b/CRM/Import/Form/DataSource.php @@ -219,8 +219,10 @@ abstract class CRM_Import_Form_DataSource extends CRM_Import_Forms { $mappingName = substr($userJobName, 7); $mappingID = Mapping::get(FALSE)->addWhere('name', '=', $mappingName)->addSelect('id')->execute()->first()['id']; // Unset fields that should not be copied over. - unset($userJob['id'], $userJob['name'], $userJob['created_id'], $userJob['created_date'], $userJob['expires_date'], $userJob['is_template'], $userJob['queue_id'], $userJob['start_date'], $userJob['end_date']); + unset($userJob['id'], $userJob['name'], $userJob['created_date'], $userJob['is_template'], $userJob['queue_id'], $userJob['start_date'], $userJob['end_date']); $userJob['metadata']['template_id'] = $templateID; + $userJob['created_id'] = CRM_Core_Session::getLoggedInContactID(); + $userJob['expires_date'] = '+1 week'; $userJobID = UserJob::create(FALSE)->setValues($userJob)->execute()->first()['id']; $this->set('user_job_id', $userJobID); $userJob['metadata']['submitted_values']['savedMapping'] = $mappingID; -- 2.25.1