Skip to content

Commit

Permalink
[#1437 #1457] Cleaned up some comments and todos
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Schoor committed Jun 9, 2023
1 parent b3ef4d9 commit 744dde6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/open_inwoner/openklant/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def clean(self, *args, **kwargs):
self.add_error("phonenumber", msg)

if self.user.is_authenticated:
# we need to use get_contact_email() because we use dummy email for BSN users
if not email and self.user.get_contact_email():
cleaned_data["email"] = self.user.get_contact_email()
if not phonenumber and self.user.phonenumber:
Expand Down
4 changes: 1 addition & 3 deletions src/open_inwoner/openklant/views/contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def get_initial(self):
"first_name": self.request.user.first_name,
"infix": self.request.user.infix,
"last_name": self.request.user.last_name,
# we need to use get_contact_email() because we use dummy email for BSN users
"email": self.request.user.get_contact_email(),
"phonenumber": self.request.user.phonenumber,
}
Expand Down Expand Up @@ -113,7 +114,6 @@ def register_by_api(self, form, config: OpenKlantConfig):
if not klant.telefoonnummer and form.cleaned_data["phonenumber"]:
update_data["telefoonnummer"] = form.cleaned_data["phonenumber"]
if update_data:
# TODO add audit log
patch_klant(klant, update_data)
self.log_system_action(
f"patched klant from user with missing fields: {', '.join(sorted(update_data.keys()))}"
Expand Down Expand Up @@ -146,8 +146,6 @@ def register_by_api(self, form, config: OpenKlantConfig):
text = f"{subject}\n\n{question}"

if not klant:
# TODO add audit log to note we didn't have a Klant and appended the info to the message

# if we don't have a BSN and can't create a Klant we'll add contact info to the tekst
parts = [form.cleaned_data[k] for k in ("first_name", "infix", "last_name")]
full_name = " ".join(p for p in parts if p)
Expand Down

0 comments on commit 744dde6

Please sign in to comment.