--- loncom/enrollment/Enrollment.pm 2005/01/30 01:07:35 1.21 +++ loncom/enrollment/Enrollment.pm 2005/04/27 19:11:33 1.23 @@ -1,5 +1,5 @@ # Automated Enrollment manager -# $Id: Enrollment.pm,v 1.21 2005/01/30 01:07:35 raeburn Exp $ +# $Id: Enrollment.pm,v 1.23 2005/04/27 19:11:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -194,7 +194,7 @@ sub update_LC { } # Explicitly allow access to creation/modification of students if called as an automated process. if ($context eq 'automated') { - $ENV{'allowed.cst'}='F'; + $env{'allowed.cst'}='F'; } # Compare IDs with existing LON-CAPA enrollment for this class @@ -355,7 +355,7 @@ sub update_LC { # Terminated explictly allowed access to student creation/modification if ($context eq 'automated') { - delete($ENV{'allowed.cst'}); + delete($env{'allowed.cst'}); } if ($enrollcount > 0) { if ($context eq "updatenow") { @@ -482,6 +482,7 @@ sub create_newuser { my %emailHash; $emailHash{'critnotification'} = $emailenc; $emailHash{'notification'} = $emailenc; + $emailHash{'permanentemail'} = $emailenc; my $putresult = &Apache::lonnet::put('environment',\%emailHash,$udom,$uname); } if ($create_passwd) { @@ -564,7 +565,7 @@ sub prepare_add { sub execute_add { my ($context,$caller,$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,$addresult,$enrollcount,$linefeed,$logmsg) = @_; # Get the user's information and authentication - my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification'],$dom,$uname); + my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification','permanentemail'],$dom,$uname); my ($tmp) = keys(%userenv); if ($tmp =~ /^(con_lost|error)/i) { %userenv = (); @@ -577,11 +578,17 @@ sub execute_add { } } if ($userenv{notification} =~ m/%40/) { - unless ($emailenc eq $userenv{critnotification}) { + unless ($emailenc eq $userenv{notification}) { $$logmsg .= "Current standard notification e-mail - ".$userenv{notification}." for $uname is different to e-mail address in institutional classlist - ".$emailenc.$linefeed; } } + if ($userenv{permanentemail} =~ m/%40/) { + unless ($emailenc eq $userenv{permanentemail}) { + $$logmsg .= "Current permanent e-mail +- ".$userenv{permanentemail}." for $uname is different to e-mail address in institutional classlist - ".$emailenc.$linefeed; + } + } my $krbdefdom = ''; my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom); if ($currentauth=~/^(krb[45]):(.*)/) { @@ -606,7 +613,8 @@ sub execute_add { $middle ne $userenv{'middlename'} || $last ne $userenv{'lastname'} || $gene ne $userenv{'generation'} || - $pid ne $userenv{'id'} ) { + $pid ne $userenv{'id'} || + $emailenc ne $userenv{'permanentemail'} ) { # Make the change(s) my %changeHash; $changeHash{'firstname'} = $first; @@ -614,6 +622,7 @@ sub execute_add { $changeHash{'lastname'} = $last; $changeHash{'generation'} = $gene; $changeHash{'id'} = $pid; + $changeHash{'permanentemail'} = $emailenc; my $putresult = &Apache::lonnet::put('environment',\%changeHash,$dom,$uname); if ($putresult eq 'ok') { $$logmsg .= "User information updated for user: $uname prior to enrollment.".$linefeed;