Commit d71ca3ea by Julien Jorry

Fix SolidoumeCommand bug : if someone has not been yet taken

parent 015f5263
......@@ -296,14 +296,20 @@ class SolidoumeCommand extends Command
foreach ($items as $item) {
if ($this->isItemPayedThisMonth($item)) {
$datas = $this->em->getRepository(Flux::class)->getQueryByAdherentAndDestinataire($item->getAdherent(), $this->em->getRepository(Prestataire::class)->getPrestataireSolidoume(), 'adherent_prestataire');
if (count($datas) > 0) {
$lastPrelevement = $datas[0];
$lastPrelevement = null;
foreach ($datas as $data) {
if ($data->getCreatedAt()->format('d') <= $this->param->getExecutionDate()) {
$lastPrelevement = $data;
}
}
$total += $lastPrelevement->getMontant();
if (!$item->getIsDonation()) {
++$countParticipants;
if ($lastPrelevement == null && count($datas) > 0) {
$lastPrelevement = $datas[0];
$total += $lastPrelevement->getMontant();
if (!$item->getIsDonation()) {
++$countParticipants;
}
++$countPerson;
}
++$countPerson;
}
}
$totalByParticipant = round((($total / $countParticipants) * ((100 - $this->param->getCommission()) / 100)), 2, PHP_ROUND_HALF_DOWN);
......
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