Revision: 1106
http://mrbs.svn.sourceforge.net/mrbs/?rev=1106&view=rev
Author: cimorrison
Date: 2009-05-12 08:51:40 +0000 (Tue, 12 May 2009)
Log Message:
-----------
Fixed bug introduced in Rev 1099. When editing a room, room names are now
only checked for uniqueness if you are changing the room name or the area (ie
not if you are just editing details such as capacity).
Revision Links:
--------------
http://mrbs.svn.sourceforge.net/mrbs/?rev=1099&view=rev
Modified Paths:
--------------
mrbs/trunk/web/edit_area_room.php
Modified: mrbs/trunk/web/edit_area_room.php
===================================================================
--- mrbs/trunk/web/edit_area_room.php 2009-05-05 20:52:42 UTC (rev 1105)
+++ mrbs/trunk/web/edit_area_room.php 2009-05-12 08:51:40 UTC (rev 1106)
@@ -14,8 +14,10 @@
$year = get_form_var('year', 'int');
$area = get_form_var('area', 'int');
$new_area = get_form_var ('new_area', 'int');
+$old_area = get_form_var ('old_area', 'int');
$room = get_form_var('room', 'int');
$room_name = get_form_var('room_name', 'string');
+$old_room_name = get_form_var('old_room_name', 'string');
$area_name = get_form_var('area_name', 'string');
$description = get_form_var('description', 'string');
$capacity = get_form_var('capacity', 'int');
@@ -124,7 +126,11 @@
$valid_area = FALSE;
}
// If so, check that the room name is not already used in the area
- elseif (sql_query1("SELECT COUNT(*) FROM $tbl_room WHERE room_name='" .
addslashes($room_name) . "' AND area_id=$new_area LIMIT 1") > 0)
+ // (only do this if you're changing the room name or the area - if you're
+ // just editing the other details for an existing room we don't want to
reject
+ // the edit because the room already exists!)
+ elseif ( (($new_area != $old_area) || ($room_name != $old_room_name))
+ && sql_query1("SELECT COUNT(*) FROM $tbl_room WHERE room_name='" .
addslashes($room_name) . "' AND area_id=$new_area LIMIT 1") > 0)
{
$valid_room_name = FALSE;
}
@@ -199,11 +205,13 @@
}
?>
</select>
+ <input type="hidden" name="old_area" value="<?php echo $row['area_id'] ?>">
</div>
<div>
<label for="room_name"><?php echo get_vocab("name") ?>:</label>
<input type="text" id="room_name" name="room_name" value="<?php echo
htmlspecialchars($row["room_name"]); ?>">
+ <input type="hidden" name="old_room_name" value="<?php echo
htmlspecialchars($row["room_name"]); ?>">
</div>
<div>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits