Project

General

Profile

Revision dbc2bfa9

IDdbc2bfa999e320fefb994358f70c28a612ee2f10
Parent 0f129a6f
Child 2228f46b

Added by Andreas Kohlbecker about 2 years ago

fix #6563 perferring freetext over atomized min max valued and removing useless Error value handling

View differences:

modules/cdm_dataportal/includes/common.inc
307 307
 * @param string $field_base_name
308 308
 *    The base name for all measurement fields. This name is at the same time the full name of the
309 309
 *    min value.
310
 * @return array
311
 *   the resulting min max array
310
 * @return string
311
 *   The markup for the min max
312 312
 */
313 313
function min_max_measure($object, $field_base_name)
314 314
{
315 315
  static $default_unit = 'm';
316 316

  
317
  $min_max_array = min_max_array();
318
  if (@is_numeric($object->$field_base_name)) {
319
    $min_max_array['Min'] = new stdClass();
320
    $min_max_array['Min']->_value = $object->$field_base_name;
321
  }
322

  
323
  $field_name = $field_base_name . 'Max';
324
  if (@is_numeric($object->$field_name)) {
325
    $min_max_array['Max'] = new stdClass();
326
    $min_max_array['Max']->_value = $object->$field_name;
327
  }
328
  $min_max_markup = min_max_markup($min_max_array, $default_unit);
329

  
330
  $field_name = $field_base_name . 'Error';
331
  if (@is_numeric($object->$field_name )) {
332
    $min_max_markup .= ' +/- ' . $object->$field_name . ' ' . $default_unit;
333
  }
334 317
  $field_name = $field_base_name . 'Text';
335 318
  if (@is_string($object->$field_name)) {
336
    $min_max_markup .= ' ' . $object->$field_name;
319
    // Freetext overrides all other data
320
    $min_max_markup = ' ' . $object->$field_name;
321
  } else {
322
    // create markup for the atomized min max data
323
    $min_max_array = min_max_array();
324
    if (@is_numeric($object->$field_base_name)) {
325
      $min_max_array['Min'] = new stdClass();
326
      $min_max_array['Min']->_value = $object->$field_base_name;
327
    }
328
    $field_name = $field_base_name . 'Max';
329
    if (@is_numeric($object->$field_name)) {
330
      $min_max_array['Max'] = new stdClass();
331
      $min_max_array['Max']->_value = $object->$field_name;
332
    }
333
    $min_max_markup = min_max_markup($min_max_array, $default_unit);
337 334
  }
335

  
338 336
  return $min_max_markup;
339 337
}
340 338

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)