Skip to content

Commit

Permalink
👌 [#3215] PR Feedback 1
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Jul 11, 2023
1 parent e07b4bf commit 466e840
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/manual/forms/form_fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ Prefill
-------

* **Plugin**: Welke prefill plugin te gebruiken om data op te halen over de persoon/het bedrijf die ingelogd is.
* **Pluginattribuut**: Welke attribuut van de prefill-backend data te gebruiken om deze component te prefillen.
* **Identifier rol**: In het geval dat de gebruiker met DigiD Machtigen en eHerkenning Bewindvoering heeft ingelogd, moeten de gegevens gerelateerd aan het 'hoofd identifier' worden gebruikt, of die gerelateerd aan de gemachtigde persoon?
* **Pluginattribuut**: Welk attribuut van de prefill-backend data te gebruiken om deze component voorin te vullen.
* **Identifier rol**: In het geval dat de gebruiker met DigiD Machtigen of eHerkenning Bewindvoering heeft ingelogd: van welke rol moeten de gegevens gebruikt worden, die van de 'hoofd identifier' worden gebruikt, of die van de gemachtigde persoon?


Globale configuratieopties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def add_claims_to_sessions_if_not_cosigning(self, claim, request):
if not claim or CO_SIGN_PARAMETER in request.GET:
return

config = OpenIDConnectDigiDMachtigenConfig.get_solo()
config = self.config_class.get_solo()
machtigen_data = request.session[DIGID_MACHTIGEN_OIDC_AUTH_SESSION_KEY]
request.session[FORM_AUTH_SESSION_KEY] = {
"plugin": self.identifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Select from 'components/admin/forms/Select';
import {ChangelistTableWrapper, HeadColumn} from 'components/admin/tables';
import {get} from 'utils/fetch';

import {DATATYPES_CHOICES, IDENTIFIER_ROLE_CHOICES} from './constants';
import {DATATYPES_CHOICES, IDENTIFIER_ROLE_CHOICES, IDENTIFIER_ROLE_LABELS} from './constants';
import Variable from './types';
import {variableHasErrors} from './utils';

Expand Down Expand Up @@ -89,7 +89,9 @@ const VariableRow = ({index, variable}) => {
<td>{getFormDefinitionName(variable.formDefinition)}</td>
<td>{variable.prefillPlugin}</td>
<td>{variable.prefillAttribute}</td>
<td>{variable.prefillIdentifierRole || 'main'}</td>
<td>
{IDENTIFIER_ROLE_LABELS[variable.prefillIdentifierRole] || IDENTIFIER_ROLE_LABELS.main}
</td>
<td>{variable.dataType}</td>
<td>
<SensitiveData isSensitive={variable.isSensitiveData} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {defineMessage} from 'react-intl';
import React from 'react';
import {FormattedMessage, defineMessage} from 'react-intl';

const COMPONENT_DATATYPES = {
date: 'date',
Expand Down Expand Up @@ -115,10 +116,23 @@ const IDENTIFIER_ROLE_CHOICES = [
],
];

const IDENTIFIER_ROLE_LABELS = {
main: (
<FormattedMessage defaultMessage="Main" description="Choices (main/authorised person) label" />
),
authorised_person: (
<FormattedMessage
defaultMessage="Authorised person"
description="Choices (main/authorised person) label"
/>
),
};

export {
COMPONENT_DATATYPES,
VARIABLE_SOURCES,
DATATYPES_CHOICES,
EMPTY_VARIABLE,
IDENTIFIER_ROLE_CHOICES,
IDENTIFIER_ROLE_LABELS,
};
5 changes: 1 addition & 4 deletions src/openforms/prefill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,7 @@ def prefill_variables(submission: "Submission", register=None) -> None:
attribute_name = variable.form_variable.prefill_attribute
identifier_role = variable.form_variable.prefill_identifier_role

if not grouped_fields[plugin_id].get(identifier_role):
grouped_fields[plugin_id][identifier_role] = []

grouped_fields[plugin_id][identifier_role].append(attribute_name)
grouped_fields[plugin_id].setdefault(identifier_role, []).append(attribute_name)

results = _fetch_prefill_values(grouped_fields, submission, register)

Expand Down
4 changes: 2 additions & 2 deletions src/openforms/prefill/tests/test_prefill_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PrefillHookTests(TransactionTestCase):
"openforms.prefill.contrib.haalcentraal.plugin.HaalCentraalPrefill.get_prefill_values",
return_value={"naam.voornamen": "John", "naam.geslachtsnaam": "Dodo"},
)
def test_fetch_values_with_multiple_bsn(self, m_bsn):
def test_fetch_values_with_multiple_people(self, m_haal_centraal):
components = [
{
"key": "mainPersonName",
Expand Down Expand Up @@ -165,7 +165,7 @@ def test_fetch_values_with_multiple_bsn(self, m_bsn):
"openforms.prefill.contrib.kvk.plugin.KVK_KVKNumberPrefill.get_prefill_values",
return_value={"bezoekadres.postcode": "1111 AA"},
)
def test_fetch_values_with_kvk_and_bsn(self, m_kvk, m_bsn):
def test_fetch_values_with_legal_entity_and_person(self, m_kvk, m_haal_centraal):
components = [
{
"key": "companyPostcode",
Expand Down

0 comments on commit 466e840

Please sign in to comment.