Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 374

Přidáno uživatelem Michal Kliment před asi 15 roky(ů)

Opraven bug, diky kteremu nefungoval vypis zarizeni clena...

Zobrazit rozdíly:

freenetis/trunk/kohana/application/models/device.php
public function get_all_by_member($limit_from = 0, $limit_results = 50, $order_by = 'devices.id', $order_by_direction = 'ASC', $member_id = null)
{
if (isset($member_id))
$where = 'WHERE m.id='.$member_id.'';
else
$where = '';
if ($where == "")
$where = "WHERE t.lang = '".Config::item('locale.lang')."'";
else
$where = "AND t.lang = '".Config::item('locale.lang')."'";
return self::$db->query("SELECT
d.id, IFNULL(t.translated_term,e.value) as type, d.name,
CONCAT(u.name, ' ', u.surname) AS u_name,
i.mac, s.name AS segment_name, ip.ip_address
FROM devices d
JOIN users u ON d.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON d.type = e.id
LEFT JOIN translations t on e.value = t.original_term
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN segments s ON s.id = i.segment_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results
");
$where = 'WHERE m.id='.$member_id.'';
else
$where = '';
return self::$db->query('SELECT
d.id, IFNULL(f.translated_term,e.value) as type, d.name,
CONCAT(u.name, \' \', u.surname) AS u_name,
i.mac, s.name AS segment_name, ip.ip_address
FROM devices d
JOIN users u ON d.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON d.type = e.id
LEFT JOIN (SELECT * FROM translations WHERE lang = "'.Config::item('locale.lang').'") f ON e.value = f.original_term
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN segments s ON s.id = i.segment_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
'.$where.'
ORDER BY '.$order_by.' '.$order_by_direction.
' LIMIT '.$limit_from.','.$limit_results);
}
}

Také k dispozici: Unified diff