Revision: 1707
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1707&view=rev
Author:   cimorrison
Date:     2010-12-14 16:42:46 +0000 (Tue, 14 Dec 2010)

Log Message:
-----------
Added a STATUS:CANCELLED property to cancelled bookings.  It's not clear (to 
me) whether this is strictly required by RFC 5545 but it can't do any harm and 
without it some apps, eg Outlook 2003 (but not 2007), were not recognising 
cancellations that had previously been given a Status.

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/functions_ical.inc
    mrbs/branches/ics_attachments/web/functions_mail.inc
    mrbs/branches/ics_attachments/web/view_entry.php

Modified: mrbs/branches/ics_attachments/web/functions_ical.inc
===================================================================
--- mrbs/branches/ics_attachments/web/functions_ical.inc        2010-12-14 
15:54:18 UTC (rev 1706)
+++ mrbs/branches/ics_attachments/web/functions_ical.inc        2010-12-14 
16:42:46 UTC (rev 1707)
@@ -149,7 +149,7 @@
 
 
 // Create an RFC 5545 iCalendar Event component
-function create_ical_event($data, $text_description, $html_description, 
$addresses, $series=FALSE)
+function create_ical_event($method, $data, $text_description, 
$html_description, $addresses, $series=FALSE)
 {
   global $confirmation_enabled, $mail_settings;
   
@@ -189,8 +189,18 @@
   {
     $results[] = "RECURRENCE-ID:" . $data['ical_recur_id'];
   }
-  if ($confirmation_enabled)
+  // STATUS:  As we can have confirmed and tentative bookings we will send 
that information
+  // in the Status property.   There don't seem to be many apps that do 
anything with it though,
+  // but we might as well send it.   However having sent it we need to send a 
STATUS:CANCELLED
+  // on cancellation.    It's not clear to me from the spec whether this is 
strictly necessary
+  // but it can do no harm and there are some apps that seem to need it - for 
example Outlook
+  // 2003 (but not 2007)
+  if ($method == "CANCEL")
   {
+    $results[] = "STATUS:CANCELLED";
+  }
+  elseif ($confirmation_enabled)
+  {
     $results[] = "STATUS:". (($data['status'] & STATUS_TENTATIVE) ? 
"TENTATIVE" : "CONFIRMED");
   }
   

Modified: mrbs/branches/ics_attachments/web/functions_mail.inc
===================================================================
--- mrbs/branches/ics_attachments/web/functions_mail.inc        2010-12-14 
15:54:18 UTC (rev 1706)
+++ mrbs/branches/ics_attachments/web/functions_mail.inc        2010-12-14 
16:42:46 UTC (rev 1707)
@@ -820,9 +820,9 @@
   $attachment = array();
   if ($mail_settings['icalendar'] && !$enable_periods)
   {
+    $attachment['method']   = "REQUEST";
     $ical_components = array();
-    $ical_components[] = create_ical_event($data, $text_body, $html_body, 
$addresses, $series);
-    $attachment['method']   = "REQUEST";
+    $ical_components[] = create_ical_event($attachment['method'], $data, 
$text_body, $html_body, $addresses, $series);
     $attachment['content']  = create_icalendar($attachment['method'], 
$ical_components);
     $attachment['name']     = $mail_settings['ics_filename'] . ".ics";
   }
@@ -895,9 +895,9 @@
   $attachment = array();
   if ($mail_settings['icalendar'] && !$enable_periods)
   {
+    $attachment['method']   = "CANCEL";
     $ical_components = array();
-    $ical_components[] = create_ical_event($data, $text_body, $html_body, 
$addresses, $series);
-    $attachment['method']   = "CANCEL";
+    $ical_components[] = create_ical_event($attachment['method'], $data, 
$text_body, $html_body, $addresses, $series);
     $attachment['content']  = create_icalendar($attachment['method'], 
$ical_components);
     $attachment['name']     = $mail_settings['ics_filename'] . ".ics";
   }

Modified: mrbs/branches/ics_attachments/web/view_entry.php
===================================================================
--- mrbs/branches/ics_attachments/web/view_entry.php    2010-12-14 15:54:18 UTC 
(rev 1706)
+++ mrbs/branches/ics_attachments/web/view_entry.php    2010-12-14 16:42:46 UTC 
(rev 1707)
@@ -362,7 +362,7 @@
     $html_body['content'] = "<table>\n" . create_details($row, TRUE) . 
"</table>\n";
     $addresses = array();
     $ical_components = array();
-    $ical_components[] = create_ical_event($row, $text_body, $html_body, 
$addresses, $series);
+    $ical_components[] = create_ical_event("REQUEST", $row, $text_body, 
$html_body, $addresses, $series);
     // If it's a series we need to find out which of the individual entries 
have been changed
     // and include them in the iCalendar object
     if ($series)
@@ -376,7 +376,7 @@
           $data = mrbsGetBookingInfo($row['id'], FALSE);
           $text_body['content'] = create_details($data, FALSE);
           $html_body['content'] = "<table>\n" . create_details($data, TRUE) . 
"</table>\n";
-          $ical_components[] = create_ical_event($data, $text_body, 
$html_body, $addresses, FALSE);
+          $ical_components[] = create_ical_event("REQUEST", $data, $text_body, 
$html_body, $addresses, FALSE);
         }
       }
     }


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

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to