mirror of
https://github.com/itflow-org/itflow
synced 2026-11-22 04:17:24 +00:00
Undo: the message after archiving, a move or a bulk change has Undo, which puts it back as it was unless it changed since, and archiving no longer asks first except for clients; covers archiving every kind on Archived with contact roles, document links and a client's recurring invoices, file, document, folder and rack moves, and the bulk changes that set a field on tickets, assets, contacts, clients, projects, invoices, products and IP addresses
This commit is contained in:
@@ -213,11 +213,13 @@ if (isset($_GET['archive_location'])) {
|
||||
redirect();
|
||||
}
|
||||
|
||||
$undo = undoArchiveBefore('location', $location_id); // for Undo on the message
|
||||
mysqli_query($mysqli, "UPDATE locations SET location_archived_at = NOW() WHERE location_id = $location_id");
|
||||
|
||||
logAudit("Location", "Archive", "$session_name archived location " . escapeSql($row['location_name']), $client_id, $location_id);
|
||||
|
||||
flashAlert("Location <strong>{$row['location_name']}</strong> archived", 'error');
|
||||
undoOfferArchive($undo);
|
||||
|
||||
redirect();
|
||||
|
||||
@@ -275,6 +277,7 @@ if (isset($_POST['bulk_archive_locations'])) {
|
||||
|
||||
enforceUserPermission('module_client', 2);
|
||||
|
||||
$undo = undoArchiveBefore('location', $_POST['location_ids'] ?? []); // for Undo on the message
|
||||
$count = 0;
|
||||
$skipped = [];
|
||||
foreach (array_unique(array_map('intval', (array) ($_POST['location_ids'] ?? []))) as $location_id) {
|
||||
@@ -294,6 +297,7 @@ if (isset($_POST['bulk_archive_locations'])) {
|
||||
}
|
||||
|
||||
flashAlert("Archived <strong>$count</strong> location" . ($count === 1 ? '' : 's') . ($skipped ? ' - kept <strong>' . implode(', ', $skipped) . '</strong>, the primary location' : ''), 'error');
|
||||
undoOfferArchive($undo);
|
||||
|
||||
redirect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user