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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 29 Dec 2003 14:38:44 -0000


raeburn		Mon Dec 29 09:38:44 2003 EDT

  Modified files:              
    /loncom/interface	lonmodifycourse.pm 
  Log:
  Added course owner validation for cases where course owner is changed, but course code is unchanged.
  
  
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.3 loncom/interface/lonmodifycourse.pm:1.4
--- loncom/interface/lonmodifycourse.pm:1.3	Sun Dec 28 13:27:49 2003
+++ loncom/interface/lonmodifycourse.pm	Mon Dec 29 09:38:44 2003
@@ -552,7 +552,6 @@
 			            my $course_check = &localenroll::validate_courseID($course_id);
 			            if ($course_check eq 'ok') {  
                                         my $outcome = &localenroll::new_course($course_id,$newattr{'courseowner'});
-			                my $outcome = 'ok';
 			                unless ($outcome eq 'ok') { 
 				            $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $1 for the following reason: $outcome.<br/>");
 			                }
@@ -563,7 +562,19 @@
 			            $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $sec because this is not a valid section entry.<br/>");
 		                }
 		            }
-	                } 
+	                } elsif ($changeowner) {
+                            foreach my $sec (@sections) {
+                                if ($sec =~ m/^(.+):/) {
+                                    my $course_id = $newattr{'coursecode'}.$1;
+                                    my $outcome = &localenroll::new_course($course_id,$newattr{'courseowner'});
+                                    unless ($outcome eq 'ok') {
+                                        $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $1 for the following reason: $outcome.<br/>");
+                                    }
+                                } else {
+                                    $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $sec because this is not a valid section entry.<br/>");
+                                }
+                            }
+                        }
 	            } else {
 	                $warning .= &mt("As no section numbers are currently listed for LON-CAPA course: ").$description.&mt(", automated enrollment will not occur for any sections of coursecode: ").$newattr{'coursecode'}."<br/>";
 	            }