Commit d71ca3ea by Julien Jorry

Fix SolidoumeCommand bug : if someone has not been yet taken

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