Add 'SavePoint' to import to statusBounce back to
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 17 Feb 2023 02:17:00 +0000 (15:17 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 17 Feb 2023 02:17:00 +0000 (15:17 +1300)
CRM/Core/Form.php
CRM/Import/Form/DataSource.php

index f71fb5335bb5b712050b08c6bb78e85e3e6a1feb..fbc1eedee143b1589d7382219a798f34f02d613e 100644 (file)
@@ -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
    */
index 29008b234a030a9da4be318ead32a938a047e5f9..6fef3da018d16ccb9582bf969e95ab7ccf3f2a72 100644 (file)
@@ -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());