Revision: 2650
          https://sourceforge.net/p/mrbs/code/2650/
Author:   cimorrison
Date:     2013-01-19 14:28:38 +0000 (Sat, 19 Jan 2013)
Log Message:
-----------
Restructured code and fixed bug in generate_select()

Modified Paths:
--------------
    mrbs/branches/linked_bookings/web/edit_entry.php
    mrbs/branches/linked_bookings/web/functions.inc

Modified: mrbs/branches/linked_bookings/web/edit_entry.php
===================================================================
--- mrbs/branches/linked_bookings/web/edit_entry.php    2013-01-19 10:13:14 UTC 
(rev 2649)
+++ mrbs/branches/linked_bookings/web/edit_entry.php    2013-01-19 14:28:38 UTC 
(rev 2650)
@@ -368,7 +368,7 @@
 {
   global $tbl_room, $tbl_area, $areas;
   
-  static $all_rooms;
+  static $all_rooms, $area_sets;
   
   // Get the details of all the enabled rooms
   if (!isset($all_rooms))
@@ -392,11 +392,37 @@
     }
   }
   
+  // Build an array of areas with matching properties
+  if (!isset($area_sets))
+  {
+    $area_ids = array_keys($areas);
+    foreach ($area_ids as $a)
+    {
+      $area_sets[$a] = array();
+      foreach ($area_ids as $b)
+      {
+        if ($a == $b)
+        {
+          continue;
+        }
+        // $area_sets[$a][] = $b;
+      }
+    }
+  }
+
   $options = array();
   if (isset($all_rooms[$area_id]))
   {
-    $options = array($areas[$area_id]['area_name'] => $all_rooms[$area_id]);
+    $options[$areas[$area_id]['area_name']] = $all_rooms[$area_id];
   }
+  foreach ($area_sets[$area_id] as $matching)
+  {
+    if (isset($all_rooms[$matching]))
+    {
+      $options[$areas[$matching]['area_name']] = $all_rooms[$matching];
+    }
+  }
+
   return $options;
 }
 

Modified: mrbs/branches/linked_bookings/web/functions.inc
===================================================================
--- mrbs/branches/linked_bookings/web/functions.inc     2013-01-19 10:13:14 UTC 
(rev 2649)
+++ mrbs/branches/linked_bookings/web/functions.inc     2013-01-19 14:28:38 UTC 
(rev 2650)
@@ -1177,7 +1177,7 @@
     // one of them
     if (is_array(current($params['options'])))
     {
-      if (count($params['options'] == 1))
+      if (count($params['options']) == 1)
       {
         $options_params['options'] = current($params['options']);
         $html .= generate_options($options_params);
------------------------------------------------------------------------------
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

Reply via email to