Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Kartra Bulk Helpdesk Ticket Remover (Use With Extreme Care!)
- // Select tickets to delete via filtering, then paste the function below
- // and "deleteAllTickets();" (without the quotes) into the console
- // (Command + Option + J (Mac) or Control + Shift + J (PC)).
- function deleteAllTickets () {
- const tickets = [];
- const deleteNext = () => {
- if (!tickets.length) {
- alert('All tickets deleted. Page will now reload.');
- location.reload();
- } else {
- const id = tickets.shift();
- console.log('Deleting ticket ' + id);
- $.ajax({ url: action_route + '/remove_ticket/' + id }).done(() => setTimeout(deleteNext, 500));
- }
- };
- $('.js_ticket_li').each((ind, el) => tickets.push(el.id.replace(/ticket_/, '')));
- if (tickets.length && confirm(`Permanently delete ${tickets.length} ticket(s)?`)) deleteNext();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement