Changeset:
5c583da27452
https://sourceforge.net/p/mrbs/hg-code/ci/5c583da27452559b29d26390aeee509a3b472dc9
Author:
Campbell Morrison <[email protected]>
Date:
Wed Oct 21 13:55:55 2015 +0100
Log message:
Fixed bug which caused bookings to be made for all day if any of the areas had
a default duration of all day
diffstat:
web/edit_entry.php | 17 +++++++++--------
web/functions.inc | 31 ++++++++++++++++++-------------
2 files changed, 27 insertions(+), 21 deletions(-)
diffs (88 lines):
diff -r dcfd452b54b3 -r 5c583da27452 web/edit_entry.php
--- a/web/edit_entry.php Wed Oct 21 11:34:52 2015 +0100
+++ b/web/edit_entry.php Wed Oct 21 13:55:55 2015 +0100
@@ -216,14 +216,15 @@
// that there is only one select passing through the variable to the
handler.
// (2) If this is an existing booking that we are editing or copying, then
we do
// not want the default duration applied
- $params = array('name' => $input_name,
- 'id' => $input_id,
- 'label' => get_vocab("all_day"),
- 'label_after' => TRUE,
- 'attributes' => 'data-show=' . (($a['show_all_day']) ? '1'
: '0'),
- 'value' => ($a['default_duration_all_day'] &&
!isset($id) && !$drag),
- 'disabled' => $disable_field,
- 'class' => $class);
+ $params = array('name' => $input_name,
+ 'id' => $input_id,
+ 'label' => get_vocab("all_day"),
+ 'label_after' => TRUE,
+ 'attributes' => 'data-show=' . (($a['show_all_day']) ?
'1' : '0'),
+ 'value' => ($a['default_duration_all_day'] &&
!isset($id) && !$drag),
+ 'disabled' => $disable_field,
+ 'create_hidden' => FALSE,
+ 'class' => $class);
generate_checkbox($params);
diff -r dcfd452b54b3 -r 5c583da27452 web/functions.inc
--- a/web/functions.inc Wed Oct 21 11:34:52 2015 +0100
+++ b/web/functions.inc Wed Oct 21 13:55:55 2015 +0100
@@ -620,24 +620,26 @@
//
// $params an associative array holding the function parameters:
// MANDATORY
-// 'label' The text to be used for the field label.
-// 'name' The name of the element.
+// 'label' The text to be used for the field label.
+// 'name' The name of the element.
// OPTIONAL
-// 'label_after' Whether to put the label before or after the checkbox.
Default FALSE
-// 'label_title' The text to be used for the title attribute for the
field label
-// 'id' The id of the element. Defaults to be the same as the
name.
-// 'value' The value of the input. Default ''
-// 'class' A class (or array of classes) to give the element.
Default NULL
-// 'disabled' Whether the field should be disabled. Default FALSE
-// 'mandatory' Whether the field is a required field. Default FALSE
-// 'attributes' Additional attributes not covered explicitly above.
Default NULL.
-// Can be either a simple string or an array of
attributes.
+// 'label_after' Whether to put the label before or after the
checkbox. Default FALSE
+// 'label_title' The text to be used for the title attribute for the
field label
+// 'id' The id of the element. Defaults to be the same as
the name.
+// 'value' The value of the input. Default ''
+// 'class' A class (or array of classes) to give the element.
Default NULL
+// 'disabled' Whether the field should be disabled. Default FALSE
+// 'create_hidden' Boolean. If TRUE hidden inputs are created if
'disabled' is set
+// Default TRUE
+// 'mandatory' Whether the field is a required field. Default FALSE
+// 'attributes' Additional attributes not covered explicitly above.
Default NULL.
+// Can be either a simple string or an array of
attributes.
//
function generate_checkbox($params)
{
// some sanity checking on params
foreach (array('label', 'label_title', 'name', 'id', 'label_after', 'value',
'class',
- 'disabled', 'mandatory', 'attributes') as $key)
+ 'disabled', 'create_hidden', 'mandatory', 'attributes') as
$key)
{
if (!isset($params[$key]))
{
@@ -659,6 +661,9 @@
case 'mandatory':
$params[$key] = FALSE;
break;
+ case 'create_hidden':
+ $params[$key] = TRUE;
+ break;
case 'class':
$params[$key] = array();
break;
@@ -705,7 +710,7 @@
// and a hidden input if the input box is disabled and the value is true
// (the checkbox isn't posted if not checked)
- if (($params['disabled']) && !empty($params['value']))
+ if (($params['disabled']) && $params['create_hidden'] &&
!empty($params['value']))
{
$html .= "<input type=\"hidden\" value=\"1\" name=\"" . $params['name'] .
"\">\n";
}
------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits