[LON-CAPA-cvs] cvs: loncom /interface londropadd.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 10 Dec 2002 00:54:37 -0000


matthew		Mon Dec  9 19:54:37 2002 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Fix two bugs: 
  1. &modify_single_student did not expire old student roles in the course.
     This has been implemented by calling &londropadd::modifystudent.
  2. &modify_single_student handled the 'override student id change' stuff
     improperly.  Now a check is made to determine the the student has an
     id before bitching about attempts to change the users id.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.62 loncom/interface/londropadd.pm:1.63
--- loncom/interface/londropadd.pm:1.62	Tue Dec  3 15:30:48 2002
+++ loncom/interface/londropadd.pm	Mon Dec  9 19:54:37 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.62 2002/12/03 20:30:48 matthew Exp $
+# $Id: londropadd.pm,v 1.63 2002/12/10 00:54:37 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1086,7 +1086,8 @@
     my $displayable_endtime   = localtime($endtime);
     # 
     # check for forceid override
-    if (($sid ne $old{'id'}) && (! exists($ENV{'form.forceid'}))) {
+    if ((defined($old{'id'})) && ($old{'id'} ne '') && 
+        ($sid ne $old{'id'}) && (! exists($ENV{'form.forceid'}))) {
         $r->print("<font color=\"ff0000\">You changed the students id ".
                   " but did not disable the ID change safeguard.".
                   "  The students id will not be changed.</font>");
@@ -1137,7 +1138,15 @@
 <p>
 END
     #
-    # Send request(s) to modify data
+    # Send request(s) to modify data (final undef is for 'desiredhost',
+    # which is a moot point because the student already has an account.
+    my $modify_section_results = &modifystudent($sdom,$slogin,
+                                                $ENV{'request.course.id'},
+                                                $section,undef);
+    if ($modify_section_results !~ /^ok/) {
+        $r->print("An error occured during the attempt to change the ".
+                  "section for this student.<br />");
+    }
     my $roleresults = &Apache::lonnet::modifystudent
         ($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname,
          $generation,$section,$endtime,$starttime,$ENV{'form.forceid'});