[LON-CAPA-cvs] cvs: modules /msu localenroll.pm

raeburn raeburn at source.lon-capa.org
Wed Jan 12 16:46:56 EST 2022


raeburn		Wed Jan 12 21:46:56 2022 EDT

  Modified files:              
    /modules/msu	localenroll.pm 
  Log:
  - Integration with MSU campus information systems
    - When extracting middle name from given name, do not set middle name if the 
      extracted value exaclty matches the first name.
    - Use of middle initial in place of middle name (for non-students) does not
      apply if first name is itself an intial.  
  
  
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.86 modules/msu/localenroll.pm:1.87
--- modules/msu/localenroll.pm:1.86	Wed Jan 12 12:55:17 2022
+++ modules/msu/localenroll.pm	Wed Jan 12 21:46:56 2022
@@ -1,6 +1,6 @@
 # functions to glue school database system into Lon-CAPA for
 # automated enrollment
-# $Id: localenroll.pm,v 1.86 2022/01/12 12:55:17 raeburn Exp $
+# $Id: localenroll.pm,v 1.87 2022/01/12 21:46:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -221,6 +221,9 @@
                               $first = $officialfirst;
                           }
                           $middle =~ s/\s+$//;
+                          if (($first ne '') && ($first eq $middle)) {
+                              $middle = '';
+                          }
                       } elsif ($first eq '') {
                           $first = $given;
                       }
@@ -1768,7 +1771,10 @@
                                     $first = $officialfirst;
                                 }
                                 $middle =~ s/\s+$//;
-                                if (($middle ne '') && ($type ne 'Student') & ($middle !~ /\s/)) {
+                                if (($first ne '') && ($first eq $middle)) {
+                                    $middle = '';
+                                }
+                                if (($middle ne '') && ($type ne 'Student') & ($middle !~ /\s/) && (length($first) > 1)) {
                                     $middle = substr($middle, 0, 1);
                                 }
                             } elsif ($first eq '') {
@@ -1929,7 +1935,7 @@
                     undef($type);
                 }
             }
-            if (($name ne '') && ($type ne 'Student') & ($name !~ /\s/)) {
+            if (($name ne '') && ($type ne 'Student') & ($name !~ /\s/) && (length($first) > 1)) {
                 $middle = substr($name, 0, 1);
             } else {
                 $middle = $name;
@@ -2020,7 +2026,7 @@
             }
             $name =~ s/^\s+|\s+$//g;
             my $middle;
-            if (($name ne '') && ($type ne 'Student') & ($name !~ /\S/)) {
+            if (($name ne '') && ($type ne 'Student') && ($name !~ /\s/) && (length($first) > 1)) {
                 $middle = substr($name, 0, 1);
             } else {
                 $middle = $name;




More information about the LON-CAPA-cvs mailing list