Revision: 2615
https://sourceforge.net/p/mrbs/code/2615/
Author: cimorrison
Date: 2012-12-27 10:26:44 +0000 (Thu, 27 Dec 2012)
Log Message:
-----------
Made conflict and policy checking work with the new tables
Modified Paths:
--------------
mrbs/branches/linked_bookings/web/mrbs_sql.inc
Modified: mrbs/branches/linked_bookings/web/mrbs_sql.inc
===================================================================
--- mrbs/branches/linked_bookings/web/mrbs_sql.inc 2012-12-27 10:05:00 UTC
(rev 2614)
+++ mrbs/branches/linked_bookings/web/mrbs_sql.inc 2012-12-27 10:26:44 UTC
(rev 2615)
@@ -17,7 +17,7 @@
*/
function mrbsCheckFree(&$booking, $ignore, $repignore)
{
- global $tbl_entry;
+ global $tbl_entry, $tbl_room_entry;
global $enable_periods, $periods, $twentyfourhour_format;
global $strftime_format;
@@ -27,11 +27,12 @@
get_area_settings(get_area($room_id));
// Select any meetings which overlap for this room:
- $sql = "SELECT id, name, start_time, create_by, status
- FROM $tbl_entry
+ $sql = "SELECT E.id, name, start_time, create_by, status
+ FROM $tbl_entry E, $tbl_room_entry RE
WHERE start_time < ${booking['end_time']}
AND end_time > ${booking['start_time']}
- AND room_id = $room_id";
+ AND E.id = RE.entry_id
+ AND RE.room_id = $room_id";
if ($ignore > 0)
{
@@ -103,7 +104,7 @@
function checkInterval(&$booking, $ignore, $repignore, $interval_type='day',
$only_area=FALSE)
{
global $max_per_interval_global, $max_per_interval_area;
- global $tbl_entry, $tbl_room;
+ global $tbl_entry, $tbl_room, $tbl_room_entry;
// Get the area id. We only need to do this once as all bookings will be
// in the same area.
@@ -172,11 +173,12 @@
if (!isset($existing[$location][$interval_type][$interval_start]))
{
$sql = "SELECT COUNT(*)
- FROM $tbl_entry E, $tbl_room R
+ FROM $tbl_entry E, $tbl_room R, $tbl_room_entry RE
WHERE E.start_time<$interval_end
AND E.end_time>$interval_start
AND E.create_by='" . sql_escape($booking['create_by']) . "'
- AND E.room_id=R.id
+ AND E.id = RE.entry_id
+ AND RE.room_id=R.id
AND R.disabled=0";
if ($only_area)
{
@@ -190,7 +192,7 @@
{
$sql .= " AND E.repeat_id <> $repignore";
}
-
+
$existing[$location][$interval_type][$interval_start] = sql_query1($sql);
if ($existing[$location][$interval_type][$interval_start] < 0)
{
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits