Author: jfthomps
Date: Thu Nov  3 19:56:34 2016
New Revision: 1767960

URL: http://svn.apache.org/viewvc?rev=1767960&view=rev
Log:
VCL-1001 - changing a future reservation to a now reservation doesn't properly 
update the reserved computer

requests.php: modified AJsubmitEditRequest: added code to determine if old 
start time was in the future or not and pass 'now' or 'future' to updateRequest 
accordingly

utils.php: modified updateRequest: added additional argument $nowfuture and 
removed code that determined if the reservation was now or future based on the 
reservation start time - the problem was that if a future reservation got 
changed to a now reservation, the isAvailable could have changed the 
computerid, but nowfuture was determined to be now and then the 2nd half of the 
function where the computerid is updated was skipped; so the user ended up with 
a reservation on the same computer they had, which may or may not have another 
reservation on it

xmlrpcWrappers.php: updated XMLRPCextendRequest and XMLRPCsetRequestEnding: 
added 'now' to call to updateRequest

Modified:
    vcl/trunk/web/.ht-inc/requests.php
    vcl/trunk/web/.ht-inc/utils.php
    vcl/trunk/web/.ht-inc/xmlrpcWrappers.php

Modified: vcl/trunk/web/.ht-inc/requests.php
URL: 
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/requests.php?rev=1767960&r1=1767959&r2=1767960&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/requests.php (original)
+++ vcl/trunk/web/.ht-inc/requests.php Thu Nov  3 19:56:34 2016
@@ -3843,7 +3843,11 @@ function AJsubmitEditRequest() {
                return;
        }
        elseif($rc > 0) {
-               updateRequest($requestid);
+               $oldstartts = datetimeToUnix($request['start']);
+               $nowfuture = 'now';
+               if($oldstartts > time())
+                       $nowfuture = 'future';
+               updateRequest($requestid, $nowfuture);
                sendJSON(array('status' => 'success'));
                cleanSemaphore();
                return;

Modified: vcl/trunk/web/.ht-inc/utils.php
URL: 
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1767960&r1=1767959&r2=1767960&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Thu Nov  3 19:56:34 2016
@@ -5574,23 +5574,19 @@ function getRequestInfo($id, $returnNULL
 
 
////////////////////////////////////////////////////////////////////////////////
 ///
-/// \fn updateRequest($requestid)
+/// \fn updateRequest($requestid, $nowfuture)
 ///
 /// \param $requestid - the id of the request to be updated
+/// \param $nowfuture (optional) - "now" or "future"; whether the 
 ///
 /// \brief updates an entry to the request and reservation tables
 ///
 
////////////////////////////////////////////////////////////////////////////////
-function updateRequest($requestid) {
+function updateRequest($requestid, $nowfuture="now") {
        global $requestInfo;
        $startstamp = unixToDatetime($requestInfo["start"]);
        $endstamp = unixToDatetime($requestInfo["end"]);
 
-       if($requestInfo["start"] <= time())
-               $nowfuture = "now";
-       else
-               $nowfuture = "future";
-
        $query = "SELECT logid FROM request WHERE id = $requestid";
        $qh = doQuery($query, 146);
        if(! $row = mysql_fetch_row($qh)) {

Modified: vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
URL: 
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php?rev=1767960&r1=1767959&r2=1767960&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/xmlrpcWrappers.php (original)
+++ vcl/trunk/web/.ht-inc/xmlrpcWrappers.php Thu Nov  3 19:56:34 2016
@@ -1049,7 +1049,7 @@ function XMLRPCextendRequest($requestid,
                             'errormsg' => 'cannot extend at this time');
        }
        // success
-       updateRequest($requestid);
+       updateRequest($requestid, 'now');
        cleanSemaphore();
        return array('status' => 'success');
 }
@@ -1215,7 +1215,7 @@ function XMLRPCsetRequestEnding($request
                             'errormsg' => 'cannot extend at this time');
        }
        // success
-       updateRequest($requestid);
+       updateRequest($requestid, 'now');
        cleanSemaphore();
        return array('status' => 'success');
 }


Reply via email to