Skip to content

Commit 25bc1d9

Browse files
committed
Update Client Overview to Show Recents ASC not DESC so most recent shows first and do not show already Expired Items, will reseve that for a new card
1 parent 68458e4 commit 25bc1d9

File tree

1 file changed

+45
-28
lines changed

1 file changed

+45
-28
lines changed

client_overview.php

+45-28
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,48 @@
77
$mysqli,
88
"SELECT * FROM logs
99
WHERE log_client_id = $client_id
10-
ORDER BY log_created_at DESC LIMIT 5"
10+
ORDER BY log_created_at ASC
11+
LIMIT 5"
1112
);
1213

1314
$sql_important_contacts = mysqli_query(
1415
$mysqli,
1516
"SELECT * FROM contacts
1617
WHERE contact_client_id = $client_id
17-
AND (contact_important = 1 OR contact_billing = 1 OR contact_technical = 1 OR contact_primary = 1)
18-
AND contact_archived_at IS NULL
18+
AND (contact_important = 1
19+
OR contact_billing = 1
20+
OR contact_technical = 1
21+
OR contact_primary = 1
22+
)
23+
AND contact_archived_at IS NULL
1924
ORDER BY contact_primary DESC, contact_name DESC LIMIT 5"
2025
);
2126

2227
$sql_recent_tickets = mysqli_query(
2328
$mysqli,
2429
"SELECT * FROM tickets
2530
WHERE ticket_client_id = $client_id
26-
ORDER BY ticket_created_at DESC LIMIT 5"
31+
ORDER BY ticket_created_at ASC
32+
LIMIT 5"
2733
);
2834

2935
$sql_recent_logins = mysqli_query(
3036
$mysqli,
3137
"SELECT * FROM logins
3238
WHERE login_client_id = $client_id
33-
ORDER BY login_updated_at DESC LIMIT 5"
39+
ORDER BY login_updated_at ASC
40+
LIMIT 5"
3441
);
3542

3643
$sql_shared_items = mysqli_query(
3744
$mysqli,
3845
"SELECT * FROM shared_items
3946
WHERE item_client_id = $client_id
40-
AND item_active = 1
41-
AND item_views != item_view_limit
42-
AND item_expire_at > NOW()
43-
ORDER BY item_created_at DESC LIMIT 5"
47+
AND item_active = 1
48+
AND item_views != item_view_limit
49+
AND item_expire_at > NOW()
50+
ORDER BY item_created_at ASC
51+
LIMIT 5"
4452
);
4553

4654
/*
@@ -52,53 +60,62 @@
5260
$mysqli,
5361
"SELECT * FROM tickets
5462
WHERE ticket_client_id = $client_id
55-
AND ticket_updated_at < CURRENT_DATE - INTERVAL 3 DAY
56-
AND ticket_closed_at IS NULL
57-
ORDER BY ticket_updated_at DESC LIMIT 5"
63+
AND ticket_updated_at < CURRENT_DATE - INTERVAL 3 DAY
64+
AND ticket_closed_at IS NULL
65+
ORDER BY ticket_updated_at ASC
66+
LIMIT 5"
5867
);
5968

6069
// Get Domains Expiring
6170
$sql_domains_expiring = mysqli_query(
6271
$mysqli,
6372
"SELECT * FROM domains
6473
WHERE domain_client_id = $client_id
65-
AND domain_expire IS NOT NULL
66-
AND domain_archived_at IS NULL
67-
AND domain_expire < CURRENT_DATE + INTERVAL 90 DAY
68-
ORDER BY domain_expire DESC LIMIT 5"
74+
AND domain_expire IS NOT NULL
75+
AND domain_archived_at IS NULL
76+
AND domain_expire > CURRENT_DATE
77+
AND domain_expire < CURRENT_DATE + INTERVAL 90 DAY
78+
ORDER BY domain_expire ASC
79+
LIMIT 5"
6980
);
7081

7182
// Get Licenses Expiring
7283
$sql_licenses_expiring = mysqli_query(
7384
$mysqli,
7485
"SELECT * FROM software
7586
WHERE software_client_id = $client_id
76-
AND software_expire IS NOT NULL
77-
AND software_archived_at IS NULL
78-
AND software_expire < CURRENT_DATE + INTERVAL 90 DAY
79-
ORDER BY software_expire DESC LIMIT 5"
87+
AND software_expire IS NOT NULL
88+
AND software_archived_at IS NULL
89+
AND software_expire > CURRENT_DATE
90+
AND software_expire < CURRENT_DATE + INTERVAL 90 DAY
91+
ORDER BY software_expire ASC
92+
LIMIT 5"
8093
);
8194

8295
// Get Asset Warranties Expiring
8396
$sql_asset_warranties_expiring = mysqli_query(
8497
$mysqli,
8598
"SELECT * FROM assets
8699
WHERE asset_client_id = $client_id
87-
AND asset_warranty_expire IS NOT NULL
88-
AND asset_archived_at IS NULL
89-
AND asset_warranty_expire < CURRENT_DATE + INTERVAL 90 DAY
90-
ORDER BY asset_warranty_expire DESC LIMIT 5"
100+
AND asset_warranty_expire IS NOT NULL
101+
AND asset_archived_at IS NULL
102+
AND asset_warranty_expire > CURRENT_DATE
103+
AND asset_warranty_expire < CURRENT_DATE + INTERVAL 90 DAY
104+
ORDER BY asset_warranty_expire ASC
105+
LIMIT 5"
91106
);
92107

93108
// Get Assets Retiring
94109
$sql_asset_retire = mysqli_query(
95110
$mysqli,
96111
"SELECT * FROM assets
97112
WHERE asset_client_id = $client_id
98-
AND asset_install_date IS NOT NULL
99-
AND asset_archived_at IS NULL
100-
AND asset_install_date + INTERVAL 7 YEAR < CURRENT_DATE + INTERVAL 90 DAY
101-
ORDER BY asset_install_date DESC LIMIT 5"
113+
AND asset_install_date IS NOT NULL
114+
AND asset_archived_at IS NULL
115+
AND asset_install_date > CURRENT_DATE
116+
AND asset_install_date + INTERVAL 7 YEAR < CURRENT_DATE + INTERVAL 90 DAY
117+
ORDER BY asset_install_date ASC
118+
LIMIT 5"
102119
);
103120

104121
?>

0 commit comments

Comments
 (0)