Commit 52affa1d by Yvon Kerdoncuff

disable ssa_force_allocation_amount effect when it is null + deal with the…

disable ssa_force_allocation_amount effect when it is null + deal with the impossibility of clearing parameter value once it has been set by disabling ssa_force_allocation_amount when value is 0
parent bd02beeb
...@@ -72,7 +72,7 @@ class AdherentAdminController extends CRUDController ...@@ -72,7 +72,7 @@ class AdherentAdminController extends CRUDController
$forcedAmount = (int) $this->em->getRepository(GlobalParameter::class) $forcedAmount = (int) $this->em->getRepository(GlobalParameter::class)
->val(GlobalParameter::SSA_FORCE_ALLOCATION_AMOUNT); ->val(GlobalParameter::SSA_FORCE_ALLOCATION_AMOUNT);
if(is_int($forcedAmount)) { if($forcedAmount > 0) {
$adherents = $qb->getQuery()->getResult(); $adherents = $qb->getQuery()->getResult();
foreach ($adherents as $adherent) { foreach ($adherents as $adherent) {
$adherent->setAllocationAmount($forcedAmount); $adherent->setAllocationAmount($forcedAmount);
......
...@@ -25,8 +25,8 @@ final class Version20250317150730 extends AbstractMigration ...@@ -25,8 +25,8 @@ final class Version20250317150730 extends AbstractMigration
VALUES ( VALUES (
UUID(), UUID(),
'SSA_FORCE_ALLOCATION_AMOUNT', 'SSA_FORCE_ALLOCATION_AMOUNT',
'Le montant d\'allocation est forcé égal au nombre entier saisi. Effacer pour désactiver.', 'Le montant d\'allocation est forcé égal à l\'entier positif saisi. Saisir 0 pour désactiver.',
'', '0',
'0' '0'
) )
"); ");
......
...@@ -190,7 +190,7 @@ class TAVCotisationUtils ...@@ -190,7 +190,7 @@ class TAVCotisationUtils
$forcedAmount = (int) $this->em->getRepository(GlobalParameter::class) $forcedAmount = (int) $this->em->getRepository(GlobalParameter::class)
->val(GlobalParameter::SSA_FORCE_ALLOCATION_AMOUNT); ->val(GlobalParameter::SSA_FORCE_ALLOCATION_AMOUNT);
if(is_int($forcedAmount)) { if($forcedAmount > 0) {
$adherent->setAllocationAmount($forcedAmount); $adherent->setAllocationAmount($forcedAmount);
return; return;
} }
...@@ -235,7 +235,7 @@ class TAVCotisationUtils ...@@ -235,7 +235,7 @@ class TAVCotisationUtils
$forcedAmount = (int) $this->em->getRepository(GlobalParameter::class) $forcedAmount = (int) $this->em->getRepository(GlobalParameter::class)
->val(GlobalParameter::SSA_FORCE_ALLOCATION_AMOUNT); ->val(GlobalParameter::SSA_FORCE_ALLOCATION_AMOUNT);
if(is_int($forcedAmount)) { if($forcedAmount > 0) {
$adherent->setAllocationAmount($forcedAmount); $adherent->setAllocationAmount($forcedAmount);
return; return;
} }
......
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