Skip to content

Commit

Permalink
CIL-793 When splitting display_name for missing first and last names,…
Browse files Browse the repository at this point in the history
… check for comma (,) and split into last_name, first_name.
  • Loading branch information
terrencegf committed Aug 24, 2020
1 parent 870b1ee commit 82b9572
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Service/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -1292,9 +1292,15 @@ public static function getFirstAndLastName($full, $first = '', $last = '')

# Try to split the incoming $full name into first and last names
if (strlen($full) > 0) {
$names = preg_split('/\s+/', $full, 2);
$firstname = @$names[0];
$lastname = @$names[1];
if (preg_match('/,/', $full)) { // Split on comma if present
$names = preg_split('/,/', $full, 2);
$lastname = trim(@$names[0]);
$firstname = trim(@$names[1]);
} else {
$names = preg_split('/\s+/', $full, 2);
$firstname = trim(@$names[0]);
$lastname = trim(@$names[1]);
}
}

# If either first or last name blank, then use incoming $first and $last
Expand Down

0 comments on commit 82b9572

Please sign in to comment.