Changeset:
        2ea31357779f
        
https://sourceforge.net/p/mrbs/hg-code/ci/2ea31357779f4490d3a3a5d88378032b707c31b6
Author:
        Campbell Morrison <[email protected]>
Date:
        Thu Jul 07 16:35:15 2016 +0100
Log message:

Ignored type field in reports if there are fewer than two types

diffstat:

 web/report.php |  47 +++++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 20 deletions(-)

diffs (87 lines):

diff -r c71d1df8d101 -r 2ea31357779f web/report.php
--- a/web/report.php    Thu Jul 07 16:12:06 2016 +0100
+++ b/web/report.php    Thu Jul 07 16:35:15 2016 +0100
@@ -111,24 +111,27 @@
         break;
       
         
-      case 'typematch':  
-        echo "<div id=\"div_typematch\">\n";
-        $options = array();
-        foreach ($booking_types as $type)
+      case 'typematch':
+        if (count($booking_types) > 1)
         {
-          $options[$type] = get_type_vocab($type);
+          echo "<div id=\"div_typematch\">\n";
+          $options = array();
+          foreach ($booking_types as $type)
+          {
+            $options[$type] = get_type_vocab($type);
+          }
+          $params = array('label'        => get_vocab("match_type") . ':',
+                          'name'         => 'typematch[]',
+                          'id'           => 'typematch',
+                          'options'      => $options,
+                          'force_assoc'  => TRUE,  // in case the type keys 
happen to be digits
+                          'value'        => $vars['typematch'],
+                          'multiple'     => TRUE,
+                          'attributes'   => 'size="5"');
+          generate_select($params);
+          echo "<span>" . get_vocab("ctrl_click_type") . "</span>\n";
+          echo "</div>\n";
         }
-        $params = array('label'        => get_vocab("match_type") . ':',
-                        'name'         => 'typematch[]',
-                        'id'           => 'typematch',
-                        'options'      => $options,
-                        'force_assoc'  => TRUE,  // in case the type keys 
happen to be digits
-                        'value'        => $vars['typematch'],
-                        'multiple'     => TRUE,
-                        'attributes'   => 'size="5"');
-        generate_select($params);
-        echo "<span>" . get_vocab("ctrl_click_type") . "</span>\n";
-        echo "</div>\n";
         break;
       
         
@@ -461,7 +464,7 @@
   global $output_format, $ajax;
   global $custom_fields, $tbl_entry;
   global $approval_somewhere, $confirmation_somewhere;
-  global $field_order_list;
+  global $field_order_list, $booking_types;
 
   // Don't do anything if this is an Ajax request: we only want to send the 
data
   if ($ajax)
@@ -497,7 +500,10 @@
         $values[] = get_vocab("fulldescription_short");
         break;
       case 'type':
-        $values[] = get_vocab("type");
+        if (count($booking_types) > 1)
+        {
+          $values[] = get_vocab("type");
+        }
         break;
       case 'create_by': 
         $values[] = get_vocab("createdby");
@@ -714,7 +720,7 @@
   global $custom_fields, $field_natures, $field_lengths, $tbl_entry;
   global $approval_somewhere, $confirmation_somewhere;
   global $strftime_format;
-  global $select_options;
+  global $select_options, $booking_types;
   global $field_order_list;
   
   // If we're capable of delivering an Ajax request and this is not Ajax 
request,
@@ -848,7 +854,8 @@
     // Add the value to the array.   We don't bother with some fields if
     // they are going to be irrelevant
     if (($confirmation_somewhere || ($field != 'confirmation_enabled')) &&
-        ($approval_somewhere || ($field != 'approval_enabled')) )
+        ($approval_somewhere || ($field != 'approval_enabled')) &&
+        ((count($booking_types) > 1) || ($field != 'type')))
     {
       $values[] = $value;
     }

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to