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 2015/04/02 20:30:52 UTC

svn commit: r1670950 - in /vcl/trunk/web/.ht-inc: blockallocations.php utils.php

Author: jfthomps
Date: Thu Apr  2 18:30:52 2015
New Revision: 1670950

URL: http://svn.apache.org/r1670950
Log:
VCL-763 - Add missing constraints to database tables

blockallocations.php:
-modified AJtoggleBlockTime - if setting skip from 1 to 0 in database, also set processed to 0 in case the blockTime had been processed already. Otherwise, when skip is set to 0, if the block time had been prevously processed, it will not get processed again (and what had been set up by the previous processing would have been undone when skip was set to 1)
-modified processBlockAllocationInput: if $return['groupid'] == 0, set it to 'NULL' so when it is used for an insert or update, it will be NULL instead of 0

utils.php: modified checkClearImageMeta - added check for query that gets existing imagemeta entry returning no rows - this can happen if the imagemeta entry is due to subimages, and someone deletes the subimages and then updates the image profile, in which case the deleting of the subimages will remove the imagemeta entry, but the continuation for editing the image profile will still have the imagemetaid

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

Modified: vcl/trunk/web/.ht-inc/blockallocations.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/blockallocations.php?rev=1670950&r1=1670949&r2=1670950&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/blockallocations.php (original)
+++ vcl/trunk/web/.ht-inc/blockallocations.php Thu Apr  2 18:30:52 2015
@@ -2808,8 +2808,10 @@ function AJtoggleBlockTime() {
 
 	$skip = $row['skip'] ^ 1;
 	$query = "UPDATE blockTimes "
-	       . "SET skip = $skip "
-	       . "WHERE id = $timeid";
+	       . "SET skip = $skip ";
+	if($skip == 0)
+		$query .= ", processed = 0 ";
+	$query .= "WHERE id = $timeid";
 	doQuery($query, 101);
 	$data['newval'] = $skip;
 	$data['timeid'] = $timeid;
@@ -3071,6 +3073,8 @@ function processBlockAllocationInput() {
 		$errmsg = _("The submitted user group is invalid.");
 		$err = 1;
 	}
+	if(! $err && $return['groupid'] == 0)
+		$return['groupid'] = 'NULL';
 	if(! $err && ($return['seats'] < MIN_BLOCK_MACHINES || $return['seats'] > MAX_BLOCK_MACHINES)) {
 		$errmsg = sprintf(_("The submitted number of seats must be between %d and %d."), MIN_BLOCK_MACHINES, MAX_BLOCK_MACHINES);
 		$err = 1;

Modified: vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1670950&r1=1670949&r2=1670950&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Thu Apr  2 18:30:52 2015
@@ -1764,6 +1764,10 @@ function checkClearImageMeta($imagemetai
 	$qh = doQuery($query, 101);
 	$row = mysql_fetch_assoc($qh);
 	$alldefaults = 1;
+	if(mysql_num_rows($qh) == 0)
+		# it is possible that the imagemeta record could have been deleted before
+		#   this was submitted
+		return 1;
 	foreach($row as $field => $val) {
 		if($field == 'id' || $field == $ignorefield)
 			continue;