Separate export into separate classe to allow unravelling of component handling
authoreileen <emcnaughton@wikimedia.org>
Fri, 18 Sep 2020 03:51:38 +0000 (15:51 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 18 Sep 2020 06:16:10 +0000 (18:16 +1200)
CRM/Export/Controller/Standalone.php
CRM/Export/Form/Map.php
CRM/Export/Form/Select.php
CRM/Export/Form/Select/Case.php
CRM/Member/Export/Form/Map.php [new file with mode: 0644]
CRM/Member/Export/Form/Select.php [new file with mode: 0644]
CRM/Member/Task.php

index f95f4b8d84cf8b4f622de5bce87bb410d1d6f879..2d3074eebdca7f2b0e0838074b3f94fac7024548 100644 (file)
@@ -72,7 +72,7 @@ class CRM_Export_Controller_Standalone extends CRM_Core_Controller {
     $className = 'CRM_' . $this->getComponent($this->get('entity')) . '_Task';
     foreach ($className::tasks() as $taskId => $task) {
       $taskForm = (array) $task['class'];
-      if ($taskForm[0] == 'CRM_Export_Form_Select') {
+      if (strpos($taskForm[0], 'CRM_Export_Form_Select') === 0) {
         $values['task'] = $taskId;
       }
     }
index a4f64d533f4d9acb364e53c5d80cae189edf6f0b..9e4e5fbaf1f5fc7233356e3e103e6818b3308c9c 100644 (file)
@@ -27,6 +27,15 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
    */
   protected $_mappingId;
 
+  /**
+   * Use the form name to create the tpl file name.
+   *
+   * @return string
+   */
+  public function getTemplateFileName() {
+    return 'CRM/Export/Form/Map.tpl';
+  }
+
   /**
    * Build the form object.
    */
index 3570008e59782944381a96dcbe03ddc4d9c29db0..041fee844d921567b35f5ae6595ed3bd852dba1e 100644 (file)
@@ -52,6 +52,15 @@ class CRM_Export_Form_Select extends CRM_Core_Form_Task {
 
   public $_componentTable;
 
+  /**
+   * Use the form name to create the tpl file name.
+   *
+   * @return string
+   */
+  public function getTemplateFileName() {
+    return 'CRM/Export/Form/Select.tpl';
+  }
+
   /**
    * Build all the data structures needed to build the form.
    *
index 3fd18998c6cadc5f3637f6a73b9eb1a61138896f..c310aa9a489eff40f18baac5f0361ef5792bdd1f 100644 (file)
@@ -25,13 +25,4 @@ class CRM_Export_Form_Select_Case extends CRM_Export_Form_Select {
    */
   protected $queryMode = CRM_Contact_BAO_Query::MODE_CASE;
 
-  /**
-   * Use the form name to create the tpl file name.
-   *
-   * @return string
-   */
-  public function getTemplateFileName() {
-    return 'CRM/Export/Form/Select.tpl';
-  }
-
 }
diff --git a/CRM/Member/Export/Form/Map.php b/CRM/Member/Export/Form/Map.php
new file mode 100644 (file)
index 0000000..9456d43
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+/**
+ * This class gets the name of the file to upload
+ */
+class CRM_Member_Export_Form_Map extends CRM_Export_Form_Map {
+
+}
diff --git a/CRM/Member/Export/Form/Select.php b/CRM/Member/Export/Form/Select.php
new file mode 100644 (file)
index 0000000..f4cc4ba
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+/**
+ * This class gets the name of the file to upload
+ */
+class CRM_Member_Export_Form_Select extends CRM_Export_Form_Select {
+
+}
index 661f2a72fc00f3b1a29b7519b331edbdc245f1d2..ade20080e17c79286165606a058ba640f90489fa 100644 (file)
@@ -55,8 +55,8 @@ class CRM_Member_Task extends CRM_Core_Task {
         self::TASK_EXPORT => [
           'title' => ts('Export members'),
           'class' => [
-            'CRM_Export_Form_Select',
-            'CRM_Export_Form_Map',
+            'CRM_Member_Export_Form_Select',
+            'CRM_Member_Export_Form_Map',
           ],
           'result' => FALSE,
         ],