From 19f32d1da8e60f29fff61bb6aeef5888f4abe584 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Wed, 18 May 2011 21:38:16 +0000 Subject: [PATCH] [drupal] add an "enabled" filter to sensor queries --- server/drupal/modules/logger/logger.admin.inc | 4 ++-- server/drupal/modules/logger/logger.module | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/drupal/modules/logger/logger.admin.inc b/server/drupal/modules/logger/logger.admin.inc index 05f2a59..f28bb06 100644 --- a/server/drupal/modules/logger/logger.admin.inc +++ b/server/drupal/modules/logger/logger.admin.inc @@ -158,8 +158,8 @@ function _logger_account_sensors($type = 'electricity') { $result = db_query("SELECT lm.meter, lm.function, lt.token, lt.permissions FROM {logger_meters} lm INNER JOIN {logger_tokens} lt ON lm.meter = lt.meter - WHERE lm.uid = %d AND lm.type = '%s' - ORDER BY lm.function", $user->uid, $type); + WHERE lm.uid = %d AND lm.type = '%s' AND lm.enabled = %d + ORDER BY lm.function", $user->uid, $type, 1); while ($sensor = db_fetch_object($result)) { $row = array(); diff --git a/server/drupal/modules/logger/logger.module b/server/drupal/modules/logger/logger.module index dac9d82..8a68453 100644 --- a/server/drupal/modules/logger/logger.module +++ b/server/drupal/modules/logger/logger.module @@ -316,20 +316,20 @@ function _logger_dashboard($type, $function, $interval) { $main_me = db_fetch_object(db_query("SELECT meter, function FROM {logger_meters} - WHERE uid = %d AND type = '%s' AND function = '%s' - ORDER BY created", $user->uid, $type, $function)); + WHERE uid = %d AND type = '%s' AND function = '%s' AND enabled = %d + ORDER BY created", $user->uid, $type, $function, 1)); if (is_array($user->roles) && in_array('pro', array_values($user->roles))) $result_me = db_query("SELECT meter, function FROM {logger_meters} - WHERE uid = %d AND type = '%s' and chart = %d - ORDER BY function", $user->uid, $type, 1); + WHERE uid = %d AND type = '%s' AND enabled = %d AND chart = %d + ORDER BY function", $user->uid, $type, 1, 1); else $result_me = db_query("SELECT meter, function FROM {logger_meters} - WHERE uid = %d AND type = '%s' - ORDER BY function", $user->uid, $type); + WHERE uid = %d AND type = '%s' AND enabled = %d + ORDER BY function", $user->uid, $type, 1); $meter_me = db_fetch_object($result_me); @@ -339,8 +339,8 @@ function _logger_dashboard($type, $function, $interval) { INNER JOIN {user_relationship_types} urt ON ur.rtid = urt.rtid) INNER JOIN {logger_meters} lm ON u.uid = lm.uid) INNER JOIN {logger_users} lu ON u.uid = lu.uid - WHERE ur.requester_id = %d AND urt.name = '%s' AND type = '%s' AND function = '%s' - ORDER BY ur.rid", $user->uid, 'subscription', $type, $function); + WHERE ur.requester_id = %d AND urt.name = '%s' AND lm.type = '%s' AND lm.function = '%s' AND lm.enabled = %d + ORDER BY ur.rid", $user->uid, 'subscription', $type, $function, 1); $meter_sub = db_fetch_object($result_sub); switch ($type) {