[drupal] add an "enabled" filter to sensor queries
This commit is contained in:
parent
727e2f7789
commit
19f32d1da8
|
@ -158,8 +158,8 @@ function _logger_account_sensors($type = 'electricity') {
|
||||||
$result = db_query("SELECT lm.meter, lm.function, lt.token, lt.permissions
|
$result = db_query("SELECT lm.meter, lm.function, lt.token, lt.permissions
|
||||||
FROM {logger_meters} lm
|
FROM {logger_meters} lm
|
||||||
INNER JOIN {logger_tokens} lt ON lm.meter = lt.meter
|
INNER JOIN {logger_tokens} lt ON lm.meter = lt.meter
|
||||||
WHERE lm.uid = %d AND lm.type = '%s'
|
WHERE lm.uid = %d AND lm.type = '%s' AND lm.enabled = %d
|
||||||
ORDER BY lm.function", $user->uid, $type);
|
ORDER BY lm.function", $user->uid, $type, 1);
|
||||||
|
|
||||||
while ($sensor = db_fetch_object($result)) {
|
while ($sensor = db_fetch_object($result)) {
|
||||||
$row = array();
|
$row = array();
|
||||||
|
|
|
@ -316,20 +316,20 @@ function _logger_dashboard($type, $function, $interval) {
|
||||||
|
|
||||||
$main_me = db_fetch_object(db_query("SELECT meter, function
|
$main_me = db_fetch_object(db_query("SELECT meter, function
|
||||||
FROM {logger_meters}
|
FROM {logger_meters}
|
||||||
WHERE uid = %d AND type = '%s' AND function = '%s'
|
WHERE uid = %d AND type = '%s' AND function = '%s' AND enabled = %d
|
||||||
ORDER BY created", $user->uid, $type, $function));
|
ORDER BY created", $user->uid, $type, $function, 1));
|
||||||
|
|
||||||
if (is_array($user->roles) && in_array('pro', array_values($user->roles)))
|
if (is_array($user->roles) && in_array('pro', array_values($user->roles)))
|
||||||
$result_me = db_query("SELECT meter, function
|
$result_me = db_query("SELECT meter, function
|
||||||
FROM {logger_meters}
|
FROM {logger_meters}
|
||||||
WHERE uid = %d AND type = '%s' and chart = %d
|
WHERE uid = %d AND type = '%s' AND enabled = %d AND chart = %d
|
||||||
ORDER BY function", $user->uid, $type, 1);
|
ORDER BY function", $user->uid, $type, 1, 1);
|
||||||
|
|
||||||
else
|
else
|
||||||
$result_me = db_query("SELECT meter, function
|
$result_me = db_query("SELECT meter, function
|
||||||
FROM {logger_meters}
|
FROM {logger_meters}
|
||||||
WHERE uid = %d AND type = '%s'
|
WHERE uid = %d AND type = '%s' AND enabled = %d
|
||||||
ORDER BY function", $user->uid, $type);
|
ORDER BY function", $user->uid, $type, 1);
|
||||||
|
|
||||||
$meter_me = db_fetch_object($result_me);
|
$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 {user_relationship_types} urt ON ur.rtid = urt.rtid)
|
||||||
INNER JOIN {logger_meters} lm ON u.uid = lm.uid)
|
INNER JOIN {logger_meters} lm ON u.uid = lm.uid)
|
||||||
INNER JOIN {logger_users} lu ON u.uid = lu.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'
|
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);
|
ORDER BY ur.rid", $user->uid, 'subscription', $type, $function, 1);
|
||||||
$meter_sub = db_fetch_object($result_sub);
|
$meter_sub = db_fetch_object($result_sub);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
|
Loading…
Reference in New Issue