Skip to content

Commit

Permalink
Merge pull request #23416 from eileenmcnaughton/import_create_job
Browse files Browse the repository at this point in the history
[REF] [Import] Create user-job records for Memership imports
  • Loading branch information
colemanw authored May 10, 2022
2 parents bad046b + 9b78b60 commit 4b61b72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CRM/Import/Form/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ protected function storeFormValues($names) {
protected function submitFileForMapping($parserClassName, $entity = NULL) {
$this->controller->resetPage('MapField');
CRM_Core_Session::singleton()->set('dateTypes', $this->getSubmittedValue('dateFormats'));
if (!$this->getUserJobID()) {
$this->createUserJob();
}
else {
$this->updateUserJobMetadata('submitted_values', $this->getSubmittedValues());
}

$mapper = [];

Expand All @@ -165,6 +171,7 @@ protected function submitFileForMapping($parserClassName, $entity = NULL) {
$parser->setEntity($this->get($entity));
}
$parser->setMaxLinesToProcess(100);
$parser->setUserJobID($this->getUserJobID());
$parser->run(
$this->getSubmittedValue('uploadFile'),
$this->getSubmittedValue('fieldSeparator'),
Expand Down
2 changes: 2 additions & 0 deletions CRM/Member/Import/Form/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public function postProcess() {
$this->controller->resetPage($this->_name);
return;
}
$this->updateUserJobMetadata('submitted_values', $this->getSubmittedValues());

$mapperKeys = [];
$mapper = [];
Expand Down Expand Up @@ -468,6 +469,7 @@ public function postProcess() {
}

$parser = new CRM_Member_Import_Parser_Membership($mapperKeysMain, $mapperLocType, $mapperPhoneType);
$parser->setUserJobID($this->getUserJobID());
$parser->run($this->getSubmittedValue('uploadFile'), $this->getSubmittedValue('fieldSeparator'), $mapper, $this->getSubmittedValue('skipColumnHeader'),
CRM_Import_Parser::MODE_PREVIEW, $this->get('contactType')
);
Expand Down
3 changes: 2 additions & 1 deletion CRM/Member/Import/Form/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public function postProcess() {
}
}

$parser = new CRM_Member_Import_Parser_Membership($mapperKeys, $mapperLocType, $mapperPhoneType);
$parser = new CRM_Member_Import_Parser_Membership($mapperKeys);
$parser->setUserJobID($this->getUserJobID());

$mapFields = $this->get('fields');

Expand Down

0 comments on commit 4b61b72

Please sign in to comment.