1
0
Fork 0
forked from fnux/rt2zammad

[rt2zammad] update fs2zammad for Task#12785

This commit is contained in:
kjg 2024-10-21 14:34:58 +00:00
parent b5a6453acc
commit ed45622c04

View file

@ -104,15 +104,21 @@ def maybe_create_zammad_user(userdata, zammad_session, attr="login", default=Non
first = ""
kwargs["lastname"] = last
kwargs["firstname"] = first
#print("*kwargs",kwargs) #debug
try:
#print("*try") #debug
user = zammad_session.user.create(kwargs)
USERMAP[lowercase_email] = user
#print("*try USERMAP") #debug
except:
# The use probably exist already...
result = list(zammad.user.search(lowercase_email))
#print("*ecept")
result = list(zammad.user.search(f'"{lowercase_email}"'))
#print("*ecept result",result) #debug
if len(result) >= 1:
user = next(u for u in result if u['email'] == lowercase_email)
USERMAP[lowercase_email] = user
#print("*except USERMAP",USERMAP) #debug
else:
print(f"Could not create/fetch user {lowercase_email}")