Skip to content

Commit

Permalink
toevoeging onbekende schuldeiser
Browse files Browse the repository at this point in the history
  • Loading branch information
qr committed Nov 3, 2020
1 parent 875c34b commit d5c2a49
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/Entity/SchuldItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ class SchuldItem
*/
private $ontstaansDatum;

/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
private $toevoegingOnbekendeSchuldeiser;

/**
* @var DossierDocument[]|ArrayCollection
* @ORM\OneToMany(targetEntity="DossierDocument", mappedBy="schuldItem", cascade={"persist", "remove"})
Expand Down Expand Up @@ -387,4 +393,23 @@ public static function getTypes()
SchuldItem::TYPE_PREFERENT => SchuldItem::TYPE_PREFERENT,
];
}

/**
* @return string|null
*/
public function getToevoegingOnbekendeSchuldeiser(): ?string
{
return $this->toevoegingOnbekendeSchuldeiser;
}

/**
* @param string|null $toevoegingOnbekendeSchuldeiser
* @return SchuldItem
*/
public function setToevoegingOnbekendeSchuldeiser(?string $toevoegingOnbekendeSchuldeiser): SchuldItem
{
$this->toevoegingOnbekendeSchuldeiser = $toevoegingOnbekendeSchuldeiser;

return $this;
}
}
7 changes: 7 additions & 0 deletions src/Form/Type/SchuldItemFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
Expand Down Expand Up @@ -112,6 +113,12 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'prototype_name' => '__name__',
'by_reference' => false,
]);
$builder->add('toevoegingOnbekendeSchuldeiser', TextareaType::class, [
'label' => 'Informatie onbekende schuldeiser *',
'attr' => ['placeholder' => 'NAW / Naam / Telefoon'],
'required' => false
]);

$builder->add('aantekening', CreateAantekeningFormType::class, [
'mapped' => false,
'required' => false,
Expand Down
29 changes: 29 additions & 0 deletions src/Migrations/Version20201103132553.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20201103132553 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('ALTER TABLE schuld_item ADD toevoeging_onbekende_schuldeiser TEXT DEFAULT NULL');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE schuld_item DROP toevoeging_onbekende_schuldeiser');
}
}
10 changes: 9 additions & 1 deletion src/Service/AllegroService.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,15 @@ private function mapSchulden(Dossier $dossier): SchuldArray

$codeEiser = null === $item->getSchuldeiser()->getAllegroCode() ? $this->onbekendeSchuldeiser : $item->getSchuldeiser()->getAllegroCode();

$schuld = new TSchuld($item->getSchuldeiser()->getBedrijfsnaam(), 1, $item->getBedrag(), $codeEiser);
$omschrijving = $item->getBedrag();
if ($item->getSchuldeiser()->getAllegroCode() === $this->onbekendeSchuldeiser) {
$omschrijving = sprintf('%s - %s', $omschrijving, $item->getToevoegingOnbekendeSchuldeiser());
if (strlen($omschrijving) > 200) {
$omschrijving = sprintf('%s%s', substr($omschrijving, 0, 200), ' VOOR MEER ZIE SCHULDDOSSIER...');
}
}

$schuld = new TSchuld($item->getSchuldeiser()->getBedrijfsnaam(), 1, $omschrijving, $codeEiser);

if (null !== $item->getReferentie() && strlen($item->getReferentie())) {
$schuld->setReferentie($item->getReferentie());
Expand Down
4 changes: 3 additions & 1 deletion templates/Dossier/partial.nieuwSchuldItem.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
{{ form_row(createForm.ontstaansDatum) }}
</div>
</div>

<div class="column" id="toevoeging_onbekende_schuldeiser">
{{ form_row(createForm.toevoegingOnbekendeSchuldeiser) }}
</div>


</div>
Expand Down
3 changes: 3 additions & 0 deletions templates/Dossier/partial.schuldItem.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
{{ form_row(form.ontstaansDatum) }}
</div>
</div>
<div class="column" id="toevoeging_onbekende_schuldeiser">
{{ form_row(form.toevoegingOnbekendeSchuldeiser) }}
</div>


</div>
Expand Down

0 comments on commit d5c2a49

Please sign in to comment.