From ab0f3f843a41c098e1ff3b9c68882fbfca0408b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 30 Dec 2020 13:14:41 +0100 Subject: [PATCH] Fix creating owned tickets --- rt2zammad.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rt2zammad.py b/rt2zammad.py index 80d65b1..d202c20 100755 --- a/rt2zammad.py +++ b/rt2zammad.py @@ -194,14 +194,17 @@ def get_user(userdata, attr="login", default=None): # Create tickets for ticket in tickets: label = "RT-{}".format(ticket["ticket"]["original_id"]) - print("Importing {}".format(label)) + creator = get_user(users[ticket["ticket"]["Creator"]]) + print(f"Importing {label} ({creator})") + if ticket["ticket"]["original_id"] != ticket["ticket"]["numerical_id"]: # Merged ticket - get_zammad(get_user(users[ticket["ticket"]["Creator"]])).ticket.create( + get_zammad(creator).ticket.create( { "title": "{} [{}]".format(ticket["ticket"]["Subject"], label), "group": "Users", "state_id": 4, + "customer": creator, "note": "RT-import:{}".format(ticket["ticket"]["original_id"]), "article": { "subject": ticket["ticket"]["Subject"], @@ -212,11 +215,12 @@ for ticket in tickets: } ) continue - new = get_zammad(get_user(users[ticket["ticket"]["Creator"]])).ticket.create( + new = get_zammad(creator).ticket.create( { "title": "{} [{}]".format(ticket["ticket"]["Subject"], label), "group": "Users", "state_id": STATUSMAP[ticket["ticket"]["Status"]], + "customer": creator, "note": "RT-import:{}".format(ticket["ticket"]["original_id"]), "article": { "subject": ticket["ticket"]["Subject"],