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

raeburn raeburn at source.lon-capa.org
Sun Mar 3 21:20:26 EST 2013


raeburn		Mon Mar  4 02:20:26 2013 EDT

  Modified files:              
    /modules/msu	localenroll.pm 
  Log:
  - Customized localenroll.pm for MSU
    - Coding style -- push()
    - Fix seqyr code determination for spring semesters.
    - Correct args passed to &semyr_to_seqid(). 
  
  
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.63 modules/msu/localenroll.pm:1.64
--- modules/msu/localenroll.pm:1.63	Fri Mar  1 05:53:15 2013
+++ modules/msu/localenroll.pm	Mon Mar  4 02:20:25 2013
@@ -1,6 +1,6 @@
 # functions to glue school database system into Lon-CAPA for
 # automated enrollment
-# $Id: localenroll.pm,v 1.63 2013/03/01 05:53:15 raeburn Exp $
+# $Id: localenroll.pm,v 1.64 2013/03/04 02:20:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -137,7 +137,7 @@
               $sem =~tr/a-z/A-Z/;
               $subj =~tr/a-z/A-Z/;
               $crse =~tr/a-z/A-Z/;
-              my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name,Sctn_Crdt_Hours FROM LONCAPA_ClassList 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 LONCAPA_ClassList 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,$credits)  = $sth->fetchrow_array ) {
                   if ($pilot =~ m/^\w{2,8}$/) {
@@ -208,9 +208,9 @@
                 my $quotedterm = $dbh3->quote($term);
                 my $sth = $dbh3->prepare( "SELECT Sctn_Code FROM SISCRSS WHERE Subj_Code = $quotedsubj AND Crse_Code= $quotedcrse AND Sctn_Code != '998' AND Sctn_Term_Code =$quotedterm ");
                 $sth->execute();
-                while ( my @row = $sth->fetchrow_array(  ) ) {
+                while ( my @row = $sth->fetchrow_array() ) {
                     if (!grep/^99/, at row) {
-                        push @secs, @row;
+                        push(@secs, at row);
                     }
                 }
                 $sth->finish;
@@ -273,7 +273,7 @@
                                 if (($coowner !~ /\W/) && ($coownerdom eq $dom)) {
                                     # Is co-owner in CLIFMS for course?
                                     unless (grep(/^\Q$coowner\E$/, at netids)) { 
-                                        push (@netids,$coowner);
+                                        push(@netids,$coowner);
                                     }
                                 }
                             }
@@ -383,7 +383,8 @@
             if ($yr == 10) {
                 $seqyr = '09';
             } elsif ($yr =~ /^0(\d)$/) {
-                $seqyr = '0'. $1 - 1;
+                my $digit = $1 -1;
+                $seqyr = '0'.$digit;
             } else {
                 $seqyr = $yr - 1;
             }
@@ -495,7 +496,7 @@
                             }
                         }
                         unless ($outcome eq 'valid') {
-                            $outcome = "There was no match in the MSU $database database to the combination of semester ($term), subject ($subj), course number ($crse) for the specified owner ($owner).";
+                            $outcome = "There was no match in the MSU $database database to the combination of semester ($term), subject ($subj), course number ($crse) for the specified owner ($ownername).";
                         }
                     } 
                 } else {
@@ -536,7 +537,7 @@
                     $outcome = "There was a problem connecting to the SIS database, so the course number could not be validated.";
                 }
                 if ($outcome eq 'valid') {
-                    my $seqid = &semyr_to_seqid($term,$sem,$yr);
+                    my $seqid = &semyr_to_seqid($term,$sem,$year);
                     eval {
                         my $credsth = $dbh->prepare("SELECT Start_Term_Seq_Id,End_Term_Seq_Id,Credits FROM SISCRSD WHERE Subj_Code = '$subj' AND Crse_Code = '$crse'");
                         $credsth->execute();




More information about the LON-CAPA-cvs mailing list