Commit 924cdf01 by Yvon Kerdoncuff

Merge branch '6151-error-cotis-equals-allowance' into 'ssa-gironde'

fix error at tav household based cotisation, when cotis amount equals allowance amount

See merge request cooperatic/kohinos-tav!83
parents fa7afb7c 753c7df0
......@@ -162,6 +162,7 @@ class TAVCotisationUtils
/**
* Method called to create Flux based on allowance amount (for household based allowance).
* Only create flux if amount paid != allowance amount.
*/
public function applyHouseholdAllowance(Flux $flux) {
// get allowance
......@@ -171,15 +172,17 @@ class TAVCotisationUtils
// get the mlc amount the user is supposed to receive
$mlcAllowanceAmount = $adherent->getAllocationAmount();
// get the difference between what the user paid and what he•she's supposed to receive
$amountDiff = $mlcAllowanceAmount - $cotisationAmount;
// only create new flux if there is a difference
if ($amountDiff != 0) {
if ($flux->getExpediteur() instanceof Siege) {
$siege = $flux->getExpediteur();
} else {
$siege = $flux->getExpediteur()->getGroupe()->getSiege();
}
// get the difference between what the user paid and what he•she's supposed to receive
$amountDiff = $mlcAllowanceAmount - $cotisationAmount;
if ($amountDiff > 0) {
// User should receive more than he•she paid: send a new flux to the user to complete its cotisation
$fluxCotis = new CotisationTavReversement();
......@@ -202,6 +205,7 @@ class TAVCotisationUtils
$this->em->persist($fluxCotis);
$this->operationUtils->executeOperations($fluxCotis);
}
}
/**
* Method called to create Flux based on allowance amount (for household based allowance).
......
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