Skip to content

Commit

Permalink
Polish #1002 - avoid errors if no groups in play
Browse files Browse the repository at this point in the history
  • Loading branch information
tbar0970 committed Jan 26, 2024
1 parent 1262dbf commit 491c95e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions views/view_10_admin__7_import.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,13 @@ private function _preparePreview()
if (!$this->_haveErrors($i)) {
if (isset($this->_sess['person_updates'][$existingPerson->id])) {
// a previous import row also matched this same person.
// that can be deliberate.
// Don't overwrite stuff.
// Later rows take precedence over earlier rows, but data should be combined where possible (eg groups).
$already_groups = array_get($this->_sess['person_updates'][$existingPerson->id], '_groups', Array());
$this->_pushIntoArray($this->_sess['person_updates'][$existingPerson->id], $person_row);
$this->_sess['person_updates'][$existingPerson->id] = $person_row;
$this->_sess['person_updates'][$existingPerson->id]['_groups'] = array_unique(array_merge($already_groups, $person_row['_groups']));
if (!empty($person_row['_groups'])) {
$this->_sess['person_updates'][$existingPerson->id]['_groups'] = array_unique(array_merge($already_groups, $person_row['_groups']));
}

} else {
$this->_sess['person_updates'][$existingPerson->id] = $person_row;
Expand Down

0 comments on commit 491c95e

Please sign in to comment.