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 a0e103c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 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,14 @@ 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"],
"subjectIdentificatie": {},
}
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 a0e103c

Please sign in to comment.