--- a/views_calc_table.inc 2012-05-21 03:22:17.000000000 +0200 +++ b/views_calc_table.inc 2012-09-27 18:02:07.803101041 +0200 @@ -65,6 +65,24 @@ 'visible' => array(':checkbox[name="style_options[info][' . $field . '][has_calc]"]' => array('checked' => TRUE),), // condition ), ); + $form['info'][$field]['prefix'] = array( + '#type' => 'textfield', + '#title' => t('Prefix'), + '#default_value' => isset($this->options['info'][$field]['prefix']) ? $this->options['info'][$field]['prefix'] : '', + '#size' => 10, + '#states' => array( + 'visible' => array(':checkbox[name="style_options[info][' . $field . '][has_calc]"]' => array('checked' => TRUE),), // condition + ), + ); + $form['info'][$field]['suffix'] = array( + '#type' => 'textfield', + '#title' => t('Suffix'), + '#default_value' => isset($this->options['info'][$field]['suffix']) ? $this->options['info'][$field]['suffix'] : '', + '#size' => 10, + '#states' => array( + 'visible' => array(':checkbox[name="style_options[info][' . $field . '][has_calc]"]' => array('checked' => TRUE),), // condition + ), + ); } $form['precision'] = array( --- a/theme.inc 2012-05-21 03:22:17.000000000 +0200 +++ b/theme.inc 2012-09-27 17:57:20.717925992 +0200 @@ -40,7 +40,7 @@ $row = array(); $row[] = drupal_render($form['info'][$id]['name']); $row[] = drupal_render($form['info'][$id]['align']); - $row[] = drupal_render($form['info'][$id]['has_calc']) . drupal_render($form['info'][$id]['calc']); + $row[] = drupal_render($form['info'][$id]['has_calc']) . drupal_render($form['info'][$id]['calc']) . drupal_render($form['info'][$id]['prefix']) . drupal_render($form['info'][$id]['suffix']); $row[] = drupal_render($form['columns'][$id]); $row[] = drupal_render($form['info'][$id]['separator']); if (!empty($form['info'][$id]['sortable'])) { @@ -287,12 +287,14 @@ if ($field == $column && empty($fields[$field]->options['exclude'])) { // Process only calculated, non-excluded fields. if (in_array($field, $calc_fields) && isset($row->$field_alias)) { + $prefix = !empty($options['info'][$field]['prefix']) ? check_plain($options['info'][$field]['prefix']) : ''; + $suffix = !empty($options['info'][$field]['suffix']) ? check_plain($options['info'][$field]['suffix']) : ''; if ($calc == 'COUNT') { // COUNT is always a numeric value, no matter what kind of field it is. - $vars[$key][$calc][$column] = number_format($row->$field_alias, 0, 0, ','); + $vars[$key][$calc][$column] = $prefix . number_format($row->$field_alias, 0, 0, ',') . $suffix; } else { @@ -315,7 +317,7 @@ $decimal = !empty($fields[$field]->options['decimal']) ? $fields[$field]->options['decimal'] : $options['decimal']; $precision = !empty($fields[$field]->options['precision']) ? $fields[$field]->options['precision'] : $options['precision']; } - $vars[$key][$calc][$column] = number_format($row->$field_alias, $precision, $decimal, $separator); + $vars[$key][$calc][$column] = $prefix . number_format($row->$field_alias, $precision, $decimal, $separator) . $suffix; } } else {