Commit 4d2be1ca by Yvon Kerdoncuff

Merge branch '7997-minimum-cotis-shares-exact-value' into 'develop'

ssa: cotisation minimum by shares, use exact shares number value

See merge request !146
parents eec85c3d 6cabb59c
...@@ -578,9 +578,9 @@ class AdherentAdmin extends AbstractAdmin ...@@ -578,9 +578,9 @@ class AdherentAdmin extends AbstractAdmin
$calculatedAllocationAmount = $this->tavCotisationUtils->getCalculatedHouseholdAllowanceValue($adherent); $calculatedAllocationAmount = $this->tavCotisationUtils->getCalculatedHouseholdAllowanceValue($adherent);
$sharesNb = intdiv($calculatedAllocationAmount, $cotisationBaseAmount); $sharesNb = round($calculatedAllocationAmount / $cotisationBaseAmount, 2);
$minAmountByShares = (int) $minCotisationAmount * $sharesNb; $minAmountByShares = ((int) $minCotisationAmount) * $sharesNb;
if ($adherent->getCotisationAmount() < $minAmountByShares) { if ($adherent->getCotisationAmount() < $minAmountByShares) {
$event->getForm()->get('cotisationAmount')->addError(new FormError("Montant invalide : le minimum est de {$minAmountByShares}€")); $event->getForm()->get('cotisationAmount')->addError(new FormError("Montant invalide : le minimum est de {$minAmountByShares}€"));
} }
......
...@@ -20,7 +20,7 @@ final class Version20250417105302 extends AbstractMigration ...@@ -20,7 +20,7 @@ final class Version20250417105302 extends AbstractMigration
public function up(Schema $schema) : void public function up(Schema $schema) : void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'SSA_HOUSEHOLD_COTIS_MINIMUM_BY_SHARE', 'Si la valeur est à true et que SSA_HOUSEHOLD_COTISATION_MINIMUM est défini, active un minimum de cotisation par part plutôt que par foyer. Une part est un montant correspondant à la valeur de SSA_HOUSEHOLD_BASE_AMOUNT, et on calcule le nombre de parts entières dans le montant d\'allocation prévu (avant application éventuelle de SSA_FORCE_ALLOCATION_AMOUNT ou SSA_HOUSEHOLD_MAX_ALLOCATION_AMOUNT). Le minimum est alors SSA_HOUSEHOLD_COTISATION_MINIMUM * nb de parts.', null, '0')"); $this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'SSA_HOUSEHOLD_COTIS_MINIMUM_BY_SHARE', 'Si la valeur est à true et que SSA_HOUSEHOLD_COTISATION_MINIMUM est défini, active un minimum de cotisation par part plutôt que par foyer. Une part est un montant correspondant à la valeur de SSA_HOUSEHOLD_BASE_AMOUNT, et on calcule le nombre de parts dans le montant d\'allocation prévu (avant application éventuelle de SSA_FORCE_ALLOCATION_AMOUNT ou SSA_HOUSEHOLD_MAX_ALLOCATION_AMOUNT). Le minimum est alors SSA_HOUSEHOLD_COTISATION_MINIMUM * nb de parts.', null, '0')");
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
......
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