From 83a1c23432efbe7b96c3db288140f99de06532c0 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 26 May 2022 19:09:36 +1200 Subject: [PATCH] [Import] Add some not-yet-used functions that are prone to conflict --- CRM/Activity/Import/Form/DataSource.php | 12 ++++++++++++ CRM/Activity/Import/Form/MapField.php | 12 ++++++++++++ CRM/Activity/Import/Form/Preview.php | 12 ++++++++++++ CRM/Contribute/Import/Form/DataSource.php | 12 ++++++++++++ CRM/Contribute/Import/Form/MapField.php | 9 ++++++--- CRM/Contribute/Import/Form/Preview.php | 12 ++++++++++++ CRM/Custom/Import/Form/DataSource.php | 12 ++++++++++++ CRM/Custom/Import/Form/Preview.php | 12 ++++++++++++ CRM/Event/Import/Form/DataSource.php | 12 ++++++++++++ CRM/Event/Import/Form/MapField.php | 12 ++++++++++++ CRM/Event/Import/Form/Preview.php | 12 ++++++++++++ CRM/Import/Forms.php | 5 +++++ CRM/Member/Import/Form/DataSource.php | 12 ++++++++++++ CRM/Member/Import/Form/MapField.php | 12 ++++++++++++ CRM/Member/Import/Form/Preview.php | 12 ++++++++++++ 15 files changed, 167 insertions(+), 3 deletions(-) diff --git a/CRM/Activity/Import/Form/DataSource.php b/CRM/Activity/Import/Form/DataSource.php index a244cb7e0a..45838871d9 100644 --- a/CRM/Activity/Import/Form/DataSource.php +++ b/CRM/Activity/Import/Form/DataSource.php @@ -56,4 +56,16 @@ class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource { $this->submitFileForMapping('CRM_Activity_Import_Parser_Activity'); } + /** + * @return CRM_Activity_Import_Parser_Activity + */ + protected function getParser(): CRM_Activity_Import_Parser_Activity { + if (!$this->parser) { + $this->parser = new CRM_Activity_Import_Parser_Activity(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index 8008bc0412..2dc0f5ce5d 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -395,4 +395,16 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $parser->set($this); } + /** + * @return CRM_Activity_Import_Parser_Activity + */ + protected function getParser(): CRM_Activity_Import_Parser_Activity { + if (!$this->parser) { + $this->parser = new CRM_Activity_Import_Parser_Activity(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Activity/Import/Form/Preview.php b/CRM/Activity/Import/Form/Preview.php index 09e5bf2791..f26d7f67f6 100644 --- a/CRM/Activity/Import/Form/Preview.php +++ b/CRM/Activity/Import/Form/Preview.php @@ -126,4 +126,16 @@ class CRM_Activity_Import_Form_Preview extends CRM_Import_Form_Preview { } } + /** + * @return CRM_Activity_Import_Parser_Activity + */ + protected function getParser(): CRM_Activity_Import_Parser_Activity { + if (!$this->parser) { + $this->parser = new CRM_Activity_Import_Parser_Activity(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Contribute/Import/Form/DataSource.php b/CRM/Contribute/Import/Form/DataSource.php index 37c0191d5e..1a6c307fac 100644 --- a/CRM/Contribute/Import/Form/DataSource.php +++ b/CRM/Contribute/Import/Form/DataSource.php @@ -59,4 +59,16 @@ class CRM_Contribute_Import_Form_DataSource extends CRM_Import_Form_DataSource { $this->submitFileForMapping('CRM_Contribute_Import_Parser_Contribution'); } + /** + * @return \CRM_Contribute_Import_Parser_Contribution + */ + protected function getParser(): CRM_Contribute_Import_Parser_Contribution { + if (!$this->parser) { + $this->parser = new CRM_Contribute_Import_Parser_Contribution(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 34567d0874..e6c4a963ff 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -496,9 +496,12 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { * @return \CRM_Contribute_Import_Parser_Contribution */ protected function getParser(): CRM_Contribute_Import_Parser_Contribution { - $parser = new CRM_Contribute_Import_Parser_Contribution(); - $parser->setUserJobID($this->getUserJobID()); - return $parser; + if (!$this->parser) { + $this->parser = new CRM_Contribute_Import_Parser_Contribution(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; } } diff --git a/CRM/Contribute/Import/Form/Preview.php b/CRM/Contribute/Import/Form/Preview.php index 97b6450881..4bb5a55b4c 100644 --- a/CRM/Contribute/Import/Form/Preview.php +++ b/CRM/Contribute/Import/Form/Preview.php @@ -139,4 +139,16 @@ class CRM_Contribute_Import_Form_Preview extends CRM_Import_Form_Preview { } } + /** + * @return \CRM_Contribute_Import_Parser_Contribution + */ + protected function getParser(): CRM_Contribute_Import_Parser_Contribution { + if (!$this->parser) { + $this->parser = new CRM_Contribute_Import_Parser_Contribution(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Custom/Import/Form/DataSource.php b/CRM/Custom/Import/Form/DataSource.php index 92514fc07b..71b2eb52b9 100644 --- a/CRM/Custom/Import/Form/DataSource.php +++ b/CRM/Custom/Import/Form/DataSource.php @@ -96,4 +96,16 @@ class CRM_Custom_Import_Form_DataSource extends CRM_Import_Form_DataSource { $this->submitFileForMapping('CRM_Custom_Import_Parser_Api', 'multipleCustomData'); } + /** + * @return CRM_Custom_Import_Parser_Api + */ + protected function getParser(): CRM_Custom_Import_Parser_Api { + if (!$this->parser) { + $this->parser = new CRM_Custom_Import_Parser_Api(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Custom/Import/Form/Preview.php b/CRM/Custom/Import/Form/Preview.php index 6bee78ad9f..a9a01a528f 100644 --- a/CRM/Custom/Import/Form/Preview.php +++ b/CRM/Custom/Import/Form/Preview.php @@ -115,4 +115,16 @@ class CRM_Custom_Import_Form_Preview extends CRM_Import_Form_Preview { } } + /** + * @return CRM_Custom_Import_Parser_Api + */ + protected function getParser(): CRM_Custom_Import_Parser_Api { + if (!$this->parser) { + $this->parser = new CRM_Custom_Import_Parser_Api(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Event/Import/Form/DataSource.php b/CRM/Event/Import/Form/DataSource.php index c97c9d7fdb..93f8812909 100644 --- a/CRM/Event/Import/Form/DataSource.php +++ b/CRM/Event/Import/Form/DataSource.php @@ -59,4 +59,16 @@ class CRM_Event_Import_Form_DataSource extends CRM_Import_Form_DataSource { $this->submitFileForMapping('CRM_Event_Import_Parser_Participant'); } + /** + * @return CRM_Event_Import_Parser_Participant + */ + protected function getParser(): CRM_Event_Import_Parser_Participant { + if (!$this->parser) { + $this->parser = new CRM_Event_Import_Parser_Participant(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index c4907fd2a6..33228af045 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -430,4 +430,16 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $parser->set($this); } + /** + * @return CRM_Event_Import_Parser_Participant + */ + protected function getParser(): CRM_Event_Import_Parser_Participant { + if (!$this->parser) { + $this->parser = new CRM_Event_Import_Parser_Participant(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Event/Import/Form/Preview.php b/CRM/Event/Import/Form/Preview.php index b5e0320d1f..7456aee920 100644 --- a/CRM/Event/Import/Form/Preview.php +++ b/CRM/Event/Import/Form/Preview.php @@ -128,4 +128,16 @@ class CRM_Event_Import_Form_Preview extends CRM_Import_Form_Preview { } } + /** + * @return CRM_Event_Import_Parser_Participant + */ + protected function getParser(): CRM_Event_Import_Parser_Participant { + if (!$this->parser) { + $this->parser = new CRM_Event_Import_Parser_Participant(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Import/Forms.php b/CRM/Import/Forms.php index e752dc6c83..1262fa0e36 100644 --- a/CRM/Import/Forms.php +++ b/CRM/Import/Forms.php @@ -63,6 +63,11 @@ class CRM_Import_Forms extends CRM_Core_Form { */ protected $userJob; + /** + * @var \CRM_Import_Parser + */ + protected $parser; + /** * Get User Job. * diff --git a/CRM/Member/Import/Form/DataSource.php b/CRM/Member/Import/Form/DataSource.php index d6913e9318..0e91fb36c4 100644 --- a/CRM/Member/Import/Form/DataSource.php +++ b/CRM/Member/Import/Form/DataSource.php @@ -59,4 +59,16 @@ class CRM_Member_Import_Form_DataSource extends CRM_Import_Form_DataSource { $this->submitFileForMapping('CRM_Member_Import_Parser_Membership'); } + /** + * @return \CRM_Member_Import_Parser_Membership + */ + protected function getParser(): CRM_Member_Import_Parser_Membership { + if (!$this->parser) { + $this->parser = new CRM_Member_Import_Parser_Membership(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index b35a37eda0..069ff135ac 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -459,4 +459,16 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $parser->set($this); } + /** + * @return \CRM_Member_Import_Parser_Membership + */ + protected function getParser(): CRM_Member_Import_Parser_Membership { + if (!$this->parser) { + $this->parser = new CRM_Member_Import_Parser_Membership(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } diff --git a/CRM/Member/Import/Form/Preview.php b/CRM/Member/Import/Form/Preview.php index e1226987d4..3160ae2568 100644 --- a/CRM/Member/Import/Form/Preview.php +++ b/CRM/Member/Import/Form/Preview.php @@ -148,4 +148,16 @@ class CRM_Member_Import_Form_Preview extends CRM_Import_Form_Preview { } } + /** + * @return \CRM_Member_Import_Parser_Membership + */ + protected function getParser(): CRM_Member_Import_Parser_Membership { + if (!$this->parser) { + $this->parser = new CRM_Member_Import_Parser_Membership(); + $this->parser->setUserJobID($this->getUserJobID()); + $this->parser->init(); + } + return $this->parser; + } + } -- 2.25.1