Revision: 1248
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1248&view=rev
Author:   cimorrison
Date:     2009-11-10 13:00:18 +0000 (Tue, 10 Nov 2009)

Log Message:
-----------
view_entry.php now shows the booking status

Modified Paths:
--------------
    mrbs/branches/provisional_bookings/web/lang.en
    mrbs/branches/provisional_bookings/web/view_entry.php

Modified: mrbs/branches/provisional_bookings/web/lang.en
===================================================================
--- mrbs/branches/provisional_bookings/web/lang.en      2009-11-10 11:29:47 UTC 
(rev 1247)
+++ mrbs/branches/provisional_bookings/web/lang.en      2009-11-10 13:00:18 UTC 
(rev 1248)
@@ -104,6 +104,9 @@
 $vocab["returnprev"]         = "Return to previous page";
 $vocab["invalid_entry_id"]   = "Invalid entry id.";
 $vocab["invalid_series_id"]  = "Invalid series id.";
+$vocab["status"]             = "Status";
+$vocab["confirmed"]          = "Confirmed booking";
+$vocab["provisional"]        = "Provisional booking";
 
 // Used in edit_entry_handler.php
 $vocab["error"]              = "Error";

Modified: mrbs/branches/provisional_bookings/web/view_entry.php
===================================================================
--- mrbs/branches/provisional_bookings/web/view_entry.php       2009-11-10 
11:29:47 UTC (rev 1247)
+++ mrbs/branches/provisional_bookings/web/view_entry.php       2009-11-10 
13:00:18 UTC (rev 1248)
@@ -74,6 +74,7 @@
           $tbl_room.area_id,
           $tbl_area.area_name,
           $tbl_entry.type,
+          $tbl_entry.status,
           $tbl_entry.private,
           $tbl_entry.room_id,
           " . sql_syntax_timestamp_to_unix("$tbl_entry.timestamp") . " AS 
last_updated,
@@ -123,6 +124,32 @@
 $duration     = $row['duration'] - cross_dst($row['start_time'],
                                              $row['end_time']);
 $writeable = getWritable($row['create_by'], $user);
+
+// Get the status of the booking.   For an individual entry it's easy -
+// we've already got it.   For a series, the repeat table does not hold
+// a status field.  Instead the status of a series is defined by the status 
+// of its members: if any one of them is provisional, then the series as
+// a whole is considered to be provisional.
+//
+// But we won't bother fetching the status with another SQL query if we're not
+// using provisional bookings, because we won't be using it.
+if ($provisional_enabled)
+{
+  if ($series)
+  {
+    $sql = "SELECT COUNT(*)
+            FROM $tbl_entry
+            WHERE $repeat_id=$id
+            AND $status=" . STATUS_PROVISIONAL . "
+            LIMIT 1";
+    $status = (sql_query1($sql) > 0) ? STATUS_PROVISIONAL : STATUS_CONFIRMED;
+  }
+  else
+  {
+    $status       = $row['status'];
+  }
+}
+
 if (is_private_event($private) && !$writeable) 
 {
   $name = "[".get_vocab('private')."]";
@@ -251,6 +278,15 @@
     echo "<td" . (($keep_private) ? " class=\"private\"" : "") . ">" . 
mrbs_nl2br($description) . "</td>\n";
     ?>
    </tr>
+   <?php
+   if ($provisional_enabled)
+   {
+    echo "<tr>\n";
+    echo "<td>" . get_vocab("status") . ":</td>\n";
+    echo "<td>" . (($status == STATUS_PROVISIONAL) ? get_vocab("provisional") 
: get_vocab("confirmed")) . "</td>\n";
+    echo "</tr>\n";
+   }
+   ?>
    <tr>
     <td><?php echo get_vocab("room") ?>:</td>
     <td><?php    echo  mrbs_nl2br($area_name . " - " . $room_name) ?></td>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to