From f748a01aab5cfd3ff993436ea2bf60054e2e4aed Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 24 Nov 2022 16:43:09 +1300 Subject: [PATCH] Over-ride monitor page within the extension This gives us a usable monitoring page for imports, without having to plan out a solution that covers all potential use cases. It should be a quick way to get this functionality operational --- ext/civiimport/civiimport.php | 28 ++++++++++++++++++- .../templates/CRM/Import/Monitor.tpl | 15 ++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 ext/civiimport/templates/CRM/Import/Monitor.tpl diff --git a/ext/civiimport/civiimport.php b/ext/civiimport/civiimport.php index fe0aa5c517e7..556e79e25dc9 100644 --- a/ext/civiimport/civiimport.php +++ b/ext/civiimport/civiimport.php @@ -1,5 +1,6 @@ addWhere('id', '=', $userJobID) + ->execute()->first()['job_type']; + foreach (CRM_Core_BAO_UserJob::getTypes() as $userJobType) { + if ($userJobType['id'] === $jobType + && is_subclass_of($userJobType['class'], 'CRM_Import_Parser') + ) { + + $templateFile = 'CRM/Import/Monitor.tpl'; + Civi::resources() + ->addVars('civiimport', ['url' => CRM_Utils_System::url('civicrm/import/contact/summary', ['reset' => 1, 'user_job_id' => $userJobID])]); + break; + } + } + } + catch (UnauthorizedException $e) { + // We will not do anything here if not permissioned - leave it for the core page. + } + } + } } /** diff --git a/ext/civiimport/templates/CRM/Import/Monitor.tpl b/ext/civiimport/templates/CRM/Import/Monitor.tpl new file mode 100644 index 000000000000..d26134e448d6 --- /dev/null +++ b/ext/civiimport/templates/CRM/Import/Monitor.tpl @@ -0,0 +1,15 @@ +
+{literal} + +{/literal}