You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2014/10/30 20:09:32 UTC

svn commit: r1635590 - /vcl/trunk/web/.ht-inc/blockallocations.php

Author: jfthomps
Date: Thu Oct 30 19:09:32 2014
New Revision: 1635590

URL: http://svn.apache.org/r1635590
Log:
VCL-740 - Deletion of Block allocations not removing reload reservations

blockallocations.php:
-modified AJdeleteBlockAllocationSubmit: added a query to delete reload reservations corresponding to blockComputers entries
-modified AJtoggleBlockTime: updated query that deletes reload reservations to include laststateid and userid = $reloadid to more closely match new query in AJdeleteBlockAllocationSubmit:

Modified:
    vcl/trunk/web/.ht-inc/blockallocations.php

Modified: vcl/trunk/web/.ht-inc/blockallocations.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/blockallocations.php?rev=1635590&r1=1635589&r2=1635590&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/blockallocations.php (original)
+++ vcl/trunk/web/.ht-inc/blockallocations.php Thu Oct 30 19:09:32 2014
@@ -2219,9 +2219,21 @@ function AJdeleteBlockAllocationConfirm(
 function AJdeleteBlockAllocationSubmit() {
 	$blockid = getContinuationVar('blockid');
 	$query = "UPDATE blockRequest SET status = 'deleted' WHERE id = $blockid";
-	doQuery($query, 101);
+	doQuery($query);
+	$reloadid = getUserlistID('vclreload@Local');
+	$query = "DELETE FROM request "
+	       . "WHERE stateid = 19 AND "
+	       .       "laststateid = 19 AND "
+	       .       "userid = $reloadid AND "
+	       .       "id IN (SELECT bc.reloadrequestid "
+	       .              "FROM blockComputers bc, "
+	       .                   "blockTimes bt "
+	       .              "WHERE bt.blockRequestid = $blockid AND "
+	       .                    "bt.id = bc.blockTimeid AND "
+	       .                    "bc.reloadrequestid != 0)";
+	doQuery($query);
 	$query = "DELETE FROM blockTimes WHERE blockRequestid = $blockid";
-	doQuery($query, 101);
+	doQuery($query);
 	$html = getCurrentBlockHTML(1);
 	$html = str_replace("\n", '', $html);
 	$html = str_replace("'", "\'", $html);
@@ -2752,12 +2764,15 @@ function AJtoggleBlockTime() {
 		sendJSON($data);
 		return;
 	}
+	$reloadid = getUserlistID('vclreload@Local');
 	$query = "DELETE FROM request "
 	       . "WHERE id IN "
 	       .    "(SELECT DISTINCT reloadrequestid "
 	       .    "FROM blockComputers "
 	       .    "WHERE blockTimeid = $timeid) AND "
-	       .    "stateid = 19";
+	       .    "stateid = 19 AND "
+	       .    "laststateid = 19 AND "
+	       .    "userid = $reloadid";
 	doQuery($query, 101);
 	$query = "DELETE FROM blockComputers "
 	       . "WHERE blockTimeid = $timeid";