Admin messages use the same colours as the rest of ITFlow - red after archiving, removing, unlinking or cancelling something and green after restoring it or Undo - covering tags, categories, custom links, payment methods, roles, SLAs, ticket statuses, starter content, offices, closure days, backups, app logs, RMM clients, invites, queued emails and texts, and the company logo

This commit is contained in:
johnnyq
2026-11-20 17:59:26 -05:00
parent 478c8edcc8
commit c1bdc99c14
17 changed files with 21 additions and 21 deletions

View File

@@ -69,7 +69,7 @@ if (isset($_POST['clear_app_logs'])) {
if ($cleared > 0) {
$what = lcfirst(appLogFiltersText($summary));
logAudit("App Log", "Delete", "$session_name cleared $cleared app log " . ($cleared === 1 ? 'entry' : 'entries') . ($all ? ' - all of them' : ' - ' . escapeSql($what)));
flashAlert("Cleared $cleared app log " . ($cleared === 1 ? 'entry' : 'entries'));
flashAlert("Cleared $cleared app log " . ($cleared === 1 ? 'entry' : 'entries'), 'error');
} else {
flashAlert('There was nothing to clear.', 'error');
}

View File

@@ -52,10 +52,10 @@ if (isset($_GET['delete_backup'])) {
// One still waiting has no file yet - taking it off the queue is all there is to it
if ($row['backup_status'] === 'Pending') {
logAudit("Backup", "Delete", ($session_name ?? 'Unknown User') . " took a queued " . backupTypeLabel($row['backup_type']) . " off the queue");
flashAlert(backupTypeLabel($row['backup_type']) . " taken off the queue.");
flashAlert(backupTypeLabel($row['backup_type']) . " taken off the queue.", 'error');
} else {
logAudit("Backup", "Delete", ($session_name ?? 'Unknown User') . " deleted backup " . escapeSql($row['backup_file_name']));
flashAlert($row['backup_status'] === 'Complete' ? "Backup deleted." : "Backup removed from the list.");
flashAlert($row['backup_status'] === 'Complete' ? "Backup deleted." : "Backup removed from the list.", 'error');
}
} else {
flashAlert("Backup not found.", 'error');

View File

@@ -98,7 +98,7 @@ if (isset($_GET['archive_category'])) {
$used = categoryUsageFor($row['category_id']);
logAudit("Category", "Archive", "$session_name archived " . $category_kind_word($row) . " " . escapeSql($row['category_name']), 0, intval($row['category_id']));
flashAlert(ucfirst($category_kind_word($row)) . " <strong>" . escapeHtml($row['category_name']) . "</strong> archived - "
. ($used['all'] ? "it stays on the " . escapeHtml(categoryUsageText($row, $used)) . " that have it, but isn't offered for new ones" : "it isn't offered for new ones"));
. ($used['all'] ? "it stays on the " . escapeHtml(categoryUsageText($row, $used)) . " that have it, but isn't offered for new ones" : "it isn't offered for new ones"), 'error');
undoOfferArchived($undo, 'categor', $row['category_name'], [], 'y|ies');
}
@@ -262,7 +262,7 @@ if (isset($_POST['bulk_archive_categories']) || isset($_POST['bulk_restore_categ
$count++;
}
flashAlert(($archive ? "Archived " : "Restored ") . $count . ($count === 1 ? " category" : " categories") . ($archive && $count ? " - they stay on their records, but aren't offered for new ones" : ''));
flashAlert(($archive ? "Archived " : "Restored ") . $count . ($count === 1 ? " category" : " categories") . ($archive && $count ? " - they stay on their records, but aren't offered for new ones" : ''), $archive ? 'error' : 'success');
if ($undo) {
undoOfferArchived($undo, 'categor', '', [], 'y|ies');
}

View File

@@ -76,7 +76,7 @@ if (isset($_GET['archive_custom_link']) || isset($_GET['restore_custom_link']))
mysqli_query($mysqli, "UPDATE custom_links SET custom_link_archived_at = NULL, custom_link_order = " . customLinkNextOrder($row['custom_link_location']) . " WHERE custom_link_id = $custom_link_id");
}
logAudit("Custom Link", $archive ? "Archive" : "Restore", "$session_name " . ($archive ? 'archived' : 'restored') . " custom link " . escapeSql($row['custom_link_name']), 0, $custom_link_id);
flashAlert("Link <strong>" . escapeHtml($row['custom_link_name']) . "</strong> " . ($archive ? 'archived - it no longer shows in its menu' : 'restored'));
flashAlert("Link <strong>" . escapeHtml($row['custom_link_name']) . "</strong> " . ($archive ? 'archived - it no longer shows in its menu' : 'restored'), $archive ? 'error' : 'success');
if ($undo) {
undoOfferArchived($undo, '', $row['custom_link_name']);
}

View File

@@ -54,7 +54,7 @@ foreach ($mail_queue_actions as $mail_queue_action => [$one_key, $bulk_key, $don
};
if ($count === $asked) {
$note = $done_note[$count === 1 ? 0 : 1];
flashAlert(ucfirst($done_word) . " <strong>$count</strong> " . $email_word($count) . ($note !== '' ? " - $note" : ''), $mail_queue_action === 'delete' ? 'error' : 'success');
flashAlert(ucfirst($done_word) . " <strong>$count</strong> " . $email_word($count) . ($note !== '' ? " - $note" : ''), $mail_queue_action === 'retry' ? 'success' : 'error');
} elseif ($count) {
flashAlert(ucfirst($done_word) . " <strong>$count</strong> of $asked " . $email_word($asked) . ". $why_not", 'warning');
} else {

View File

@@ -39,7 +39,7 @@ if (isset($_GET['remove_office'])) {
}
logAudit("Settings", "Delete", "$session_name removed the office " . escapeSql($name));
flashAlert("Removed the office <strong>" . escapeHtml($name) . "</strong> - those who worked there are in the main office now");
flashAlert("Removed the office <strong>" . escapeHtml($name) . "</strong> - those who worked there are in the main office now", 'error');
redirect('settings_company.php#section-offices');
}

View File

@@ -76,7 +76,7 @@ if (isset($_GET['archive_payment_method']) || isset($_GET['restore_payment_metho
$cleared = paymentMethodSetArchived($row, $archive);
$no_longer = $cleared ? ' - no longer the default for ' . implode(' or ', array_map(function ($way) { return $way === 'in' ? 'payments' : 'expenses'; }, $cleared)) : '';
logAudit("Payment Method", $archive ? "Archive" : "Restore", "$session_name " . ($archive ? 'archived' : 'restored') . " payment method " . escapeSql($row['payment_method_name']) . $no_longer, 0, intval($row['payment_method_id']));
flashAlert("Payment method <strong>" . escapeHtml($row['payment_method_name']) . "</strong> " . ($archive ? "archived - it isn't offered any more$no_longer" : 'restored'));
flashAlert("Payment method <strong>" . escapeHtml($row['payment_method_name']) . "</strong> " . ($archive ? "archived - it isn't offered any more$no_longer" : 'restored'), $archive ? 'error' : 'success');
if ($undo) {
undoOfferArchived($undo, '', $row['payment_method_name'], [$defaults]);
}

View File

@@ -261,7 +261,7 @@ if (isset($_GET['unlink_rmm_client'])) {
$rmm_client_id = intval($rmm_client['rmm_client_id']);
mysqli_query($mysqli, "UPDATE rmm_clients SET rmm_client_client_id = 0, rmm_client_synced_at = NULL WHERE rmm_client_id = $rmm_client_id");
logAudit("RMM Provider", "Unlink", "$session_name unlinked " . escapeSql(rmmProviderName($rmm_client) . " client {$rmm_client['rmm_client_name']} from " . $rmm_client['client_name']), intval($rmm_client['rmm_client_client_id']), intval($rmm_client['rmm_client_provider_id']));
flashAlert('<strong>' . escapeHtml($rmm_client['rmm_client_name']) . '</strong> unlinked - its devices no longer come in. Their assets stay.');
flashAlert('<strong>' . escapeHtml($rmm_client['rmm_client_name']) . '</strong> unlinked - its devices no longer come in. Their assets stay.', 'error');
redirect('rmm_clients.php?provider_id=' . intval($rmm_client['rmm_client_provider_id']));
}

View File

@@ -83,7 +83,7 @@ if (isset($_GET['archive_role'])) {
logAudit("User Role", "Archive", "$session_name archived role " . escapeSql($row['role_name']), 0, $row['role_id']);
flashAlert("Role <strong>" . escapeHtml($row['role_name']) . "</strong> archived");
flashAlert("Role <strong>" . escapeHtml($row['role_name']) . "</strong> archived", 'error');
undoOfferArchived($undo, '', $row['role_name']);
redirect();

View File

@@ -89,7 +89,7 @@ if (isset($_GET['remove_company_logo'])) {
logAudit("Settings", "Edit", "$session_name took the company logo off");
flashAlert("The logo is taken off");
flashAlert("The logo is taken off", 'error');
redirect();

View File

@@ -96,7 +96,7 @@ if (isset($_GET['archive_sla'])) {
logAudit("SLA", "Archive", "$session_name archived SLA ID $sla_id");
flashAlert($sla_name !== '' ? "SLA <strong>" . escapeHtml($sla_name) . "</strong> archived" : "SLA archived");
flashAlert($sla_name !== '' ? "SLA <strong>" . escapeHtml($sla_name) . "</strong> archived" : "SLA archived", 'error');
undoOfferArchived($undo, 'SLA', $sla_name);
redirect();
@@ -232,7 +232,7 @@ if (isset($_POST['delete_holiday'])) {
logAudit("Settings", "Delete", "$session_name removed SLA closure day $holiday_date - $holiday_name");
flashAlert("Closure day removed" . ($restamped ? " - targets worked out again on " . $sla_open_tickets_text($restamped) : ''));
flashAlert("Closure day removed" . ($restamped ? " - targets worked out again on " . $sla_open_tickets_text($restamped) : ''), 'error');
redirect();

View File

@@ -90,7 +90,7 @@ if (isset($_POST['clear_starter_unused'])) {
if ($count) {
logAudit("Starter Content", "Archive", "$session_name archived $count unused from the starter $label pack");
flashAlert("Archived <strong>$count</strong> unused from " . escapeHtml($label));
flashAlert("Archived <strong>$count</strong> unused from " . escapeHtml($label), 'error');
undoOfferChanges($before, "<strong>{n}</strong> from " . escapeHtml($label) . " put back", 'module_client');
} else {
flashAlert("Nothing to archive - those are in use now, or already archived", 'info');

View File

@@ -82,7 +82,7 @@ if (isset($_GET['archive_tag'])) {
$used = tagUsage($row['tag_id']);
logAudit("Tag", "Archive", "$session_name archived " . $tag_kind_word($row) . " tag " . escapeSql($row['tag_name']), 0, intval($row['tag_id']));
flashAlert("Tag <strong>" . escapeHtml($row['tag_name']) . "</strong> archived - "
. ($used ? "it stays on its " . $tag_records_text($used, $row['tag_type']) . ", but isn't offered for tagging" : "it isn't offered for tagging"));
. ($used ? "it stays on its " . $tag_records_text($used, $row['tag_type']) . ", but isn't offered for tagging" : "it isn't offered for tagging"), 'error');
undoOfferArchived($undo, 'tag', $row['tag_name']);
}
@@ -189,7 +189,7 @@ if (isset($_POST['bulk_archive_tags']) || isset($_POST['bulk_restore_tags'])) {
$count++;
}
flashAlert(($archive ? "Archived " : "Restored ") . $count . ($count === 1 ? " tag" : " tags") . ($archive && $count ? " - they stay on their records, but aren't offered for tagging" : ''));
flashAlert(($archive ? "Archived " : "Restored ") . $count . ($count === 1 ? " tag" : " tags") . ($archive && $count ? " - they stay on their records, but aren't offered for tagging" : ''), $archive ? 'error' : 'success');
if ($undo) {
undoOfferArchived($undo, 'tag');
}

View File

@@ -39,7 +39,7 @@ foreach (['retry' => 'retry_text', 'cancel' => 'cancel_text', 'delete' => 'delet
redirect();
}
logAudit("Text Message", ['retry' => 'Edit', 'cancel' => 'Edit', 'delete' => 'Delete'][$action], "$session_name " . ['retry' => 'retried', 'cancel' => 'cancelled', 'delete' => 'deleted'][$action] . " text " . intval($_GET[$key]));
flashAlert(['retry' => 'Text queued again - it goes at the next run of the Text Messages job', 'cancel' => 'Text cancelled - it won\'t be sent', 'delete' => 'Text deleted'][$action], $action === 'delete' ? 'error' : 'success');
flashAlert(['retry' => 'Text queued again - it goes at the next run of the Text Messages job', 'cancel' => 'Text cancelled - it won\'t be sent', 'delete' => 'Text deleted'][$action], $action === 'retry' ? 'success' : 'error');
redirect();
}
}

View File

@@ -132,7 +132,7 @@ if (isset($_POST['switch_off_ticket_status'])) {
$to_name = $moved ? ticketStatusesAll()[$move_to]['ticket_status_name'] : '';
logAudit("Ticket Status", "Edit", "$session_name switched off ticket status " . escapeSql($name) . ($moved ? ", moving $moved tickets to " . escapeSql($to_name) : ''), 0, intval($row['ticket_status_id']));
flashAlert("Status <strong>" . escapeHtml($name) . "</strong> switched off" . ($moved ? " - $moved " . ($moved === 1 ? 'ticket' : 'tickets') . " moved to <strong>" . escapeHtml($to_name) . "</strong>" : ''));
flashAlert("Status <strong>" . escapeHtml($name) . "</strong> switched off" . ($moved ? " - $moved " . ($moved === 1 ? 'ticket' : 'tickets') . " moved to <strong>" . escapeHtml($to_name) . "</strong>" : ''), 'error');
// Tickets moved to another status stay there - with none moved, Undo switches it back on
if (!$moved) {
undoOfferChanges($undo, '<strong>' . escapeHtml($name) . '</strong> is switched on again', 'admin', 3);

View File

@@ -215,7 +215,7 @@ if (isset($_GET['resend_user_invite']) || isset($_GET['link_user_invite']) || is
if ($what === 'cancel') {
userInviteCancel($invite_id);
logAudit("User", "Cancel", "$session_name cancelled the invite to $who");
flashAlert("Cancelled the invite to <strong>" . escapeHtml($invite['invite_email']) . "</strong> - its link no longer works");
flashAlert("Cancelled the invite to <strong>" . escapeHtml($invite['invite_email']) . "</strong> - its link no longer works", 'error');
redirect();
}