Revision: 2651
https://sourceforge.net/p/mrbs/code/2651/
Author: cimorrison
Date: 2013-01-19 15:49:29 +0000 (Sat, 19 Jan 2013)
Log Message:
-----------
Allowed linked bookings across areas with similar properties
Modified Paths:
--------------
mrbs/branches/linked_bookings/web/edit_entry.php
mrbs/branches/linked_bookings/web/functions.inc
mrbs/branches/linked_bookings/web/internalconfig.inc.php
Modified: mrbs/branches/linked_bookings/web/edit_entry.php
===================================================================
--- mrbs/branches/linked_bookings/web/edit_entry.php 2013-01-19 14:28:38 UTC
(rev 2650)
+++ mrbs/branches/linked_bookings/web/edit_entry.php 2013-01-19 15:49:29 UTC
(rev 2651)
@@ -366,10 +366,10 @@
// Return an array of room options for the area with $area_id
function get_room_options($area_id)
{
- global $tbl_room, $tbl_area, $areas;
+ global $tbl_room, $tbl_area, $areas, $area_fields_to_match;
static $all_rooms, $area_sets;
-
+
// Get the details of all the enabled rooms
if (!isset($all_rooms))
{
@@ -405,7 +405,19 @@
{
continue;
}
- // $area_sets[$a][] = $b;
+ $similar = TRUE;
+ foreach ($area_fields_to_match as $field)
+ {
+ if ($areas[$a][$field] !== $areas[$b][$field])
+ {
+ $similar = FALSE;
+ break;
+ }
+ }
+ if ($similar)
+ {
+ $area_sets[$a][] = $b;
+ }
}
}
}
@@ -1032,8 +1044,7 @@
// Get the details of all the enabled areas
$areas = array();
-$sql = "SELECT id, area_name, resolution, default_duration, enable_periods,
timezone,
- morningstarts, morningstarts_minutes, eveningends ,
eveningends_minutes
+$sql = "SELECT *
FROM $tbl_area
WHERE disabled=0
ORDER BY area_name";
Modified: mrbs/branches/linked_bookings/web/functions.inc
===================================================================
--- mrbs/branches/linked_bookings/web/functions.inc 2013-01-19 14:28:38 UTC
(rev 2650)
+++ mrbs/branches/linked_bookings/web/functions.inc 2013-01-19 15:49:29 UTC
(rev 2651)
@@ -1705,7 +1705,10 @@
// and we're looking at the resolution field)
if (($key != 'resolution') || empty($force_resolution))
{
- $row[$key] = (isset($row[$key])) ? $value : $area_defaults[$key];
+ if (!isset($row[$key]) && isset($area_defaults[$key]))
+ {
+ $row[$key] = $area_defaults[$key];
+ }
}
// Cast those fields which are booleans into booleans
if (in_array($key, $boolean_fields['area']))
Modified: mrbs/branches/linked_bookings/web/internalconfig.inc.php
===================================================================
--- mrbs/branches/linked_bookings/web/internalconfig.inc.php 2013-01-19
14:28:38 UTC (rev 2650)
+++ mrbs/branches/linked_bookings/web/internalconfig.inc.php 2013-01-19
15:49:29 UTC (rev 2651)
@@ -338,6 +338,35 @@
$area_defaults['confirmation_enabled'] = $confirmation_enabled;
$area_defaults['confirmed_default'] = $confirmed_default;
+// The columns which must be identical in areas in order that a booking can be
+// linked across areas
+$area_fields_to_match = array('timezone',
+ 'resolution',
+ 'morningstarts',
+ 'morningstarts_minutes',
+ 'eveningends',
+ 'eveningends_minutes',
+ 'private_enabled',
+ 'private_mandatory',
+ 'private_override',
+ 'min_book_ahead_enabled',
+ 'max_book_ahead_enabled',
+ 'min_book_ahead_secs',
+ 'max_book_ahead_secs',
+ 'max_per_day_enabled',
+ 'max_per_day',
+ 'max_per_week_enabled',
+ 'max_per_week',
+ 'max_per_month_enabled',
+ 'max_per_month',
+ 'max_per_year_enabled',
+ 'max_per_year',
+ 'max_per_future_enabled',
+ 'max_per_future',
+ 'approval_enabled',
+ 'enable_periods',
+ 'confirmation_enabled');
+
// We send Ajax requests to del_entry_ajax.php with data as an array of ids.
// In order to stop the POST request getting too large and triggering a 406
// error, we split the requests into batches with a maximum number of ids
------------------------------------------------------------------------------
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. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits