Skip to content

Commit

Permalink
[Ref] [Import] Simplify form event MapField (Contact)
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Sep 6, 2022
1 parent 39b1803 commit f434cf9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CRM/Contact/Import/Form/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public function preProcess() {
* @throws \CRM_Core_Exception
*/
public function buildQuickForm() {
$savedMappingID = (int) $this->getSubmittedValue('savedMapping');
$this->buildSavedMappingFields($savedMappingID);
$this->addSavedMappingFields();

$this->addFormRule(['CRM_Contact_Import_Form_MapField', 'formRule']);

Expand Down Expand Up @@ -273,7 +272,7 @@ public function buildQuickForm() {
//used to warn for mismatch column count or mismatch mapping
CRM_Core_Session::singleton()->setStatus(NULL);
$processor = new CRM_Import_ImportProcessor();
$processor->setMappingID($savedMappingID);
$processor->setMappingID((int) $this->getSubmittedValue('savedMapping'));
$processor->setFormName($formName);
$processor->setMetadata($this->getContactImportMetadata());
$processor->setContactTypeByConstant($this->getSubmittedValue('contactType'));
Expand Down Expand Up @@ -338,9 +337,11 @@ public function buildQuickForm() {
*/
public static function formRule(array $fields) {
if (!empty($fields['saveMapping'])) {
// todo - this is non-sensical - sane js is better. PR to fix got stale but
// is here https://github.com/civicrm/civicrm-core/pull/23950
CRM_Core_Smarty::singleton()->assign('isCheked', TRUE);
}
return parent::mappingRule($fields);
return TRUE;
}

/**
Expand Down

0 comments on commit f434cf9

Please sign in to comment.