Commit a0b99dc6 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor changes to ensure that short extensions get all the way up to the

maximum extension limit.
parent a4d2769f
...@@ -429,7 +429,7 @@ window.ShowExtendModal = (function() ...@@ -429,7 +429,7 @@ window.ShowExtendModal = (function()
// Request as much time as possible, up to the maximum allowed // Request as much time as possible, up to the maximum allowed
// by the reservation system. Put up a modal for confirmation. // by the reservation system. Put up a modal for confirmation.
// //
function RequestMaxExtension(hours) function RequestMaxExtension(hours, actual)
{ {
$('#restricted_extend_modal #hours').html(hours); $('#restricted_extend_modal #hours').html(hours);
...@@ -449,7 +449,7 @@ window.ShowExtendModal = (function() ...@@ -449,7 +449,7 @@ window.ShowExtendModal = (function()
"status", "status",
"RequestExtension", "RequestExtension",
{"uuid" : uuid, {"uuid" : uuid,
"howlong": hours}); "howlong": actual});
xmlthing.done(requestcallback); xmlthing.done(requestcallback);
}); });
sup.ShowModal('#restricted_extend_modal'); sup.ShowModal('#restricted_extend_modal');
...@@ -546,7 +546,7 @@ window.ShowExtendModal = (function() ...@@ -546,7 +546,7 @@ window.ShowExtendModal = (function()
} }
else if (hours < 24) { else if (hours < 24) {
// Different path; request as much as we can get. // Different path; request as much as we can get.
RequestMaxExtension(hours); RequestMaxExtension(hours, later);
} }
else { else {
// Maximum number of days beyond current expiration! // Maximum number of days beyond current expiration!
......
...@@ -363,20 +363,14 @@ function Do_RequestExtension() ...@@ -363,20 +363,14 @@ function Do_RequestExtension()
goto bad; goto bad;
} }
$wanted = $ajax_args["howlong"]; $wanted = $ajax_args["howlong"];
if (! preg_match("/^\d+$/", $wanted)) { if (preg_match("/^\d+$/", $wanted)) {
if (strtotime($wanted)) { if ($wanted < 1) {
if (!ISADMIN()) { SPITAJAX_ERROR(1, "Hours must be an integer greater then 1");
SPITAJAX_ERROR(1, "Only administrators can use a datetime");
goto bad;
}
}
else {
SPITAJAX_ERROR(1, "Invalid characters in hours");
goto bad; goto bad;
} }
} }
else if ($wanted < 1) { elseif (!strtotime($wanted)) {
SPITAJAX_ERROR(1, "Hours must be an integer greater then 1"); SPITAJAX_ERROR(1, "Invalid characters in hours");
goto bad; goto bad;
} }
if (ISADMIN()) { if (ISADMIN()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment