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

raeburn raeburn@source.lon-capa.org
Sat, 22 Aug 2009 18:12:37 -0000


raeburn		Sat Aug 22 18:12:37 2009 EDT

  Modified files:              
    /loncom/interface	lonrequestcourse.pm 
  Log:
  - For users with type 'validate', use lonnet::auto_courserequest_validation()
  instead of auto_validate_instcode() to determine if request can be processed immediately.
  - Change response expected from &auto_validate_instcode() when course code is valid from 'ok' to 'valid' for consistency with localenroll.pm. 
  
  
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.20 loncom/interface/lonrequestcourse.pm:1.21
--- loncom/interface/lonrequestcourse.pm:1.20	Fri Aug 21 13:18:46 2009
+++ loncom/interface/lonrequestcourse.pm	Sat Aug 22 18:12:37 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.20 2009/08/21 13:18:46 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.21 2009/08/22 18:12:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -792,7 +792,7 @@
                 $message = '<div class="LC_warning">'.
                            &mt('No course was found matching your choice of institutional course category.');
             }
-            unless ($code_chk eq 'ok') {
+            unless ($code_chk eq 'valid') {
                 $prev = 'crstype';
             }
             $r->print($message);
@@ -2024,7 +2024,7 @@
             $disposition = &check_autolimit($env{'user.name'},$env{'user.domain'},
                                             $dom,$crstype,$limit,\$message);
         } elsif ($val eq 'validate') {
-            my $inststatuslist;
+            my ($inststatuslist,$validationchk,$validation);
             if (@inststatuses > 0) {
                 $inststatuslist = join(',',@inststatuses);
             }
@@ -2032,23 +2032,18 @@
             if (@instsections > 0) {
                 $instseclist = join(',',@instsections);
             }
-            my $validation = 
-                &Apache::lonnet::auto_validate_instcode('',$dom,$instcode,
-                    $env{'user.name'}.':'.$env{'user.domain'},$inststatuslist,
-                    $instseclist);
-            if ($validation eq 'valid') {
-                $disposition = 'process';
-            } elsif ($validation eq 'rejected') {
-                $disposition = 'rejected';
-            } elsif ($validation eq 'pending') {
-                $disposition = 'pending';
-            } elsif ($disposition eq 'approval') {
-                $disposition = 'approval';
-            } elsif ($disposition =~ /^error(.*)$/) {
+            $validationchk = 
+                &Apache::lonnet::auto_courserequest_validation($dom,
+                    $env{'user.name'}.':'.$env{'user.domain'},$crstype,
+                    $inststatuslist,$instcode,$instseclist);
+            if ($validationchk =~ /:/) {
+                ($validation,$message) = split(':',$validationchk);
+            } else {
+                $validation = $validationchk;
+            }
+            if ($validation =~ /^error(.*)$/) {
                 $disposition = 'approval';
                 $validationerror = $1;
-            } else {
-                $disposition = 'approval';  
             }
         } else {
             $disposition = 'approval';