Skip to content

Commit

Permalink
Merge pull request #1104 from maykinmedia/fix/2219-esuite-vragen-bsn
Browse files Browse the repository at this point in the history
[#2219] Fix e-suite compatibility with open klant
  • Loading branch information
alextreme authored Mar 20, 2024
2 parents 5d843ef + 863ba39 commit ca2fca6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
17 changes: 17 additions & 0 deletions src/open_inwoner/openklant/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@
from .models import ContactFormSubject, KlantContactMomentAnswer, OpenKlantConfig


class ContactFormSubjectForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["subject_code"].widget.attrs["placeholder"] = _(
"Must be configured if E-suite is used"
)

class Meta:
model = ContactFormSubject
fields = (
"subject",
"subject_code",
)


class ContactFormSubjectInlineAdmin(OrderedTabularInline):
model = ContactFormSubject
form = ContactFormSubjectForm
fields = ("subject", "subject_code", "order", "move_up_down_links")
readonly_fields = ("order", "move_up_down_links")
ordering = ("order",)
Expand Down Expand Up @@ -55,6 +71,7 @@ class OpenKlantConfigAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin):
"register_contact_moment",
"register_bronorganisatie_rsin",
"register_type",
"register_channel",
"register_employee_id",
"use_rsin_for_innNnpId_query_parameter",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.10 on 2024-03-20 15:00

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("openklant", "0009_klantcontactmomentanswer"),
]

operations = [
migrations.AddField(
model_name="openklantconfig",
name="register_channel",
field=models.CharField(
blank=True,
default="contactformulier",
help_text="The channel through which contactmomenten are created",
max_length=50,
verbose_name="Contactmoment kanaal",
),
),
]
7 changes: 7 additions & 0 deletions src/open_inwoner/openklant/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class OpenKlantConfig(SingletonModel):
default="",
blank=True,
)
register_channel = models.CharField(
verbose_name=_("Contactmoment kanaal"),
max_length=50,
default="contactformulier",
blank=True,
help_text=_("The channel through which contactmomenten are created"),
)
register_type = models.CharField(
verbose_name=_("Contactmoment type"),
max_length=50,
Expand Down
13 changes: 7 additions & 6 deletions src/open_inwoner/openklant/tests/test_contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def test_submit_and_register_anon_via_api_with_klant(self, m):
"bronorganisatie": "123456789",
"tekst": "Onderwerp: Aanvraag document\n\nhey!\n\nwaddup?",
"type": "Melding",
"kanaal": "Internet",
"kanaal": "contactformulier",
"onderwerp": "afdeling-xyz",
},
)
Expand All @@ -294,6 +294,7 @@ def test_submit_and_register_anon_via_api_without_klant(self, m):
config.register_contact_moment = True
config.register_bronorganisatie_rsin = "123456789"
config.register_type = "Melding"
config.register_channel = "contactformulier"
config.register_employee_id = "FooVonBar"
config.save()

Expand Down Expand Up @@ -351,7 +352,7 @@ def test_submit_and_register_anon_via_api_without_klant(self, m):
"bronorganisatie": "123456789",
"tekst": text,
"type": "Melding",
"kanaal": "Internet",
"kanaal": "contactformulier",
"onderwerp": "afdeling-xyz",
},
)
Expand Down Expand Up @@ -416,7 +417,7 @@ def test_submit_and_register_bsn_user_via_api(self, m):
"bronorganisatie": "123456789",
"tekst": "Onderwerp: Aanvraag document\n\nhey!\n\nwaddup?",
"type": "Melding",
"kanaal": "Internet",
"kanaal": "contactformulier",
"onderwerp": "afdeling-xyz",
},
)
Expand Down Expand Up @@ -506,7 +507,7 @@ def test_submit_and_register_kvk_or_rsin_user_via_api(self, _m):
"bronorganisatie": "123456789",
"tekst": "Onderwerp: Aanvraag document\n\nhey!\n\nwaddup?",
"type": "Melding",
"kanaal": "Internet",
"kanaal": "contactformulier",
"onderwerp": "afdeling-xyz",
},
)
Expand Down Expand Up @@ -582,7 +583,7 @@ def test_submit_and_register_bsn_user_via_api_and_update_klant(self, m):
"bronorganisatie": "123456789",
"tekst": "Onderwerp: Aanvraag document\n\nhey!\n\nwaddup?",
"type": "Melding",
"kanaal": "Internet",
"kanaal": "contactformulier",
"onderwerp": "afdeling-xyz",
},
)
Expand Down Expand Up @@ -678,7 +679,7 @@ def test_submit_and_register_kvk_or_rsin_user_via_api_and_update_klant(self, _m)
"bronorganisatie": "123456789",
"tekst": "Onderwerp: Aanvraag document\n\nhey!\n\nwaddup?",
"type": "Melding",
"kanaal": "Internet",
"kanaal": "contactformulier",
"onderwerp": "afdeling-xyz",
},
)
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/openklant/views/contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def register_by_api(self, form, config: OpenKlantConfig):
"bronorganisatie": config.register_bronorganisatie_rsin,
"tekst": text,
"type": config.register_type,
"kanaal": "Internet",
"kanaal": config.register_channel,
"onderwerp": subject_code or subject,
"medewerkerIdentificatie": {
"identificatie": config.register_employee_id,
Expand Down

0 comments on commit ca2fca6

Please sign in to comment.