Revision: 1641
http://mrbs.svn.sourceforge.net/mrbs/?rev=1641&view=rev
Author: cimorrison
Date: 2010-11-24 19:07:03 +0000 (Wed, 24 Nov 2010)
Log Message:
-----------
Following the suggestion of C?\195?\169line Grousson, added a new config
variable to enable email notifications for new bookings to be turned off. At
the same time took the opportunity to rationalise the naming of some of the
mail settings, so the variables that control when an email should be sent are
now called $mail_settings['on_new'], $mail_settings['on_change'] and
$mail_settings['on_delete']. The old variables, $mail_settings['admin_all']
and $mail_settings['admin_on_delete'], are still supported for compatibility
but their use is deprecated.
Modified Paths:
--------------
mrbs/trunk/UPGRADE
mrbs/trunk/web/del_entry.php
mrbs/trunk/web/edit_entry_handler.php
mrbs/trunk/web/internalconfig.inc.php
mrbs/trunk/web/systemdefaults.inc.php
Modified: mrbs/trunk/UPGRADE
===================================================================
--- mrbs/trunk/UPGRADE 2010-11-24 17:50:28 UTC (rev 1640)
+++ mrbs/trunk/UPGRADE 2010-11-24 19:07:03 UTC (rev 1641)
@@ -27,6 +27,18 @@
performing the upgrade on your production database.
+Upgrading from prior MRBS 1.4.6
+===============================
+The following configuration variables are now deprecated. Their use is
+supported for the moment but you should change your config file now to
+use the new variables as support for the old variables may be dropped in the
+future:
+
+$mail_settings['admin_all'] replaced by $mail_settings['on_new'] and
+ $mail_settings['on_change']
+$mail_settings['admin_on_delete'] replaced by $mail_settings['on_delete']
+
+
Upgrading from prior MRBS 1.4.5
===============================
MRBS 1.4.5 introduces the concept of tentative bookings, or bookings that
Modified: mrbs/trunk/web/del_entry.php
===================================================================
--- mrbs/trunk/web/del_entry.php 2010-11-24 17:50:28 UTC (rev 1640)
+++ mrbs/trunk/web/del_entry.php 2010-11-24 19:07:03 UTC (rev 1641)
@@ -63,7 +63,7 @@
// Get the settings for this area (they will be needed for policy checking)
get_area_settings($area);
- $notify_by_email = $mail_settings['admin_on_delete'] && $need_to_send_mail;
+ $notify_by_email = $mail_settings['on_delete'] && $need_to_send_mail;
if ($notify_by_email)
{
Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php 2010-11-24 17:50:28 UTC (rev
1640)
+++ mrbs/trunk/web/edit_entry_handler.php 2010-11-24 19:07:03 UTC (rev
1641)
@@ -557,14 +557,13 @@
$is_repeat_table = FALSE;
}
- // Send a mail to the Administrator
- if ($need_to_send_mail)
+ // Send an email if neccessary, provided that the entry creation was
successful
+ if ($need_to_send_mail && !empty($new_id))
{
- // Send a mail only if this a new entry, or if this is an
- // edited entry but we have to send mail on every change,
- // and if the entry creation is successful
- if ( ( (isset($id) && $mail_settings['admin_all']) or !isset($id) ) &&
- (0 != $new_id) )
+ // Only send an email if (a) this is a changed entry and we have to send
emails
+ // on change or (b) it's a new entry and we have to send emails for new
entries
+ if ((isset($id) && $mail_settings['on_change']) ||
+ (!isset($id) && $mail_settings['on_new']))
{
require_once "functions_mail.inc";
// Get room name and area name for email notifications.
Modified: mrbs/trunk/web/internalconfig.inc.php
===================================================================
--- mrbs/trunk/web/internalconfig.inc.php 2010-11-24 17:50:28 UTC (rev
1640)
+++ mrbs/trunk/web/internalconfig.inc.php 2010-11-24 19:07:03 UTC (rev
1641)
@@ -182,8 +182,29 @@
$area_defaults['enable_periods'] = $enable_periods;
$area_defaults['confirmation_enabled'] = $confirmation_enabled;
$area_defaults['confirmed_default'] = $confirmed_default;
-
+
/********************************************************
+ * Deprecated configuration variables
+ ********************************************************/
+
+// If they are still using some of the old configuration variables
+// then replace them with their new equivalents. (Should maybe warn
+// the site admin somehow if they are being used? Perhaps when a
+// database upgrade is performed?)
+
+// Variables deprecated in versions of MRBS > 1.4.5
+
+if (!empty($mail_settings['admin_all']))
+{
+ $mail_settings['on_new'] = TRUE;
+ $mail_settings['on_change'] = TRUE;
+}
+if (!empty($mail_settings['admin_on_delete']))
+{
+ $mail_settings['on_delete'] = TRUE;
+}
+
+/********************************************************
* PHP System Configuration - internal use, do not change
********************************************************/
Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php 2010-11-24 17:50:28 UTC (rev
1640)
+++ mrbs/trunk/web/systemdefaults.inc.php 2010-11-24 19:07:03 UTC (rev
1641)
@@ -743,13 +743,22 @@
// WHEN TO EMAIL
// -------------
-// These settings determine when an email should be sent (an email is always
sent for new
-// bookings provided at least on of the "Who" settings above is set to TRUE).
+// These settings determine when an email should be sent.
// Set to TRUE or FALSE as required
-$mail_settings['admin_on_delete'] = FALSE; // when an entry is deleted
-$mail_settings['admin_all'] = FALSE; // edits as well as new bookings
+//
+// (Note: (a) the variables $mail_settings['admin_on_delete'] and
+// $mail_settings['admin_all'], which were used in MRBS versions 1.4.5 and
+// before are now deprecated. They are still supported for reasons of
backward
+// compatibility, but they may be withdrawn in the future. (b) the default
+// value of $mail_settings['on_new'] is TRUE for compatibility with MRBS 1.4.5
+// and before, where there was no explicit config setting, but mails were
always sent
+// for new bookings if there was somebody to send them to)
+$mail_settings['on_new'] = TRUE; // when an entry is created
+$mail_settings['on_change'] = FALSE; // when an entry is changed
+$mail_settings['on_delete'] = FALSE; // when an entry is deleted
+
// WHAT TO EMAIL
// -------------
// These settings determine what should be included in the email
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits