Skip to content

Commit

Permalink
[#2811] Exclude empty email/phone number from being sent with contact…
Browse files Browse the repository at this point in the history
…form
  • Loading branch information
pi-sigma committed Oct 21, 2024
1 parent 16de4dc commit 19d556c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/open_inwoner/openklant/views/contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ def register_by_api(self, form, config: OpenKlantConfig) -> tuple[bool, str]:
"voornaam": form.cleaned_data["first_name"],
"voorvoegselAchternaam": form.cleaned_data["infix"],
"achternaam": form.cleaned_data["last_name"],
"emailadres": form.cleaned_data["email"],
"telefoonnummer": form.cleaned_data["phonenumber"],
}
if form.cleaned_data["email"]:
data["emailadres"] = form.cleaned_data["email"]

if form.cleaned_data["phonenumber"]:
data["telefoonnummer"] = form.cleaned_data["phonenumber"]

klant = klanten_client.create_klant(data=data)

if klant:
Expand Down

0 comments on commit 19d556c

Please sign in to comment.