[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
raeburn at source.lon-capa.org
Thu Aug 8 09:45:31 EDT 2024
raeburn Thu Aug 8 13:45:31 2024 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Student_Preferred_First_Name unavailable in RO_ClassList_CS_View.
Student_Name now provides only preferred names.
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.96 modules/msu/localenroll.pm:1.97
--- modules/msu/localenroll.pm:1.96 Thu Aug 8 10:41:21 2024
+++ modules/msu/localenroll.pm Thu Aug 8 13:45:31 2024
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.96 2024/08/08 10:41:21 raeburn Exp $
+# $Id: localenroll.pm,v 1.97 2024/08/08 13:45:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -190,16 +190,14 @@
$subj =~tr/a-z/A-Z/;
$crse =~tr/a-z/A-Z/;
$sec =~s/^_//;
- my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name,Student_Preferred_First_Name,Sctn_Crdt_Hours FROM RO_ClassList_CS_View WHERE (Term_Code = '$sem' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec') ORDER BY Student_Name");
+ my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name,Sctn_Crdt_Hours FROM RO_ClassList_CS_View WHERE (Term_Code = '$sem' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec') ORDER BY Student_Name");
$sth->execute();
- while ( my($pid,$pilot,$name,$first,$credits) = $sth->fetchrow_array ) {
+ while ( my($pid,$pilot,$name,$credits) = $sth->fetchrow_array ) {
if ($pilot =~ /^\w{2,8}$/) {
$pilotcount ++;
$name =~ s/^\s+//;
$name =~ s/\s+$//;
- $first =~ s/^\s+//;
- $first =~ s/\s+$//;
- my ($last,$given,$middle,$generation);
+ my ($last,$first,$given,$middle,$generation);
($last,$given) = split(/\,/,$name,2);
$last =~ s/\s+$//;
if ($last =~ /^([\w\s]+)\s+(II|III|IV|V|VI|VII|Jr|Sr)$/) {
@@ -208,18 +206,7 @@
}
$given =~ s/^\s+//;
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;
- }
+ ($first,$middle) = split(/\s+/,$given,2);
$middle =~ s/\s+$//;
if (($first ne '') && ($first eq $middle)) {
$middle = '';
@@ -228,7 +215,7 @@
$middle = '';
}
}
- } elsif ($first eq '') {
+ } else {
$first = $given;
}
$first =~ s/\s+$//;
@@ -2024,7 +2011,7 @@
}
$statement .= " ORDER BY MSUNetId,Term_Seq_Id";
} else {
- $statement = "SELECT DISTINCT Pilot_Id,Pid,Student_Preferred_First_Name,Student_Name,Term_Seq_Id FROM $table";
+ $statement = "SELECT DISTINCT Pilot_Id,Pid,Student_Name,Term_Seq_Id FROM $table";
if ($condition{$key}{$table_to_key{$table}}) {
$statement .= " WHERE $condition{$key}{$table_to_key{$table}}";
}
@@ -2048,23 +2035,23 @@
if ($key eq 'hr') {
($given,$last,$type) = @rest;
} elsif ($key eq 'ro') {
- $name = $rest[1];
- $name =~ s/^\s+//;
- $name =~ s/\s+$//;
- ($last,$given) = split(/\,/,$name,2);
if ($table eq 'RO_Instructor_CS_View') {
if ($rest[0] =~ /^Z\d{8}$/) {
$pid = $rest[0];
} elsif ($pid eq $uname) {
undef($pid);
}
+ $name = $rest[1];
if ($rest[2] eq '1' || $rest[2] eq 'PI') {
$type = 'Faculty';
}
} else {
- $first = $rest[0];
+ $name = $rest[0];
$type = 'Student';
}
+ $name =~ s/^\s+//;
+ $name =~ s/\s+$//;
+ ($last,$given) = split(/\,/,$name,2);
} else {
$name = $rest[0];
$name =~ s/^\s+//;
@@ -2081,18 +2068,7 @@
$pid=lc($pid);
$given =~ s/^\s+//;
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;
- }
+ ($first,$middle) = split(/\s+/,$given,2);
$middle =~ s/\s+$//;
if (($first ne '') && ($first eq $middle)) {
$middle = '';
More information about the LON-CAPA-cvs
mailing list