[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface slotrequest.pm

raeburn raeburn at source.lon-capa.org
Sat Aug 6 17:32:56 EDT 2016


raeburn		Sat Aug  6 21:32:56 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	slotrequest.pm 
  Log:
  - For 2.11
    - Backport 1.132
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.125 loncom/interface/slotrequest.pm:1.125.2.1
--- loncom/interface/slotrequest.pm:1.125	Wed Sep 23 20:09:07 2015
+++ loncom/interface/slotrequest.pm	Sat Aug  6 21:32:55 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for requesting to have slots added to a students record
 #
-# $Id: slotrequest.pm,v 1.125 2015/09/23 20:09:07 raeburn Exp $
+# $Id: slotrequest.pm,v 1.125.2.1 2016/08/06 21:32:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2740,8 +2740,12 @@
 	}
 
 	if ($entries{$fields{'startreserve'}}) {
-	    $slot{'startreserve'}=
-		&UnixDate($entries{$fields{'startreserve'}},"%s");
+            my $date = &UnixDate($entries{$fields{'startreserve'}},"%s");
+            if ($date eq '') {
+                push(@errors,"$name -- No reservation start time set for slot -- value provided had invalid format");
+            } else {
+                $slot{'startreserve'} = $date;
+            }
 	}
 	if (defined($slot{'startreserve'})
 	    && $slot{'startreserve'} > $slot{'starttime'}) {
@@ -2750,8 +2754,12 @@
 	}
 
         if ($entries{$fields{'endreserve'}}) {
-            $slot{'endreserve'}=
-                &UnixDate($entries{$fields{'endreserve'}},"%s");
+            my $date = &UnixDate($entries{$fields{'endreserve'}},"%s");
+            if ($date eq '') {
+                push(@errors,"$name -- No reservation end time set for slot -- value provided had invalid format");
+            } else {
+                $slot{'endreserve'} = $date;
+            }
         }
         if (defined($slot{'endreserve'})
             && $slot{'endreserve'} > $slot{'starttime'}) {
@@ -2811,12 +2819,14 @@
             }
         }
 	if ($entries{$fields{'uniqueperiod'}}) {
-	    my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}});
-	    my @times=(&UnixDate($start,"%s"),
-		       &UnixDate($end,"%s"));
-	    $slot{'uniqueperiod'}=\@times;
+            my ($start,$end)= map { &UnixDate($_,"%s"); } split(',',$entries{$fields{'uniqueperiod'}});
+            if (($start ne '') && ($end ne '')) {
+                $slot{'uniqueperiod'}=[$start,$end];
+            } else {
+                push(@errors,"$name -- Slot's unique period ignored -- one or both of the comma separated values for start and end had an invalid format");
+            }
 	}
-	if (defined($slot{'uniqueperiod'})
+	if (ref($slot{'uniqueperiod'}) eq 'ARRAY' 
 	    && $slot{'uniqueperiod'}[0] > $slot{'uniqueperiod'}[1]) {
 	    push(@errors,"$name not created -- Slot's unique period start time is later than the unique period's end time.");
 	    next;




More information about the LON-CAPA-cvs mailing list