Fixed ticket link for agent email notifications on scheduling tickets
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
require_once "includes/inc_all_client.php";
|
require_once "includes/inc_all_client.php";
|
||||||
|
|
||||||
$expiration_days = [7, 30, 90]; // Array of expiration days
|
|
||||||
|
|
||||||
$sql_recent_activities = mysqli_query(
|
$sql_recent_activities = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
@@ -60,79 +59,77 @@ $sql_stale_tickets = mysqli_query(
|
|||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM tickets
|
"SELECT * FROM tickets
|
||||||
WHERE ticket_client_id = $client_id
|
WHERE ticket_client_id = $client_id
|
||||||
AND ticket_updated_at < CURRENT_DATE - INTERVAL 3 DAY
|
AND ticket_updated_at < CURRENT_DATE - INTERVAL 7 DAY
|
||||||
AND ticket_resolved_At IS NULL
|
AND ticket_resolved_At IS NULL
|
||||||
AND ticket_closed_at IS NULL
|
AND ticket_closed_at IS NULL
|
||||||
ORDER BY ticket_updated_at ASC
|
ORDER BY ticket_updated_at ASC
|
||||||
LIMIT 5"
|
LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($expiration_days as $days) {
|
// Get Domains Expiring
|
||||||
// Get Domains Expiring
|
$sql_domains_expiring = mysqli_query(
|
||||||
$sql_domains_expiring = mysqli_query(
|
$mysqli,
|
||||||
$mysqli,
|
"SELECT * FROM domains
|
||||||
"SELECT * FROM domains
|
WHERE domain_client_id = $client_id
|
||||||
WHERE domain_client_id = $client_id
|
AND domain_expire IS NOT NULL
|
||||||
AND domain_expire IS NOT NULL
|
AND domain_archived_at IS NULL
|
||||||
AND domain_archived_at IS NULL
|
AND domain_expire > CURRENT_DATE
|
||||||
AND domain_expire > CURRENT_DATE
|
AND domain_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
AND domain_expire < CURRENT_DATE + INTERVAL $days DAY
|
ORDER BY domain_expire ASC
|
||||||
ORDER BY domain_expire ASC
|
LIMIT 5"
|
||||||
LIMIT 5"
|
);
|
||||||
);
|
|
||||||
|
|
||||||
// Get Certificates Expiring
|
// Get Certificates Expiring
|
||||||
$sql_certificates_expiring = mysqli_query(
|
$sql_certificates_expiring = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM certificates
|
"SELECT * FROM certificates
|
||||||
WHERE certificate_client_id = $client_id
|
WHERE certificate_client_id = $client_id
|
||||||
AND certificate_expire IS NOT NULL
|
AND certificate_expire IS NOT NULL
|
||||||
AND certificate_archived_at IS NULL
|
AND certificate_archived_at IS NULL
|
||||||
AND certificate_expire > CURRENT_DATE
|
AND certificate_expire > CURRENT_DATE
|
||||||
AND certificate_expire < CURRENT_DATE + INTERVAL $days DAY
|
AND certificate_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
ORDER BY certificate_expire ASC
|
ORDER BY certificate_expire ASC
|
||||||
LIMIT 5"
|
LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get Licenses Expiring
|
// Get Licenses Expiring
|
||||||
$sql_licenses_expiring = mysqli_query(
|
$sql_licenses_expiring = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM software
|
"SELECT * FROM software
|
||||||
WHERE software_client_id = $client_id
|
WHERE software_client_id = $client_id
|
||||||
AND software_expire IS NOT NULL
|
AND software_expire IS NOT NULL
|
||||||
AND software_archived_at IS NULL
|
AND software_archived_at IS NULL
|
||||||
AND software_expire > CURRENT_DATE
|
AND software_expire > CURRENT_DATE
|
||||||
AND software_expire < CURRENT_DATE + INTERVAL $days DAY
|
AND software_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
ORDER BY software_expire ASC
|
ORDER BY software_expire ASC
|
||||||
LIMIT 5"
|
LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get Asset Warranties Expiring
|
// Get Asset Warranties Expiring
|
||||||
$sql_asset_warranties_expiring = mysqli_query(
|
$sql_asset_warranties_expiring = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM assets
|
"SELECT * FROM assets
|
||||||
WHERE asset_client_id = $client_id
|
WHERE asset_client_id = $client_id
|
||||||
AND asset_warranty_expire IS NOT NULL
|
AND asset_warranty_expire IS NOT NULL
|
||||||
AND asset_archived_at IS NULL
|
AND asset_archived_at IS NULL
|
||||||
AND asset_warranty_expire > CURRENT_DATE
|
AND asset_warranty_expire > CURRENT_DATE
|
||||||
AND asset_warranty_expire < CURRENT_DATE + INTERVAL $days DAY
|
AND asset_warranty_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
ORDER BY asset_warranty_expire ASC
|
ORDER BY asset_warranty_expire ASC
|
||||||
LIMIT 5"
|
LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get Assets Retiring 7 Year
|
// Get Assets Retiring 7 Year
|
||||||
$sql_asset_retire = mysqli_query(
|
$sql_asset_retire = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM assets
|
"SELECT * FROM assets
|
||||||
WHERE asset_client_id = $client_id
|
WHERE asset_client_id = $client_id
|
||||||
AND asset_install_date IS NOT NULL
|
AND asset_install_date IS NOT NULL
|
||||||
AND asset_archived_at IS NULL
|
AND asset_archived_at IS NULL
|
||||||
AND asset_install_date + INTERVAL 7 YEAR > CURRENT_DATE
|
AND asset_install_date + INTERVAL 7 YEAR > CURRENT_DATE
|
||||||
AND asset_install_date + INTERVAL 7 YEAR <= CURRENT_DATE + INTERVAL $days DAY
|
AND asset_install_date + INTERVAL 7 YEAR <= CURRENT_DATE + INTERVAL 45 DAY
|
||||||
ORDER BY asset_install_date ASC
|
ORDER BY asset_install_date ASC
|
||||||
LIMIT 5"
|
LIMIT 5"
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EXPIRED ITEMS
|
* EXPIRED ITEMS
|
||||||
@@ -354,7 +351,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<div class="card card-dark mb-3">
|
<div class="card card-dark mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h5 class="card-title"><i class="fa fa-fw fa-exclamation-triangle text-warning mr-2"></i>Upcoming Expirations</h5>
|
<h5 class="card-title"><i class="fa fa-fw fa-exclamation-triangle text-warning mr-2"></i>Expiring in the Next 45 Days</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-2">
|
<div class="card-body p-2">
|
||||||
|
|
||||||
|
|||||||
@@ -216,18 +216,18 @@ if (isset($_GET['client_id'])) {
|
|||||||
|
|
||||||
// Expiring Items
|
// Expiring Items
|
||||||
|
|
||||||
// Count Domains Expiring within 90 Days
|
// Count Domains Expiring within 45 Days
|
||||||
$row = mysqli_fetch_assoc(mysqli_query(
|
$row = mysqli_fetch_assoc(mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT COUNT('domain_id') AS num FROM domains
|
"SELECT COUNT('domain_id') AS num FROM domains
|
||||||
WHERE domain_client_id = $client_id
|
WHERE domain_client_id = $client_id
|
||||||
AND domain_expire IS NOT NULL
|
AND domain_expire IS NOT NULL
|
||||||
AND domain_expire < CURRENT_DATE + INTERVAL 90 DAY
|
AND domain_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
AND domain_archived_at IS NULL"
|
AND domain_archived_at IS NULL"
|
||||||
));
|
));
|
||||||
$num_domains_expiring = intval($row['num']);
|
$num_domains_expiring_warning= intval($row['num']);
|
||||||
|
|
||||||
// Count Domains Expired or within 14 days
|
// Count Domains Expired or within 7 days
|
||||||
$row = mysqli_fetch_assoc(mysqli_query(
|
$row = mysqli_fetch_assoc(mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT COUNT('domain_id') AS num FROM domains
|
"SELECT COUNT('domain_id') AS num FROM domains
|
||||||
@@ -235,24 +235,24 @@ if (isset($_GET['client_id'])) {
|
|||||||
AND domain_expire IS NOT NULL
|
AND domain_expire IS NOT NULL
|
||||||
AND (
|
AND (
|
||||||
domain_expire < CURRENT_DATE
|
domain_expire < CURRENT_DATE
|
||||||
OR domain_expire < CURRENT_DATE + INTERVAL 14 DAY
|
OR domain_expire < CURRENT_DATE + INTERVAL 7 DAY
|
||||||
)
|
)
|
||||||
AND domain_archived_at IS NULL"
|
AND domain_archived_at IS NULL"
|
||||||
));
|
));
|
||||||
$num_domains_expired = intval($row['num']);
|
$num_domains_urgent = intval($row['num']);
|
||||||
|
|
||||||
// Count Certificates Expiring within 90 Days
|
// Count Certificates Expiring within 45 Days
|
||||||
$row = mysqli_fetch_assoc(mysqli_query(
|
$row = mysqli_fetch_assoc(mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT COUNT('certificate_id') AS num FROM certificates
|
"SELECT COUNT('certificate_id') AS num FROM certificates
|
||||||
WHERE certificate_client_id = $client_id
|
WHERE certificate_client_id = $client_id
|
||||||
AND certificate_expire IS NOT NULL
|
AND certificate_expire IS NOT NULL
|
||||||
AND certificate_expire < CURRENT_DATE + INTERVAL 90 DAY
|
AND certificate_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
AND certificate_archived_at IS NULL"
|
AND certificate_archived_at IS NULL"
|
||||||
));
|
));
|
||||||
$num_certificates_expiring = intval($row['num']);
|
$num_certificates_expiring = intval($row['num']);
|
||||||
|
|
||||||
// Count Certificates Expired or within 14 days
|
// Count Certificates Expired or within 7 days
|
||||||
$row = mysqli_fetch_assoc(mysqli_query(
|
$row = mysqli_fetch_assoc(mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT COUNT('certificate_id') AS num FROM certificates
|
"SELECT COUNT('certificate_id') AS num FROM certificates
|
||||||
@@ -260,7 +260,7 @@ if (isset($_GET['client_id'])) {
|
|||||||
AND certificate_expire IS NOT NULL
|
AND certificate_expire IS NOT NULL
|
||||||
AND (
|
AND (
|
||||||
certificate_expire < CURRENT_DATE
|
certificate_expire < CURRENT_DATE
|
||||||
OR certificate_expire < CURRENT_DATE + INTERVAL 14 DAY
|
OR certificate_expire < CURRENT_DATE + INTERVAL 7 DAY
|
||||||
)
|
)
|
||||||
AND certificate_archived_at IS NULL"
|
AND certificate_archived_at IS NULL"
|
||||||
));
|
));
|
||||||
@@ -272,7 +272,7 @@ if (isset($_GET['client_id'])) {
|
|||||||
"SELECT COUNT('software_id') AS num FROM software
|
"SELECT COUNT('software_id') AS num FROM software
|
||||||
WHERE software_client_id = $client_id
|
WHERE software_client_id = $client_id
|
||||||
AND software_expire IS NOT NULL
|
AND software_expire IS NOT NULL
|
||||||
AND software_expire < CURRENT_DATE + INTERVAL 90 DAY
|
AND software_expire < CURRENT_DATE + INTERVAL 45 DAY
|
||||||
AND software_archived_at IS NULL"
|
AND software_archived_at IS NULL"
|
||||||
));
|
));
|
||||||
$num_software_expiring = intval($row['num']);
|
$num_software_expiring = intval($row['num']);
|
||||||
@@ -285,7 +285,7 @@ if (isset($_GET['client_id'])) {
|
|||||||
AND software_expire IS NOT NULL
|
AND software_expire IS NOT NULL
|
||||||
AND (
|
AND (
|
||||||
software_expire < CURRENT_DATE
|
software_expire < CURRENT_DATE
|
||||||
OR software_expire < CURRENT_DATE + INTERVAL 14 DAY
|
OR software_expire < CURRENT_DATE + INTERVAL 7 DAY
|
||||||
)
|
)
|
||||||
AND software_archived_at IS NULL"
|
AND software_archived_at IS NULL"
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -2338,7 +2338,7 @@ if (isset($_POST['edit_ticket_schedule'])) {
|
|||||||
'recipient' => $user_email,
|
'recipient' => $user_email,
|
||||||
'recipient_name' => $user_name,
|
'recipient_name' => $user_name,
|
||||||
'subject' => "Ticket Scheduled - [$ticket_prefix$ticket_number] - $ticket_subject",
|
'subject' => "Ticket Scheduled - [$ticket_prefix$ticket_number] - $ticket_subject",
|
||||||
'body' => "Hello, " . $user_name . "<br><br>The ticket regarding $ticket_subject has been scheduled for $email_datetime.<br><br>--------------------------------<br><a href=\"https://$config_base_url/ticket.php?id=$ticket_id\">$ticket_link</a><br>--------------------------------<br><br>Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email",
|
'body' => "Hello, " . $user_name . "<br><br>The ticket regarding $ticket_subject has been scheduled for $email_datetime.<br><br>--------------------------------<br><a href=\"https://$config_base_url/ticket.php?ticket_id=$ticket_id\">$ticket_link</a><br>--------------------------------<br><br>Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/ticket.php?ticket_id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email",
|
||||||
'cal_str' => $cal_str
|
'cal_str' => $cal_str
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -2491,7 +2491,7 @@ if (isset($_GET['cancel_ticket_schedule'])) {
|
|||||||
'recipient' => $user_email,
|
'recipient' => $user_email,
|
||||||
'recipient_name' => $user_name,
|
'recipient_name' => $user_name,
|
||||||
'subject' => "Ticket Schedule Cancelled - [$ticket_prefix$ticket_number] - $ticket_subject",
|
'subject' => "Ticket Schedule Cancelled - [$ticket_prefix$ticket_number] - $ticket_subject",
|
||||||
'body' => "Hello, " . $user_name . "<br><br>Scheduled work for the ticket regarding $ticket_subject has been cancelled.<br><br>--------------------------------<br><a href=\"https://$config_base_url/ticket.php?id=$ticket_id\">$ticket_link</a><br>--------------------------------<br><br>Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email",
|
'body' => "Hello, " . $user_name . "<br><br>Scheduled work for the ticket regarding $ticket_subject has been cancelled.<br><br>--------------------------------<br><a href=\"https://$config_base_url/ticket.php?ticket_id=$ticket_id\">$ticket_link</a><br>--------------------------------<br><br>Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email",
|
||||||
'cal_str' => $cal_str
|
'cal_str' => $cal_str
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user