Changeset:
4bdd18d18dbc
https://sourceforge.net/p/mrbs/hg-code/ci/4bdd18d18dbc8f83653f457abf00f545b54794bc
Author:
Campbell Morrison <[email protected]>
Date:
Thu Jan 28 09:34:43 2016 +0000
Log message:
Allowed the type field to be mandatory (see SF Support Requests 876)
diffstat:
web/edit_entry.php | 12 +++++++++---
web/functions_ical.inc | 7 +++++++
web/js/edit_entry.js.php | 4 +++-
web/lang/lang.en | 1 +
web/systemdefaults.inc.php | 9 ++++++---
5 files changed, 26 insertions(+), 7 deletions(-)
diffs (112 lines):
diff -r 399fd6cc76c9 -r 4bdd18d18dbc web/edit_entry.php
--- a/web/edit_entry.php Mon Jan 18 21:08:32 2016 +0000
+++ b/web/edit_entry.php Thu Jan 28 09:34:43 2016 +0000
@@ -464,17 +464,23 @@
function create_field_entry_type($disabled=FALSE)
{
- global $booking_types, $type;
+ global $booking_types, $type, $is_mandatory_field;
echo "<div id=\"div_type\">\n";
$params = array('label' => get_vocab("type") . ":",
'name' => 'type',
'disabled' => $disabled,
+ 'mandatory' => !empty($is_mandatory_field['entry.type']),
'options' => array(),
'force_assoc' => TRUE, // in case the type keys happen to
be digits
'value' => $type);
-
+
+ if (!empty($is_mandatory_field['entry.type']))
+ {
+ $params['options'][''] = get_type_vocab('');
+ }
+
foreach ($booking_types as $key)
{
$params['options'][$key] = get_type_vocab($key);
@@ -885,7 +891,7 @@
$name = "";
$create_by = $user;
$description = $default_description;
- $type = $default_type;
+ $type = (empty($is_mandatory_field['entry.type'])) ? $default_type
: '';
$room_id = $room;
$private = $private_default;
$confirmed = $confirmed_default;
diff -r 399fd6cc76c9 -r 4bdd18d18dbc web/functions_ical.inc
--- a/web/functions_ical.inc Mon Jan 18 21:08:32 2016 +0000
+++ b/web/functions_ical.inc Thu Jan 28 09:34:43 2016 +0000
@@ -833,6 +833,13 @@
{
require_once "functions_mail.inc";
+ if (!$series && !isset($data['entry_type']))
+ {
+ var_dump($data);
+ debug_print_backtrace();
+ exit;
+ }
+
global $confirmation_enabled, $mail_settings, $timezone, $vtimezone,
$default_area_room_delimiter;
diff -r 399fd6cc76c9 -r 4bdd18d18dbc web/js/edit_entry.js.php
--- a/web/js/edit_entry.js.php Mon Jan 18 21:08:32 2016 +0000
+++ b/web/js/edit_entry.js.php Thu Jan 28 09:34:43 2016 +0000
@@ -239,12 +239,14 @@
var field, label;
<?php
// First of all create a property in the vocab object for each of the
mandatory
- // fields. These will be the 'name' and 'rooms' fields and any other
fields
+ // fields. These will be, potentially, some of the standard fields and
any other fields
// defined by the config variable $is_mandatory_field
?>
validationMessages.vocab = {};
validationMessages.vocab['name'] = '';
+ validationMessages.vocab['description'] = '';
validationMessages.vocab['rooms'] = '';
+ validationMessages.vocab['type'] = '';
<?php
foreach ($is_mandatory_field as $key => $value)
{
diff -r 399fd6cc76c9 -r 4bdd18d18dbc web/lang/lang.en
--- a/web/lang/lang.en Mon Jan 18 21:08:32 2016 +0000
+++ b/web/lang/lang.en Thu Jan 28 09:34:43 2016 +0000
@@ -513,6 +513,7 @@
$vocab["restore_original"] = "Restore original";
// Entry types
+$vocab["type."] = "Please select a type";
$vocab["type.I"] = "Internal";
$vocab["type.E"] = "External";
diff -r 399fd6cc76c9 -r 4bdd18d18dbc web/systemdefaults.inc.php
--- a/web/systemdefaults.inc.php Mon Jan 18 21:08:32 2016 +0000
+++ b/web/systemdefaults.inc.php Thu Jan 28 09:34:43 2016 +0000
@@ -568,10 +568,12 @@
$is_mandatory_field = array();
-// You can define custom entry fields to be mandatory by setting
-// items in the array $is_mandatory_field. (Note that making a checkbox
-// field mandatory means that the box must be checked.) For example:
+// You can define custom entry fields and some of the standard fields
(description
+// and type) to be mandatory by setting items in the array $is_mandatory_field.
+// (Note that making a checkbox field mandatory means that the box must be
checked.)
+// For example:
+// $is_mandatory_field['entry.type'] = true;
// $is_mandatory_field['entry.terms_and_conditions'] = true;
// Set $skip_default to TRUE if you want the "Skip past conflicts" box
@@ -1159,6 +1161,7 @@
$booking_types[] = "I";
// Default type for new bookings
+// (Note that the default type does not apply if the type field is mandatory)
$default_type = "I";
// Default description for new bookings
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits