Revision: 1649
http://mrbs.svn.sourceforge.net/mrbs/?rev=1649&view=rev
Author: cimorrison
Date: 2010-11-25 17:23:58 +0000 (Thu, 25 Nov 2010)
Log Message:
-----------
- Removed the warning about the use of $provisional_enabled
- Added $provisional_enabled to the list of deprecated config variables that are now replaced by something else, but still supported for the moment in order to make upgrading easier
- Changed the way that the $mail_settings deprecated variables are treated and stopped trying to do anything too smart
Modified Paths:
--------------
mrbs/trunk/web/internalconfig.inc.php
mrbs/trunk/web/upgrade/21/post.inc
Modified: mrbs/trunk/web/internalconfig.inc.php
===================================================================
--- mrbs/trunk/web/internalconfig.inc.php 2010-11-25 10:40:21 UTC (rev 1648)
+++ mrbs/trunk/web/internalconfig.inc.php 2010-11-25 17:23:58 UTC (rev 1649)
@@ -5,7 +5,38 @@
// This file contains internal configuration settings and checking. You should not
// need to change this file unless you are making changes to the MRBS code.
+
/********************************************************
+ * 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.4.1
+if (isset($provisional_enabled))
+{
+ $approval_enabled = ($provisional_enabled) ? TRUE : FALSE;
+}
+
+// Variables deprecated in versions of MRBS > 1.4.5
+
+if (isset($mail_settings['admin_all']))
+{
+ // We won't set $mail_settings['on_new'] because the default is TRUE
+ // which gives the same behaviour as before, and if it's been set to FALSE
+ // it means the site admin has deliberately changed it.
+ $mail_settings['on_change'] = ($mail_settings['admin_all']) ? TRUE : FALSE;
+}
+if (isset($mail_settings['admin_on_delete']))
+{
+ $mail_settings['on_delete'] = ($mail_settings['admin_on_delete']) ? TRUE : FALSE;
+}
+
+
+/********************************************************
* Checking
********************************************************/
// Do some consistency checking of user settings from config.inc.php
@@ -183,26 +214,6 @@
$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/upgrade/21/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/21/post.inc 2010-11-25 10:40:21 UTC (rev 1648)
+++ mrbs/trunk/web/upgrade/21/post.inc 2010-11-25 17:23:58 UTC (rev 1649)
@@ -5,44 +5,8 @@
// Go through the area table and if any of the per-area settings are NULL then
// set them to the area defaults
-require_once "standard_vars.inc.php"; // won't have been included yet and we need it for $area_defaults
-
global $tbl_area, $area_defaults, $boolean_fields;
-global $provisional_enabled, $approval_enabled;
-// $provisional_enabled has now been renamed $approval_enabled, to avoid confusion with
-// tentative bookings. If $provisional_enabled is still being used in the config file
-// then we need to warn them. Furthermore, if $provisional_enabled is TRUE and
-// $approval_enabled is still FALSE, ie the system default, then we assume that they really
-// meant to set $approval_enabled to TRUE and we will use that. Otherwise they will find
-// that areas that have still got the field set to NULL will have approval disabled when
-// previously it was enabled.
-if (isset($provisional_enabled))
-{
- echo "<p class=\"warning\">";
- echo 'Warning: you are still using <code>$provisional_enabled</code> in your config file.
- This has now been replaced by <code>$approval_enabled</code>. Please ';
- if ($area_defaults['approval_enabled'])
- {
- // As they have changed the default setting they must already have $approval_enabled
- // in their config file, so they just need to delete the old variable
- echo 'delete <code>$provisional_enabled</code> from your config file';
- }
- else
- {
- // otherwise they should rename it
- echo 'rename <code>$provisional_enabled</code> to <code>$approval_enabled</code>';
- }
- echo ' once this upgrade is complete.';
- if (!$area_defaults['approval_enabled'] && $provisional_enabled)
- {
- echo '<p class="warning">As you have <code>$provisional_enabled = TRUE;</code> MRBS is assuming
- <code>$approval_enabled = TRUE;</code> as the default setting during this upgrade.</p>';
- $area_defaults['approval_enabled'] = TRUE;
- }
- echo "</p>\n";
-}
-
$fields = sql_field_info($tbl_area);
foreach ($fields as $field)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

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.