Undo in Admin after archiving tags and categories (one or several), canned responses, ticket, project, document, vendor, license and contract templates, roles, payment methods with any default they were, SLAs, custom links, portal announcements and agent banners, and after archiving a tax or switching off a ticket status when nothing was moved; payment methods archive without asking first and the SLA archive message names the SLA

This commit is contained in:
johnnyq
2026-11-20 16:53:11 -05:00
parent 651a4d1306
commit 8d9d15d6f7
20 changed files with 133 additions and 8 deletions

View File

@@ -71,10 +71,15 @@ if (isset($_GET['archive_payment_method']) || isset($_GET['restore_payment_metho
$archive = isset($_GET['archive_payment_method']);
$row = paymentMethodRow($archive ? $_GET['archive_payment_method'] : $_GET['restore_payment_method']);
if ($row) {
$undo = $archive ? undoArchivedBefore('payment_methods', 'payment_method_id', [$row['payment_method_id']]) : null;
$defaults = $archive ? undoSnapshot('settings', 'company_id', [1], ['config_default_payment_method', 'config_default_expense_payment_method']) : null;
$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'));
if ($undo) {
undoOfferArchived($undo, '', $row['payment_method_name'], [$defaults]);
}
}
redirect();