Skip to content

Commit

Permalink
added address validations on export & deactivated allegro check on do…
Browse files Browse the repository at this point in the history
…ssier creation
  • Loading branch information
qr committed Aug 18, 2020
1 parent 09a195c commit 2fbbd6c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/Controller/AppDossierController.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ public function createAction(Request $request, EntityManagerInterface $em, Event
$em->persist($dossier);
$em->flush();

if (!$form['allegroCheck']->getData()) {
$allegroCheck = isset($form['allegroCheck']) ? $form['allegroCheck']->getData() : false;

if (!$allegroCheck) {
$this->addFlash('success', 'Dossier aangemaakt');
} else {
if (null !== $allegroService->getSRVAanvraagHeader($dossier->getSchuldhulpbureau(), $dossier->getAllegroNummer())) {
Expand Down
21 changes: 21 additions & 0 deletions src/Exception/AllegroServiceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class AllegroServiceException extends \Exception
const TYPE_MISSING_CLIENT_BSN = 'MISSING_CLIENT_BSN';
const TYPE_MISSING_CLIENT_INITIALS = 'MISSING_CLIENT_INITIALS';

const TYPE_MISSING_CLIENT_STREET = 'MISSING_CLIENT_STREET';
const TYPE_MISSING_CLIENT_HOUSENUMBER = 'MISSING_CLIENT_HOUSENUMBER';
const TYPE_MISSING_CLIENT_POSTALCODE = 'MISSING_CLIENT_POSTALCODE';
const TYPE_MISSING_CLIENT_RESIDENCE = 'MISSING_CLIENT_RESIDENCE';

const TYPE_MISSING_PARTNER_BIRTHDATE = 'MISSING_PARTNER_BIRTHDATE';
const TYPE_MISSING_PARTNER_GENDER = 'MISSING_PARTNER_GENDER';
const TYPE_MISSING_PARTNER_BSN = 'MISSING_PARTNER_BSN';
Expand All @@ -30,6 +35,22 @@ public static function missingClientInitials(): AllegroServiceException {
return new self(self::TYPE_MISSING_CLIENT_INITIALS);
}

public static function missingClientStreet(): AllegroServiceException {
return new self(self::TYPE_MISSING_CLIENT_STREET);
}

public static function missingClientHousenumber(): AllegroServiceException {
return new self(self::TYPE_MISSING_CLIENT_HOUSENUMBER);
}

public static function missingClientPostalcode(): AllegroServiceException {
return new self(self::TYPE_MISSING_CLIENT_POSTALCODE);
}

public static function missingClientResidence(): AllegroServiceException {
return new self(self::TYPE_MISSING_CLIENT_RESIDENCE);
}

public static function missingPartnerBirthdate(): AllegroServiceException {
return new self(self::TYPE_MISSING_PARTNER_BIRTHDATE);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Form/Type/CreateDossierFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'GKA dossiernr.'
]);

$builder->add('allegroCheck', CheckboxType::class, [
'label' => 'Aanwezigheid in Allegro controleren',
'required' => false,
'mapped' => false
]);
// $builder->add('allegroCheck', CheckboxType::class, [
// 'label' => 'Aanwezigheid in Allegro controleren',
// 'required' => false,
// 'mapped' => false
// ]);

$builder->addEventSubscriber($this->medewerkerSchuldhulpbureau);
}
Expand Down
16 changes: 16 additions & 0 deletions src/Service/AllegroService.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,22 @@ private function setSoapHeader(Schuldhulpbureau $bureau): void
*/
public function validateDossier(Dossier $dossier): bool
{
if (null === $dossier->getClientHuisnummer() || '' === $dossier->getClientHuisnummer()) {
throw AllegroServiceException::missingClientHousenumber();
}

if (null === $dossier->getClientStraat() || '' === $dossier->getClientStraat()) {
throw AllegroServiceException::missingClientStreet();
}

if (null === $dossier->getClientPostcode() || '' === $dossier->getClientPostcode()) {
throw AllegroServiceException::missingClientPostalcode();
}

if (null === $dossier->getClientWoonplaats() || '' === $dossier->getClientWoonplaats()) {
throw AllegroServiceException::missingClientResidence();
}

if (null === $dossier->getClientGeboortedatum()) {
throw AllegroServiceException::missingClientBirthdate();
}
Expand Down
2 changes: 1 addition & 1 deletion templates/Dossier/create.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<h3 class="document-team">GKA</h3>
{{ form_row(form.teamGka, {'attr': {'form_row_class': 'form-row__wide'}}) }}
{{ form_row(form.allegroNummer, {'attr': {'form_row_class': 'form-row__wide'}}) }}
{{ form_row(form.allegroCheck, {'attr': {'form_row_class': 'form-row__wide'}}) }}
{# {{ form_row(form.allegroCheck, {'attr': {'form_row_class': 'form-row__wide'}}) }}#}
</div>
</div>
<p class="buttons right">
Expand Down
5 changes: 5 additions & 0 deletions translations/messages.nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ MISSING_CLIENT_GENDER: Geslacht van cliënt niet gevuld.
MISSING_CLIENT_BSN: BSN van cliënt niet gevuld.
MISSING_CLIENT_INITIALS: Initialen van cliënt niet gevuld.

MISSING_CLIENT_STREET: Straat van cliënt niet gevuld.
MISSING_CLIENT_HOUSENUMBER: Huisnummer van cliënt niet gevuld.
MISSING_CLIENT_POSTALCODE: Postcode van cliënt niet gevuld.
MISSING_CLIENT_RESIDENCE: Woonplaats van cliënt niet gevuld.

MISSING_PARTNER_BIRTHDATE: Geboortedatum van partner niet gevuld.
MISSING_PARTNER_GENDER: Geslacht van partner niet gevuld.
MISSING_PARTNER_BSN: BSN van partner niet gevuld.
Expand Down

0 comments on commit 2fbbd6c

Please sign in to comment.