--- loncom/interface/lonmodifycourse.pm	2003/12/28 18:27:49	1.3
+++ loncom/interface/lonmodifycourse.pm	2003/12/29 14:38:44	1.4
@@ -552,7 +552,6 @@ sub modify_course {
 			            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 @@ sub modify_course {
 			            $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/>";
 	            }