[LON-CAPA-cvs] cvs: loncom /enrollment Enrollment.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 27 Apr 2005 19:11:33 -0000


raeburn		Wed Apr 27 15:11:33 2005 EDT

  Modified files:              
    /loncom/enrollment	Enrollment.pm 
  Log:
  Update student's permanentemail when adding to a course.
  
  
Index: loncom/enrollment/Enrollment.pm
diff -u loncom/enrollment/Enrollment.pm:1.22 loncom/enrollment/Enrollment.pm:1.23
--- loncom/enrollment/Enrollment.pm:1.22	Thu Apr  7 02:56:21 2005
+++ loncom/enrollment/Enrollment.pm	Wed Apr 27 15:11:33 2005
@@ -1,5 +1,5 @@
 # Automated Enrollment manager
-# $Id: Enrollment.pm,v 1.22 2005/04/07 06:56:21 albertel Exp $
+# $Id: Enrollment.pm,v 1.23 2005/04/27 19:11:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -482,6 +482,7 @@
                 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 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 @@
         }
     }
     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 @@
         $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 @@
         $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;