From 5569ee67aa484653af88fd4deb4b654340d9f670 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 17 Feb 2023 15:17:00 +1300 Subject: [PATCH] Add 'SavePoint' to import to statusBounce back to --- CRM/Core/Form.php | 11 +++++++++++ CRM/Import/Form/DataSource.php | 1 + 2 files changed, 12 insertions(+) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index f71fb5335b..fbc1eedee1 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -2615,6 +2615,17 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } } + /** + * Push the current url to the userContext. + * + * This is like a save point :-). The next status bounce will + * return the browser to this url unless another is added. + */ + protected function pushUrlToUserContext(): void { + CRM_Core_Session::singleton() + ->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')); + } + /** * Set options and attributes for chain select fields based on the controlling field's value */ diff --git a/CRM/Import/Form/DataSource.php b/CRM/Import/Form/DataSource.php index 29008b234a..6fef3da018 100644 --- a/CRM/Import/Form/DataSource.php +++ b/CRM/Import/Form/DataSource.php @@ -25,6 +25,7 @@ abstract class CRM_Import_Form_DataSource extends CRM_Import_Forms { * Set variables up before form is built. */ public function preProcess(): void { + $this->pushUrlToUserContext(); // check for post max size CRM_Utils_Number::formatUnitSize(ini_get('post_max_size'), TRUE); $this->assign('importEntity', $this->getTranslatedEntity()); -- 2.25.1