From e2710fee5aba1d6e3d65392f066d8bb559605e1b Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 18 Sep 2020 15:51:38 +1200 Subject: [PATCH] Separate export into separate classe to allow unravelling of component handling --- CRM/Export/Controller/Standalone.php | 2 +- CRM/Export/Form/Map.php | 9 +++++++++ CRM/Export/Form/Select.php | 9 +++++++++ CRM/Export/Form/Select/Case.php | 9 --------- CRM/Member/Export/Form/Map.php | 23 +++++++++++++++++++++++ CRM/Member/Export/Form/Select.php | 23 +++++++++++++++++++++++ CRM/Member/Task.php | 4 ++-- 7 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 CRM/Member/Export/Form/Map.php create mode 100644 CRM/Member/Export/Form/Select.php diff --git a/CRM/Export/Controller/Standalone.php b/CRM/Export/Controller/Standalone.php index f95f4b8d84..2d3074eebd 100644 --- a/CRM/Export/Controller/Standalone.php +++ b/CRM/Export/Controller/Standalone.php @@ -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; } } diff --git a/CRM/Export/Form/Map.php b/CRM/Export/Form/Map.php index a4f64d533f..9e4e5fbaf1 100644 --- a/CRM/Export/Form/Map.php +++ b/CRM/Export/Form/Map.php @@ -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. */ diff --git a/CRM/Export/Form/Select.php b/CRM/Export/Form/Select.php index 3570008e59..041fee844d 100644 --- a/CRM/Export/Form/Select.php +++ b/CRM/Export/Form/Select.php @@ -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. * diff --git a/CRM/Export/Form/Select/Case.php b/CRM/Export/Form/Select/Case.php index 3fd18998c6..c310aa9a48 100644 --- a/CRM/Export/Form/Select/Case.php +++ b/CRM/Export/Form/Select/Case.php @@ -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 index 0000000000..9456d43e3e --- /dev/null +++ b/CRM/Member/Export/Form/Map.php @@ -0,0 +1,23 @@ + [ '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, ], -- 2.25.1