Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1224

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

Oprava spatneho poctu zarizeni na vypise zarizeni uzivatele.

Zobrazit rozdíly:

freenetis/branches/testing/application/models/device.php
LEFT JOIN vlan_ifaces vi ON i.id = vi.iface_id
LEFT JOIN ip_addresses ip1 ON ip1.iface_id = i.id
LEFT JOIN ip_addresses ip2 ON ip2.vlan_iface_id = vi.id
WHERE user_id = ? AND IFNULL(ip1.ip_address,ip2.ip_address) IS NOT NULL
WHERE user_id = ?
) AS d
ORDER BY $order_by $order_by_direction
) AS d
freenetis/branches/testing/application/models/ip_address.php
public function get_ip_addresses_of_almostdebtors($payment_notice_boundary, $debtor_boundary)
{
return $this->db->query("
SELECT ip.id, ip.ip_address, ip.whitelisted,
subnet_name, m.name AS member_name,
m.variable_symbol, a.balance
FROM
(
SELECT ip.id, ip.ip_address, ip.whitelisted,
s.name AS subnet_name,
IFNULL(u.member_id, ip.member_id) AS member_id
subnet_name, m.name AS member_name,
m.variable_symbol, a.balance
FROM
(
SELECT ip.id, ip.id AS ip_address_id, ip.ip_address,
ip.whitelisted, IFNULL(i1.device_id,i2.device_id) AS device_id,
ip.member_id, ip.subnet_id
FROM ip_addresses ip
LEFT JOIN ifaces i1 ON ip.iface_id = i1.id
LEFT JOIN vlan_ifaces vi ON ip.vlan_iface_id = vi.id
LEFT JOIN ifaces i2 ON vi.iface_id = i2.id
SELECT ip.id, ip.ip_address, ip.whitelisted,
s.name AS subnet_name,
IFNULL(u.member_id, ip.member_id) AS member_id
FROM
(
SELECT ip.id, ip.id AS ip_address_id, ip.ip_address,
ip.whitelisted, IFNULL(i1.device_id,i2.device_id) AS device_id,
ip.member_id, ip.subnet_id
FROM ip_addresses ip
LEFT JOIN ifaces i1 ON ip.iface_id = i1.id
LEFT JOIN vlan_ifaces vi ON ip.vlan_iface_id = vi.id
LEFT JOIN ifaces i2 ON vi.iface_id = i2.id
) ip
JOIN subnets s ON s.id = ip.subnet_id
LEFT JOIN devices d ON d.id = ip.device_id
LEFT JOIN users u ON u.id = d.user_id
) ip
JOIN subnets s ON s.id = ip.subnet_id
LEFT JOIN devices d ON d.id = ip.device_id
LEFT JOIN users u ON u.id = d.user_id
) ip
JOIN members m ON m.id = ip.member_id
JOIN accounts a ON a.member_id = m.id AND m.id <> 1
JOIN members m ON m.id = ip.member_id
JOIN accounts a ON a.member_id = m.id AND m.id <> 1
WHERE a.balance < ? AND a.balance >= ?
AND (ip.whitelisted IS NULL OR ip.whitelisted = 0)
", $payment_notice_boundary, $debtor_boundary);
}

Také k dispozici: Unified diff