Skip to content

Commit

Permalink
Minor cleanup on status setting.
Browse files Browse the repository at this point in the history
It appears that this complicated handling is because in the past the setStatus did not have the
ability to ensure a given message was set only once - hence it's being set multiple times
  • Loading branch information
eileenmcnaughton committed Aug 11, 2019
1 parent f39da48 commit 0b786e4
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions CRM/Contact/Import/Form/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ public function buildQuickForm() {
$js = "<script type='text/javascript'>\n";
$formName = 'document.forms.' . $this->_name;
//used to warn for mismatch column count or mismatch mapping
$warning = 0;
CRM_Core_Session::singleton()->setStatus(NULL);

for ($i = 0; $i < $this->_columnCount; $i++) {
$sel = &$this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', [1 => $i]), NULL);

Expand Down Expand Up @@ -441,16 +442,7 @@ public function buildQuickForm() {
if (isset($mappingName) &&
($this->_columnCount != count($mappingName))
) {
$warning++;
}

if ($warning != 0 && $this->get('savedMapping')) {
$session = CRM_Core_Session::singleton();
$session->setStatus(ts('The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.'));
}
else {
$session = CRM_Core_Session::singleton();
$session->setStatus(NULL);
CRM_Core_Session::singleton()->setStatus(ts('The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.'));
}

$this->setDefaults($defaults);
Expand Down

0 comments on commit 0b786e4

Please sign in to comment.