Commit a0b99dc6 authored by Leigh Stoller's avatar Leigh 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()
// Request as much time as possible, up to the maximum allowed
// by the reservation system. Put up a modal for confirmation.
//
function RequestMaxExtension(hours)
function RequestMaxExtension(hours, actual)
{
$('#restricted_extend_modal #hours').html(hours);
......@@ -449,7 +449,7 @@ window.ShowExtendModal = (function()
"status",
"RequestExtension",
{"uuid" : uuid,
"howlong": hours});
"howlong": actual});
xmlthing.done(requestcallback);
});
sup.ShowModal('#restricted_extend_modal');
......@@ -546,7 +546,7 @@ window.ShowExtendModal = (function()
}
else if (hours < 24) {
// Different path; request as much as we can get.
RequestMaxExtension(hours);
RequestMaxExtension(hours, later);
}
else {
// Maximum number of days beyond current expiration!
......
......@@ -363,20 +363,14 @@ function Do_RequestExtension()
goto bad;
}
$wanted = $ajax_args["howlong"];
if (! preg_match("/^\d+$/", $wanted)) {
if (strtotime($wanted)) {
if (!ISADMIN()) {
SPITAJAX_ERROR(1, "Only administrators can use a datetime");
goto bad;
}
}
else {
SPITAJAX_ERROR(1, "Invalid characters in hours");
if (preg_match("/^\d+$/", $wanted)) {
if ($wanted < 1) {
SPITAJAX_ERROR(1, "Hours must be an integer greater then 1");
goto bad;
}
}
else if ($wanted < 1) {
SPITAJAX_ERROR(1, "Hours must be an integer greater then 1");
elseif (!strtotime($wanted)) {
SPITAJAX_ERROR(1, "Invalid characters in hours");
goto bad;
}
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