[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
raeburn at source.lon-capa.org
Wed Jan 12 07:55:18 EST 2022
raeburn Wed Jan 12 12:55:18 2022 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Integration with MSU campus information systems
- Accommodate cases where "preferred first name" contains more than one
name, or is hyphenated, when extracting middle name from given name.
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.85 modules/msu/localenroll.pm:1.86
--- modules/msu/localenroll.pm:1.85 Sun Jan 9 23:46:37 2022
+++ modules/msu/localenroll.pm Wed Jan 12 12:55:17 2022
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.85 2022/01/09 23:46:37 raeburn Exp $
+# $Id: localenroll.pm,v 1.86 2022/01/12 12:55:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -207,9 +207,17 @@
$generation = $2;
}
$given =~ s/^\s+//;
- if ($given =~ m/\w\s+\w/) {
- (my $officialfirst,$middle) = split(/\s+/,$given,2);
- if ($first eq '') {
+ if ($given =~ m/[\w-]+\s+\w/) {
+ if ($first ne '') {
+ if ($given =~ /^\Q$first\E/) {
+ $middle = $given;
+ $middle =~ s/^\Q$first\E//;
+ $middle =~ s/^\s+//;
+ } else {
+ (my $officialfirst,$middle) = split(/\s+/,$given,2);
+ }
+ } else {
+ (my $officialfirst,$middle) = split(/\s+/,$given,2);
$first = $officialfirst;
}
$middle =~ s/\s+$//;
@@ -1746,9 +1754,17 @@
}
$pid=lc($pid);
$given =~ s/^\s+//;
- if ($given =~ m/\w\s+\w/) {
- (my $officialfirst,$middle) = split(/\s+/,$given,2);
- if ($first eq '') {
+ if ($given =~ m/[\w-]+\s+\w/) {
+ if ($first ne '') {
+ if ($given =~ /^\Q$first\E/) {
+ $middle = $given;
+ $middle =~ s/^\Q$first\E//;
+ $middle =~ s/^\s+//;
+ } else {
+ (my $officialfirst,$middle) = split(/\s+/,$given,2);
+ }
+ } else {
+ (my $officialfirst,$middle) = split(/\s+/,$given,2);
$first = $officialfirst;
}
$middle =~ s/\s+$//;
More information about the LON-CAPA-cvs
mailing list