diff --git a/www/aptui/js/extend.js b/www/aptui/js/extend.js index 8518f921f6f7a01cbea9e0568c11e52414b9e20e..d7188c0be6244b085283b30f6c10bbd153e47d69 100644 --- a/www/aptui/js/extend.js +++ b/www/aptui/js/extend.js @@ -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! diff --git a/www/aptui/status.ajax b/www/aptui/status.ajax index f1b538d2d3e5b279a406800cb764539d926bf925..d27f8ed3f9a9b87ae7babb0063b5ed21c5832a9b 100644 --- a/www/aptui/status.ajax +++ b/www/aptui/status.ajax @@ -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()) {