Revision: 2565
          https://sourceforge.net/p/mrbs/code/2565/
Author:   cimorrison
Date:     2012-11-27 18:28:48 +0000 (Tue, 27 Nov 2012)
Log Message:
-----------
Fixed major bug when editing an individual entry in a series that caused a new 
series to be created alongside the original series.

Modified Paths:
--------------
    mrbs/trunk/web/edit_entry.php
    mrbs/trunk/web/functions.inc

Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php       2012-11-27 18:13:38 UTC (rev 2564)
+++ mrbs/trunk/web/edit_entry.php       2012-11-27 18:28:48 UTC (rev 2565)
@@ -1244,10 +1244,10 @@
 
 
 // Show the repeat fields if (a) it's a new booking and repeats are allowed,
-// or else if it's an existing booking.  (It's not particularly obvious but
+// or else if it's an existing booking and it's a series.  (It's not 
particularly obvious but
 // if edit_type is "series" then it means that either you're editing an 
existing
 // series or else you're making a new booking.  This should be tidied up 
sometime!)
-if ((($edit_type == "series") && $repeats_allowed) || isset($id))
+if (($edit_type == "series") && $repeats_allowed)
 {
   // If repeats aren't allowed or this is not a series then disable
   // the repeat fields - they're for information only
@@ -1263,11 +1263,11 @@
       
   // Repeat type
   echo "<div id=\"rep_type\">\n";
-  cho "<div id=\"rep_type\">\n";r information onlythen disable up 
sometime!)ious butted alongside the original 
series.�f@��u���g+����g+�
�g+���g+�f@����*�g+�[@���Z@��k���g+6
 
��!�!`f@���f@��xt�g+�\@������g+����g+`f@��`���g+�f@���ol�g+u���g+`l�g+�dl�g+�il�g+����g+xt�g+�\@���[@��k���g+�!�!`f@���f@��H>��g+�]@������g+����g+`f@��`���g+�f@���f@���f@��8�

�g+�p��f@��u���g+����g+�]@��p\@��k���g+GHIJKMNOP`f@���f@��H���g+@_@������g+����g+`f@��0ol�g+u���g+��g+�)��g+`l�g+�dl�g+�il�g+����g+H���g+@_@���]@��k���g+8���g+@_@���]@��k���g+(���g+@_@���]@��k���g+���g+@_@��^@��k���g+
 
�nl�g+u���g+�il�g+�X@���x��g+e���g+�dl�g+�^@��yx��g+e���g+`l�g+�^@��Zx��g+e���g+�$��g+��g+�)��g+`l�g+؄�g+�dl�g+�il�g+����g+8�

�g+�g�g+�f@��p���g+�`@��`_@��k���g+5678:<=>?@BD`f@���f@����d�g+�f@��u���g+�
�g+_@���g�g+e���g+��g+�_@f�S 
Q��l���4�g+�f@����d�g+�a@��p`@��k���g+u]��
      
4Q��U^Qʉ��u������*ēv`f@���f@��H>1�g+�m�g+h@����φg+��φg+��j�g+�f@���g@���f@���b@����g+u���g+؄�g+Pi@����φg+
 
h@���c@������������φg+�f@��$params
 = array('label'    => get_vocab("rep_type") . ":",
-                  'name'     => 'rep_type',
-                  'value'    => $rep_type,
-                  'disabled' => $disabled,
-                  'options'  => array());
+  $params = array('label'         => get_vocab("rep_type") . ":",
+                  'name'          => 'rep_type',
+                  'value'         => $rep_type,
+                  'disabled'      => $disabled,
+                  'options'       => array());
   foreach (array(REP_NONE, REP_DAILY, REP_WEEKLY, REP_MONTHLY, REP_YEARLY) as 
$i)
   {
     $params['options'][$i] = get_vocab("rep_type_$i");

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2012-11-27 18:13:38 UTC (rev 2564)
+++ mrbs/trunk/web/functions.inc        2012-11-27 18:28:48 UTC (rev 2565)
@@ -751,16 +751,19 @@
 //
 //   $params    an associative array holding the function parameters:
 //      MANDATORY
-//        'name'        The name of the input.
+//        'name'          The name of the input.
 //      OPTIONAL
-//        'value'       The value of the input.  Default ''
-//        'options'     An associative array where the key is the value of the
-//                      button and the value is the button text
-//        'disabled'    Whether the field should be disabled.  Default FALSE
+//        'value'         The value of the input.  Default ''
+//        'options'       An associative array where the key is the value of 
the
+//                        button and the value is the button text
+//        'disabled'      Whether the field should be disabled.  Default FALSE
+//        'create_hidden' Boolean.  If TRUE hidden inputs are created if 
'disabled' is set
+//                        Default TRUE
+//
 function generate_radio($params)
 {
   // some sanity checking on params
-  foreach (array('label', 'name', 'options', 'value', 'disabled') as $key)
+  foreach (array('label', 'name', 'options', 'value', 'disabled', 
'create_hidden') as $key)
   {
     if (!isset($params[$key]))
     {
@@ -777,6 +780,10 @@
           break;
         case 'disabled':
           $params[$key] = FALSE;
+          break;
+        case 'create_hidden':
+          $params[$key] = TRUE;
+          break;
         default:
           break;
       }
@@ -798,7 +805,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']) && ($params['value'] == $option['key']))
+  if ($params['disabled'] && $params['create_hidden'] && ($params['value'] == 
$option['key']))
   {
     $html .= "<input type=\"hidden\" value=\"" . 
htmlspecialchars($option['key']) . "\" name=\"" . $params['name'] . "\">\n";
   }
@@ -810,18 +817,20 @@
 //
 //   $params    an associative array holding the function parameters:
 //      MANDATORY
-//        'label'       The text to be used for the field label.
-//        'name'        The name of the input.
+//        'label'         The text to be used for the field label.
+//        'name'          The name of the input.
 //      OPTIONAL
-//        'value'       The value of the input.  Default ''
-//        'options'     An associative array where the key is the value of the
-//                      button and the value is the button text
-//        'disabled'    Whether the field should be disabled.  Default FALSE
+//        'value'         The value of the input.  Default ''
+//        'options'       An associative array where the key is the value of 
the
+//                        button and the value is the button text
+//        'disabled'      Whether the field should be disabled.  Default FALSE
+//        'create_hidden' Boolean.  If TRUE hidden inputs are created if 
'disabled' is set
+//                        Default TRUE
 //
 function generate_radio_group($params)
 {
   // some sanity checking on params
-  foreach (array('label', 'name', 'options', 'value', 'disabled') as $key)
+  foreach (array('label', 'name', 'options', 'value', 'disabled', 
'create_hidden') as $key)
   {
     if (!isset($params[$key]))
     {
@@ -839,6 +848,10 @@
           break;
         case 'disabled':
           $params[$key] = FALSE;
+          break;
+        case 'create_hidden':
+          $params[$key] = TRUE;
+          break;
         default:
           break;
       }
@@ -853,14 +866,15 @@
   // Output each radio button
   while ($option = each($params['options']))
   {
-    generate_radio(array('name'     => $params['name'],
-                         'options'  => array($option['key'] => 
$option['value']),
-                         'value'    => $params['value'],
-                         'disabled' => $params['disabled']));
+    generate_radio(array('name'          => $params['name'],
+                         'options'       => array($option['key'] => 
$option['value']),
+                         'value'         => $params['value'],
+                         'disabled'      => $params['disabled'],
+                         'create_hidden' => $params['create_hidden']));
   }
 
   $html = "</div>\n";
-  if ($params['disabled'])
+  if ($params['disabled'] && $params['create_hidden'])
   {
     $html .= "<input type=\"hidden\" name=\"" . $params['name'] . "\"";
     $html .= " value=\"" . htmlspecialchars($params['value']) . "\">\n";
@@ -908,6 +922,7 @@
         case 'force_assoc':
         case 'disabled':
           $params[$key] = FALSE;
+          break;
         default:
           break;
       }
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to