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

raeburn raeburn at source.lon-capa.org
Tue Jul 15 16:04:03 EDT 2014


raeburn		Tue Jul 15 20:04:03 2014 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - A few more instances where a check is needed that $settings is a reference
    to a hash, in cases where a domain configuration has never been set for 
    course requests etc.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.247 loncom/interface/domainprefs.pm:1.248
--- loncom/interface/domainprefs.pm:1.247	Sat May 31 04:00:02 2014
+++ loncom/interface/domainprefs.pm	Tue Jul 15 20:04:03 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.247 2014/05/31 04:00:02 raeburn Exp $
+# $Id: domainprefs.pm,v 1.248 2014/07/15 20:04:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2084,9 +2084,11 @@
     my $rownum = 0; 
     my ($output,%current);
     my @crstypes = ('official','unofficial','community','textbook');
-    if (ref($settings->{'uniquecode'}) eq 'HASH') {
-        foreach my $type (@crstypes) {
-            $current{$type} = $settings->{'uniquecode'}{$type};
+    if (ref($settings) eq 'HASH') {
+        if (ref($settings->{'uniquecode'}) eq 'HASH') {
+            foreach my $type (@crstypes) {
+                $current{$type} = $settings->{'uniquecode'}{$type};
+            }
         }
     }
     $output .= '<tr>'.
@@ -3120,9 +3122,11 @@
     }
     if ($caller eq 'requestcourses') {
         my %currhash;
-        if (ref($settings->{'validation'}) eq 'HASH') {
-            if ($settings->{'validation'}{'dc'} ne '') {
-                $currhash{$settings->{'validation'}{'dc'}} = 1;
+        if (ref($settings) eq 'HASH') {
+            if (ref($settings->{'validation'}) eq 'HASH') {
+                if ($settings->{'validation'}{'dc'} ne '') {
+                    $currhash{$settings->{'validation'}{'dc'}} = 1;
+                }
             }
         }
         my $numinrow = 2;
@@ -4161,8 +4165,10 @@
                 $datatable .= '<tr>';
             }
             my $currval;
-            if (ref($createsettings->{'shibenv'}) eq 'HASH') {
-                $currval = $createsettings->{'shibenv'}{$fields[$i]};
+            if (ref($createsettings) eq 'HASH') {
+                if (ref($createsettings->{'shibenv'}) eq 'HASH') {
+                    $currval = $createsettings->{'shibenv'}{$fields[$i]};
+                }
             }
             $datatable .= '<td class="LC_left_item">'.
                           '<span class="LC_nobreak">'.
@@ -5166,7 +5172,8 @@
 
 sub defaults_javascript {
     my ($settings) = @_;
-    my ($output,$jstext); 
+    my ($output,$jstext);
+    return unless (ref($settings) eq 'HASH'); 
     if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
         my $maxnum = scalar(@{$settings->{'inststatusorder'}});
         if ($maxnum eq '') {




More information about the LON-CAPA-cvs mailing list