[LON-CAPA-cvs] cvs: loncom /enrollment Autoenroll.pl
raeburn
lon-capa-cvs@mail.lon-capa.org
Mon, 01 Jan 2007 19:19:59 -0000
raeburn Mon Jan 1 14:19:59 2007 EDT
Modified files:
/loncom/enrollment Autoenroll.pl
Log:
Bug 5123. $env{user.name} used when sending notification e-mail was user:domain for course owners with username and domain. Now fixed and backwards compatibility retained.
Index: loncom/enrollment/Autoenroll.pl
diff -u loncom/enrollment/Autoenroll.pl:1.22 loncom/enrollment/Autoenroll.pl:1.23
--- loncom/enrollment/Autoenroll.pl:1.22 Fri Jul 21 13:47:36 2006
+++ loncom/enrollment/Autoenroll.pl Mon Jan 1 14:19:58 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl
#
#Automated Enrollment script
-# $Id: Autoenroll.pl,v 1.22 2006/07/21 17:47:36 albertel Exp $
+# $Id: Autoenroll.pl,v 1.23 2007/01/01 19:19:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,10 +138,16 @@
if ($changecount > 0) {
unless ($enrollvar{$crs}{notifylist} eq '') {
# Send message about enrollment changes to notifylist.
-# Set $env{'user.name'}, $env{'user.home'} for use by logging in lonmsg
+# Set $env{'user.name'}, $env{'user.domain'}, $env{'user.home'}
+# for use by logging in lonmsg
unless ( ($enrollvar{$crs}{'courseowner'} eq '') || (!defined($enrollvar{$crs}{'courseowner'}) ) ) {
- $env{'user.name'} = $enrollvar{$crs}{'courseowner'};
- $env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$dom);
+ if ($enrollvar{$crs}{'courseowner'} =~ /:/) {
+ ($env{'user.name'},$env{'user.domain'}) = split(/:/,$enrollvar{$crs}{'courseowner'});
+ } else {
+ $env{'user.name'} = $enrollvar{$crs}{'courseowner'};
+ $env{'user.domain'} = $dom;
+ }
+ $env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$env{'user.domain'});
my $subject = "Student enrollment changes in $enrollvar{$crs}{coursecode}";
my $message = "The following $changecount change(s) occurred in $enrollvar{$crs}{description} - $enrollvar{$crs}{coursecode} as a result of the automated classlist update:\n\n".$response;
@@ -165,10 +171,11 @@
}
if ( ($enrollvar{$crs}{notifylist} eq '') && ($newusermsg ne '') ) {
my $subject = "New user accounts in $enrollvar{$crs}{'coursecode'}";
- my $status = &Apache::lonmsg::user_normal_msg($env{'user.name'},$dom,$subject,$newusermsg);
+ my $status = &Apache::lonmsg::user_normal_msg($env{'user.name'},$env{'user.domain'},$subject,$newusermsg);
}
delete($env{'user.name'});
delete($env{'user.home'});
+ $env{'user.domain'} = $dom;
}
}
}