Commit 1c6fbe53 by Yvon

5896 : add total adult counts to household section

parent 7e2c6c35
......@@ -38,12 +38,14 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
/**
* Administration des adhérents.
......@@ -197,6 +199,16 @@ class AdherentAdmin extends AbstractAdmin
'required' => true,
'placeholder' => "Choix de la composition du foyer",
])
->add('householdAdultCount',IntegerType::class, [
'label' => "Nombre total d'adultes dans le foyer (pour calculer l'allocation)",
'constraints' => [
new GreaterThanOrEqual(['value' => 0]),
],
'required' => true,
'attr' => [
'autocomplete' => false
]
])
->add('dependentChildren', CollectionType::class, [
'entry_type' => DependentChildFormType::class,
'entry_options' => [
......
......@@ -124,6 +124,11 @@ class Adherent extends AccountableObject implements AccountableInterface
*/
private $householdComposition;
/**
* @ORM\Column(type="integer", length=255, nullable=true)
*/
private $householdAdultCount;
public function __construct()
{
......@@ -336,6 +341,18 @@ class Adherent extends AccountableObject implements AccountableInterface
return $this;
}
public function getHouseholdAdultCount(): ?int
{
return $this->householdAdultCount;
}
public function setHouseholdAdultCount(?int $householdAdultCount): self
{
$this->householdAdultCount = $householdAdultCount;
return $this;
}
public function getMailRappelCotisation(): ?bool
{
......
<?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 Version20240311170014 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent ADD household_adult_count INT DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent DROP household_adult_count');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment