Added form_category to the ticket payload if existing

This resolves #203.
This commit is contained in:
Psycho 2026-05-05 23:11:28 +02:00
parent 16b3366cb0
commit 175bb24653

View file

@ -345,12 +345,8 @@ try:
assert isinstance(customer_id, (str, int))
# Add the actual ticket to the system.
response = session.post(
urljoin(ZAMMAD_URL, "api/v1/tickets"),
headers={
"From": contact_email,
},
json=dict(
ticket_payload=dict(
title=f"Kontaktformular {contact_name} {form_name}",
group=form_group,
customer_id=customer_id,
@ -366,7 +362,16 @@ try:
"mime-type": mimetypes.guess_type(attachment[0])[0] or "text/plain",
}],
),
),
)
if form_category:
ticket_payload["category"] = form_category
response = session.post(
urljoin(ZAMMAD_URL, "api/v1/tickets"),
headers={
"From": contact_email,
},
json=ticket_payload,
)
response.raise_for_status()
ticket_id = response.json()["id"]