Revision: 1924
http://mrbs.svn.sourceforge.net/mrbs/?rev=1924&view=rev
Author: cimorrison
Date: 2011-09-05 18:03:17 +0000 (Mon, 05 Sep 2011)
Log Message:
-----------
Added a list of dates of repeat bookings to email notifications.
Modified Paths:
--------------
mrbs/trunk/web/edit_entry_handler.php
mrbs/trunk/web/functions_ical.inc
mrbs/trunk/web/functions_mail.inc
mrbs/trunk/web/lang.en
mrbs/trunk/web/mrbs_sql.inc
Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php 2011-09-05 15:57:24 UTC (rev
1923)
+++ mrbs/trunk/web/edit_entry_handler.php 2011-09-05 18:03:17 UTC (rev
1924)
@@ -157,7 +157,7 @@
}
// BACK: we didn't really want to be here - send them to the returl
-if (isset($back_button))
+if (!empty($back_button))
{
header("Location: $returl");
exit();
@@ -437,8 +437,8 @@
{
$reps = mrbsGetRepeatEntryList($starttime,
isset($end_date) ? $end_date : 0,
- $rep_type, $rep_opt, $max_rep_entrys,
- $rep_num_weeks);
+ $rep_type, $rep_opt, $rep_num_weeks,
+ $max_rep_entrys);
}
// When checking for overlaps, for Edit (not New), ignore this entry and
series:
@@ -804,14 +804,14 @@
if (array_key_exists($field['name'], $custom_fields))
{
echo "<input type=\"hidden\"" .
- "name=\"" . VAR_PREFIX . $field['name'] . "\"" .
- "value=\"" .
htmlspecialchars($custom_fields[$field['name']]) . "\">\n";
+ " name=\"" . VAR_PREFIX . $field['name'] . "\"" .
+ " value=\"" .
htmlspecialchars($custom_fields[$field['name']]) . "\">\n";
}
}
// Submit button
echo "<input type=\"submit\"" .
- "value=\"" . get_vocab("skip_and_book") . "\"" .
- "title=\"" . get_vocab("skip_and_book_note") . "\">\n";
+ " value=\"" . get_vocab("skip_and_book") . "\"" .
+ " title=\"" . get_vocab("skip_and_book_note") . "\">\n";
echo "</fieldset>\n";
echo "</form>\n";
}
Modified: mrbs/trunk/web/functions_ical.inc
===================================================================
--- mrbs/trunk/web/functions_ical.inc 2011-09-05 15:57:24 UTC (rev 1923)
+++ mrbs/trunk/web/functions_ical.inc 2011-09-05 18:03:17 UTC (rev 1924)
@@ -771,8 +771,8 @@
$start_row['end_date'],
$start_row['rep_type'],
$start_row['rep_opt'],
- PHP_INT_MAX,
-
$start_row['rep_num_weeks']);
+ $start_row['rep_num_weeks'],
+ PHP_INT_MAX);
// And keep an array of all the entries we actually see
$actual_entries = array();
// Create the series event
Modified: mrbs/trunk/web/functions_mail.inc
===================================================================
--- mrbs/trunk/web/functions_mail.inc 2011-09-05 15:57:24 UTC (rev 1923)
+++ mrbs/trunk/web/functions_mail.inc 2011-09-05 18:03:17 UTC (rev 1924)
@@ -382,23 +382,65 @@
}
-// Generate the list of bookings that could not be made due to conflicts
-function create_body_exceptions($skip_list, $as_html)
+// Generate a list of dates from an array of start times
+//
+// $dates an array of start times
+// $as_html (boolean) whether the list should be HTML or plain text
+function create_date_list($dates, $as_html)
{
- // The introductory text
- $result = ($as_html) ? "<p>" : "\n\n";
- $result .= get_vocab("mail_body_exceptions");
- $result .= ($as_html) ? "</p>\n" : "\n\n";
- // Now the list of conflicts
- $result .= ($as_html) ? "<ul>\n" : "";
- foreach ($skip_list as $date)
+ $result = ($as_html) ? "<ul>\n" : "";
+ foreach ($dates as $date)
{
$result .= ($as_html) ? "<li>" : "";
$result .= getMailDateString($date);
$result .= ($as_html) ? "</li>" : "\n";
}
$result .= ($as_html) ? "</ul>\n" : "";
+ return $result;
+}
+
+
+// Generate a list of repeat dates for a series
+function create_repeat_list($data, $as_html)
+{
+ global $max_rep_entrys;
+ if ($data['rep_type'] == REP_NONE)
+ {
+ return;
+ }
+
+ // The introductory text
+ $result = ($as_html) ? "<p>" : "\n\n";
+ $result .= get_vocab("mail_body_repeats");
+ $result .= ($as_html) ? "</p>\n" : "\n\n";
+
+ $reps = mrbsGetRepeatEntryList($data['start_time'],
+ $data['end_date'],
+ $data['rep_type'],
+ $data['rep_opt'],
+ $data['rep_num_weeks'],
+ $max_rep_entrys);
+
+ // Remove any dates that could not be booked due to conflicts
+ if (!empty($data['skip_list']))
+ {
+ $reps = array_diff($reps, $data['skip_list']);
+ }
+
+ $result .= create_date_list($reps, $as_html);
+
+ // Now add in the list of repeat bookings that could not be booked
+ if (!empty($data['skip_list']))
+ {
+ // The introductory text
+ $result .= ($as_html) ? "<p>" : "\n\n";
+ $result .= get_vocab("mail_body_exceptions");
+ $result .= ($as_html) ? "</p>\n" : "\n\n";
+ // Now the list of conflicts
+ $result .= create_date_list($data['skip_list'], $as_html);
+ }
+
return $result;
}
@@ -693,11 +735,11 @@
$body .= "</table>\n";
}
- // Now add in the list of repeat bookings that could not be booked
- if (!empty($data['skip_list']))
- {
- $body .= create_body_exceptions($data['skip_list'], $as_html);
- }
+ // Add in a list of repeat dates. Although we've given them the repeat
charateristics
+ // above, it's often helpful to have this expanded out into a list of actual
dates to
+ // avoid any confusion. The repeat list also gives a list of dates that
could not
+ // be booked due to conflicts.
+ $body .= create_repeat_list($data, $as_html);
if ($as_html)
{
Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en 2011-09-05 15:57:24 UTC (rev 1923)
+++ mrbs/trunk/web/lang.en 2011-09-05 18:03:17 UTC (rev 1924)
@@ -160,7 +160,8 @@
$vocab["mail_body_rej_entry"] = "An entry has been rejected by the
administrators, here are the details:";
$vocab["mail_body_more_info"] = "The administrators require more
information about an entry; here are the details:";
$vocab["mail_body_reminder"] = "Reminder - an entry is awaiting approval;
here are the details:";
-$vocab["mail_body_exceptions"] = "The following bookings could not be made
due to conflicts:";
+$vocab["mail_body_repeats"] = "The following dates were booked:";
+$vocab["mail_body_exceptions"] = "The following dates could not be booked
due to conflicts:";
$vocab["mail_subject_new_entry"] = "Entry added for $mrbs_company MRBS";
$vocab["mail_subject_changed_entry"] = "Entry changed for $mrbs_company MRBS";
$vocab["mail_subject_delete"] = "Entry deleted for $mrbs_company MRBS";
Modified: mrbs/trunk/web/mrbs_sql.inc
===================================================================
--- mrbs/trunk/web/mrbs_sql.inc 2011-09-05 15:57:24 UTC (rev 1923)
+++ mrbs/trunk/web/mrbs_sql.inc 2011-09-05 18:03:17 UTC (rev 1924)
@@ -512,8 +512,8 @@
* empty - The entry does not repeat
* an array - This is a list of start times of each of the repeat entrys
*/
-function mrbsGetRepeatEntryList($time, $enddate, $rep_type, $rep_opt,
- $max_ittr, $rep_num_weeks)
+function mrbsGetRepeatEntryList($time, $enddate, $rep_type, $rep_opt,
$rep_num_weeks,
+ $max_ittr)
{
$sec = date("s", $time);
$min = date("i", $time);
@@ -645,7 +645,7 @@
$reps = mrbsGetRepeatEntryList($data['start_time'], $data['end_date'],
$data['rep_type'], $data['rep_opt'],
- $max_rep_entrys, $data['rep_num_weeks']);
+ $data['rep_num_weeks'], $max_rep_entrys);
// Don't make any bookings if we've been asked to book up
// more entries than we are allowed in a single repeat.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits