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

raeburn raeburn@source.lon-capa.org
Wed, 12 Aug 2009 02:04:39 -0000


raeburn		Wed Aug 12 02:04:39 2009 EDT

  Modified files:              
    /loncom/interface	lonrequestcourse.pm 
  Log:
  - %domconfig needed to retrieve list of users to be notified if course request requires approval.
  - Pass ref to hash as additional arg to &get_processtype().
  
  
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.8 loncom/interface/lonrequestcourse.pm:1.9
--- loncom/interface/lonrequestcourse.pm:1.8	Tue Aug 11 01:39:34 2009
+++ loncom/interface/lonrequestcourse.pm	Wed Aug 12 02:04:38 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.8 2009/08/11 01:39:34 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.9 2009/08/12 02:04:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1325,8 +1325,13 @@
         $output = &mt('Invalid LON-CAPA course number for the new course')."\n"; 
         return $output;
     }
-    my $req_notifylist = &Apache::lonnet::get_dom('configuration',['requestcourses'],
-                        $dom);
+    my $req_notifylist;
+    my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom);
+    if (ref($domconfig{'requestcourses'}) eq 'HASH') {
+        if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') {
+            $req_notifylist = $domconfig{'requestcourses'}{'notify'}{'approval'};
+        }
+    }
     my $now = time;
     my $crstype = $env{'form.crstype'};
     my ($startenroll,$endenroll,%sections,%crosslistings,%personnel);
@@ -1363,7 +1368,7 @@
                     personnel     => \%personnel
                   };
     my @inststatuses;
-    my $val = &get_processtype($dom,$crstype,\@inststatuses);
+    my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig);
     if ($val eq '') {
         if ($crstype eq 'official') {
             $output = &mt('You are not permitted to request creation of official courses');
@@ -1476,8 +1481,8 @@
 }
 
 sub get_processtype {
-    my ($dom,$crstype,$inststatuses) = @_;
-    return unless (ref($inststatuses) eq 'ARRAY');
+    my ($dom,$crstype,$inststatuses,$domconfig) = @_;
+    return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH'));
     my (%userenv,%settings,$val);
     my @options = ('autolimit','validate','approve');
     if ($dom eq $env{'user.domain'}) {
@@ -1488,10 +1493,9 @@
             $val = $userenv{'requestcourses.'.$crstype};
             @{$inststatuses} = ('_custom_');
         } else {
-            my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom);
             my ($task,%alltasks);
-            if (ref($domconfig{'requestcourses'}) eq 'HASH') {
-                %settings = %{$domconfig{'requestcourses'}};
+            if (ref($domconfig->{'requestcourses'}) eq 'HASH') {
+                %settings = %{$domconfig->{'requestcourses'}};
                 if (ref($settings{$crstype}) eq 'HASH') {
                     if (($env{'user.adv'}) && (exists($settings{$crstype}{'_LC_adv'}))) {
                         $val = $settings{$crstype}{'_LC_adv'};