--- loncom/enrollment/Autoenroll.pl 2009/01/08 16:58:04 1.31 +++ loncom/enrollment/Autoenroll.pl 2010/08/19 22:36:59 1.32 @@ -1,7 +1,7 @@ #!/usr/bin/perl # #Automated Enrollment script -# $Id: Autoenroll.pl,v 1.31 2009/01/08 16:58:04 raeburn Exp $ +# $Id: Autoenroll.pl,v 1.32 2010/08/19 22:36:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -78,11 +78,10 @@ my %args = ( one_time => 1, ); - my %coursehash = &Apache::lonnet::coursedescription($key,\%args); - my $crs = $coursehash{'num'}; - next if ($coursehash{'domain'} ne $dom); # Get course settings - my %settings = &Apache::lonnet::dump('environment',$dom,$crs); + my %settings = &Apache::lonnet::coursedescription($key,\%args); + my $crs = $settings{'num'}; + next if ($settings{'domain'} ne $dom); %{$enrollvar{$crs}} = (); @{$affiliates{$crs}} = (); %{$LC_code{$crs}} = (); @@ -118,7 +117,7 @@ if ($sec =~ m/^(\w+):(\w*)$/ ) { my $course_id = $enrollvar{$crs}{coursecode}.$1; my $gp = $2; - if (!grep/^$course_id$/,@{$affiliates{$crs}}) { + if (!grep/^\Q$course_id\E$/,@{$affiliates{$crs}}) { push @{$affiliates{$crs}}, $course_id; $LC_code{$crs}{$course_id} = $gp; } @@ -128,7 +127,7 @@ if ($xlist =~ m/^([^:]+):(\w*)$/) { my $course_id = $1; my $gp = $2; - if (!grep/^$course_id$/,@{$affiliates{$crs}}) { + if (!grep/^\Q$course_id\E$/,@{$affiliates{$crs}}) { push @{$affiliates{$crs}}, $course_id; $LC_code{$crs}{$course_id} = $gp; } @@ -149,7 +148,7 @@ if ($reply{$crs} > 0) { if ( ($enrollvar{$crs}{autostart} < $timenow) && ( ($enrollvar{$crs}{autoend} > $timenow) || ($enrollvar{$crs}{autoend} == 0) ) ) { if (($enrollvar{$crs}{autoadds} == 1) || ($enrollvar{$crs}{autodrops} == 1)) { - my ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$enrollvar{$crs}{autoadds},$enrollvar{$crs}{autodrops},$enrollvar{$crs}{startdate},$enrollvar{$crs}{enddate},$enrollvar{$crs}{authtype},$enrollvar{$crs}{autharg},\@{$affiliates{$crs}},\%{$LC_code{$crs}},\$logmsg,\$newusermsg,'automated'); + my ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$enrollvar{$crs}{autoadds},$enrollvar{$crs}{autodrops},$enrollvar{$crs}{startdate},$enrollvar{$crs}{enddate},$enrollvar{$crs}{authtype},$enrollvar{$crs}{autharg},$affiliates{$crs},$LC_code{$crs},\$logmsg,\$newusermsg,'automated'); print $fh &mt('Messages start for [_1]',$crs)."\n"; print $fh "$logmsg\n"; print $fh &mt('Messages end for [_1]',$crs)."\n";