From d11234801e511658e1ffc0cec1db61fbaa912b7b Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Sun, 8 Nov 2009 16:40:42 +0000 Subject: [PATCH] web: add an aud/year unit type for the guys down-under --- web/drupal/modules/logger/logger.module | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web/drupal/modules/logger/logger.module b/web/drupal/modules/logger/logger.module index f9f9219..5904664 100644 --- a/web/drupal/modules/logger/logger.module +++ b/web/drupal/modules/logger/logger.module @@ -235,7 +235,11 @@ function _logger_dashboard($type, $function, $interval) { break; case 'eur': $meter->unit = 'euro/year'; - $meter->factor = 5361.12; + $meter->factor = 5676; // 18 EURcent/kWh + break; + case 'aud': + $meter->unit = 'aud/year'; + $meter->factor = 5991; // 19 AUDcent/kWh break; } } @@ -309,7 +313,6 @@ function _logger_remove($rid) { } function _logger_unit($unit) { - // TODO : include security checks global $user; // hardcoded type and function db_query("UPDATE {logger_meters} SET unit = '%s' WHERE uid = %d AND type = '%s' AND function = '%s'", $unit, $user->uid, 'electricity', 'main'); @@ -445,16 +448,25 @@ function logger_block($op = 'list', $delta = 0, $edit = array()) { $items[] = 'watt'; $items[] = l('kWh/year', 'logger/unit/kwh', array('attributes' => array('title' => "switch to kWh/year"), 'query' => $destination, 'alias' => TRUE)); $items[] = l('euro/year', 'logger/unit/eur', array('attributes' => array('title' => "switch to euro/year"), 'query' => $destination, 'alias' => TRUE)); + $items[] = l('aud/year', 'logger/unit/aud', array('attributes' => array('title' => "switch to aud/year"), 'query' => $destination, 'alias' => TRUE)); break; case 'kwh': $items[] = l('watt', 'logger/unit/watt', array('attributes' => array('title' => "switch to watt"), 'query' => $destination, 'alias' => TRUE)); $items[] = 'kWh/year'; $items[] = l('euro/year', 'logger/unit/eur', array('attributes' => array('title' => "switch to euro/year"), 'query' => $destination, 'alias' => TRUE)); + $items[] = l('aud/year', 'logger/unit/aud', array('attributes' => array('title' => "switch to aud/year"), 'query' => $destination, 'alias' => TRUE)); break; case 'eur': $items[] = l('watt', 'logger/unit/watt', array('attributes' => array('title' => "switch to watt"), 'query' => $destination, 'alias' => TRUE)); $items[] = l('kWh/year', 'logger/unit/kwh', array('attributes' => array('title' => "switch to kWh/year"), 'query' => $destination, 'alias' => TRUE)); $items[] = 'euro/year'; + $items[] = l('aud/year', 'logger/unit/aud', array('attributes' => array('title' => "switch to aud/year"), 'query' => $destination, 'alias' => TRUE)); + break; + case 'aud': + $items[] = l('watt', 'logger/unit/watt', array('attributes' => array('title' => "switch to watt"), 'query' => $destination, 'alias' => TRUE)); + $items[] = l('kWh/year', 'logger/unit/kwh', array('attributes' => array('title' => "switch to kWh/year"), 'query' => $destination, 'alias' => TRUE)); + $items[] = l('euro/year', 'logger/unit/eur', array('attributes' => array('title' => "switch to euro/year"), 'query' => $destination, 'alias' => TRUE)); + $items[] = 'aud/year'; break; } $block['subject'] = t('Unit');