diff --git a/zammad-duplicates-cleanup b/zammad-duplicates-cleanup index 6da9cd4..d34ed5f 100755 --- a/zammad-duplicates-cleanup +++ b/zammad-duplicates-cleanup @@ -60,7 +60,7 @@ def remove_duplicates_for(rt_id, zammad, retries=0): try: matching_zammad_tickets= zammad.ticket.search(f"title: \"\[RT-{rt_id}\]*\"") #matching_zammad_tickets= zammad.ticket.search('number:16014') - print(matching_zammad_tickets[0]) + #print(matching_zammad_tickets[0]) matching_zammad_ids = [] if len(matching_zammad_tickets) >= 2: print(f"Found duplicates:") @@ -96,6 +96,15 @@ if not os.path.exists("rt2zammad.json"): with open("rt2zammad.json") as handle: config = json.load(handle) +if len(sys.argv) != 3: + print(len(sys.argv)) + print("It needs ticket range to import ex. start, end") + sys.exit() +else: + import_start = int(sys.argv[1]) + import_end = int(sys.argv[2]) + print(f"start : {import_start} end : {import_end}") + h2t = html2text.HTML2Text() zammad = get_zammad_session() @@ -106,6 +115,7 @@ ticket_ids = os.listdir("tickets/") print(f"Found {len(ticket_ids)} tickets on filesystem.") ticket_ids = list(map(int, ticket_ids)) ticket_ids.sort() +ticket_ids = list(map(int, ticket_ids[import_start-1:import_end])) for id in ticket_ids: print(f"Processing RT-{id}...")