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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 29 Aug 2006 01:49:50 -0000


raeburn		Mon Aug 28 21:49:50 2006 EDT

  Modified files:              
    /modules/msu	localenroll.pm 
  Log:
  Need to scope $ownerdom and also pass DB handle to &check_section()
  
  
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.19 modules/msu/localenroll.pm:1.20
--- modules/msu/localenroll.pm:1.19	Mon Aug 28 16:28:47 2006
+++ modules/msu/localenroll.pm	Mon Aug 28 21:49:50 2006
@@ -1,6 +1,6 @@
 # functions to glue school database system into Lon-CAPA for
 # automated enrollment
-# $Id: localenroll.pm,v 1.19 2006/08/28 20:28:47 raeburn Exp $
+# $Id: localenroll.pm,v 1.20 2006/08/29 01:49:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -103,7 +103,7 @@
   my $blankcount = 0;
   my $owner = &get_owner($dom,$crs);
   foreach my $class (@{$coursesref}) {
-      if (&check_section($class,$owner,$dom) > 0) {
+      if (&check_section($class,$owner,$dom,$dbh) > 0) {
           my $xmlfile = $xmlstem.$class."_classlist.xml";
           open(FILE, ">$xmlfile");
           print FILE qq|<?xml version="1.0" encoding="UTF-8"?>
@@ -201,7 +201,7 @@
     } else {
         if ($owner =~ /^([^:]+):([^:]+)$/) {
             $owner = $1;
-            $ownerdom = $2;
+            my $ownerdom = $2;
             if ($ownerdom ne $dom) {
                 $outcome = "Inclusion of enrollment could not be established for the course section $course_id because the course owner is in a different domain ($ownerdom) from the course ($dom).";
                 return $outcome; 
@@ -342,7 +342,7 @@
         if ($dbflag) {
             my %stuinfo;
             foreach my $class (@{$$affiliates{$crs}}) {
-                if (&check_section($class,$owner,$dom) > 0) {
+                if (&check_section($class,$owner,$dom,$dbh) > 0) {
                     my $pidcount = 0;
                     my $blankcount = 1;
                     my $maxtries = 5;
@@ -425,11 +425,11 @@
 }
 
 sub check_section {
-    my ($class,$owner,$dom) = @_;
+    my ($class,$owner,$dom,$dbh) = @_;
     my $sectioncheck = 0;
     if ($owner =~ /^([^:]+):([^:]+)$/) {
         $owner = $1;
-        $ownerdom = $2;
+        my $ownerdom = $2;
         if ($ownerdom ne $dom) {
             return $sectioncheck;
         }