Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
f5ce8281
Commit
f5ce8281
authored
Oct 11, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Solidoume redistribution program : bug in some particular situation
parent
d71ca3ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
SolidoumeCommand.php
src/Command/SolidoumeCommand.php
+24
-12
No files found.
src/Command/SolidoumeCommand.php
View file @
f5ce8281
...
@@ -293,22 +293,34 @@ class SolidoumeCommand extends Command
...
@@ -293,22 +293,34 @@ class SolidoumeCommand extends Command
$total
=
0
;
$total
=
0
;
$countPerson
=
0
;
$countPerson
=
0
;
$countParticipants
=
0
;
$countParticipants
=
0
;
$participants
=
[];
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'
);
$lastPrelevement
=
null
;
$lastPrelevement
=
null
;
foreach
(
$datas
as
$data
)
{
foreach
(
$datas
as
$data
)
{
if
(
$data
->
getCreatedAt
()
->
format
(
'd'
)
<=
$this
->
param
->
getExecutionDate
())
{
if
(
$data
->
getCreatedAt
()
->
format
(
'd'
)
<=
$this
->
param
->
getExecutionDate
()
&&
$data
->
getCreatedAt
()
->
format
(
'm'
)
==
((
new
\DateTime
(
'now'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'm'
)))
{
$lastPrelevement
=
$data
;
}
elseif
(
$data
->
getCreatedAt
()
->
format
(
'd'
)
>
$this
->
param
->
getExecutionDate
()
&&
$data
->
getCreatedAt
()
->
format
(
'm'
)
==
((
new
\DateTime
(
'now'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'm'
)
-
1
))
{
$lastPrelevement
=
$data
;
$lastPrelevement
=
$data
;
}
}
}
}
if
(
$lastPrelevement
==
null
&&
count
(
$datas
)
>
0
)
{
if
(
$lastPrelevement
!=
null
)
{
$lastPrelevement
=
$datas
[
0
];
$datas
=
$this
->
em
->
getRepository
(
Flux
::
class
)
->
getQueryByAdherentAndDestinataire
(
$item
->
getAdherent
(),
$this
->
em
->
getRepository
(
Prestataire
::
class
)
->
getPrestataireSolidoume
(),
'prestataire_adherent'
);
$total
+=
$lastPrelevement
->
getMontant
();
$lastPaiement
=
null
;
if
(
!
$item
->
getIsDonation
())
{
foreach
(
$datas
as
$data
)
{
++
$countParticipants
;
if
(
$data
->
getCreatedAt
()
->
format
(
'm'
)
==
((
new
\DateTime
(
'now'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'm'
)))
{
$lastPaiement
=
$data
;
}
}
if
(
$lastPaiement
==
null
)
{
$total
+=
$lastPrelevement
->
getMontant
();
if
(
!
$item
->
getIsDonation
())
{
++
$countParticipants
;
}
$participants
[]
=
$item
;
++
$countPerson
;
}
}
++
$countPerson
;
}
}
}
}
}
}
...
@@ -323,8 +335,8 @@ class SolidoumeCommand extends Command
...
@@ -323,8 +335,8 @@ class SolidoumeCommand extends Command
$isTest
=
$this
->
isTest
;
$isTest
=
$this
->
isTest
;
$io
=
$this
->
io
;
$io
=
$this
->
io
;
$operationUtils
=
$this
->
operationUtils
;
$operationUtils
=
$this
->
operationUtils
;
$callback
=
function
()
use
(
$em
,
$
item
s
,
$isTest
,
$io
,
$totalByParticipant
,
$operationUtils
)
{
$callback
=
function
()
use
(
$em
,
$
participant
s
,
$isTest
,
$io
,
$totalByParticipant
,
$operationUtils
)
{
foreach
(
$
item
s
as
$item
)
{
foreach
(
$
participant
s
as
$item
)
{
if
(
$this
->
isItemPayedThisMonth
(
$item
)
&&
!
$item
->
getIsDonation
())
{
if
(
$this
->
isItemPayedThisMonth
(
$item
)
&&
!
$item
->
getIsDonation
())
{
// Envoi de l'emlc sur le compte de l'adherent
// Envoi de l'emlc sur le compte de l'adherent
$flux
=
new
TransactionPrestataireAdherent
();
$flux
=
new
TransactionPrestataireAdherent
();
...
@@ -333,7 +345,7 @@ class SolidoumeCommand extends Command
...
@@ -333,7 +345,7 @@ class SolidoumeCommand extends Command
$flux
->
setMontant
(
$totalByParticipant
);
$flux
->
setMontant
(
$totalByParticipant
);
$flux
->
setMoyen
(
MoyenEnum
::
MOYEN_EMLC
);
$flux
->
setMoyen
(
MoyenEnum
::
MOYEN_EMLC
);
$now
=
(
new
\Datetime
(
'now'
))
->
format
(
'd/m/Y H:i:s'
);
$now
=
(
new
\Datetime
(
'now'
))
->
format
(
'd/m/Y H:i:s'
);
$flux
->
setReference
(
$em
->
getRepository
(
SolidoumeParameter
::
class
)
->
getValueOf
(
'name'
)
.
' '
.
$now
);
$flux
->
setReference
(
'Correction '
.
$em
->
getRepository
(
SolidoumeParameter
::
class
)
->
getValueOf
(
'name'
)
.
' '
.
$now
);
if
(
!
$isTest
)
{
if
(
!
$isTest
)
{
$em
->
persist
(
$flux
);
$em
->
persist
(
$flux
);
// Write operations for this flux !
// Write operations for this flux !
...
@@ -372,11 +384,11 @@ class SolidoumeCommand extends Command
...
@@ -372,11 +384,11 @@ class SolidoumeCommand extends Command
$lastMonth
=
intval
((
new
\DateTime
(
'now -1month'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'Ym'
));
$lastMonth
=
intval
((
new
\DateTime
(
'now -1month'
,
new
\DateTimeZone
(
'UTC'
)))
->
format
(
'Ym'
));
if
(
$item
->
isEnabled
()
&&
null
!=
$item
->
getLastMonthPayed
())
{
if
(
$item
->
isEnabled
()
&&
null
!=
$item
->
getLastMonthPayed
())
{
if
(
$item
->
getPaiementDate
()
<=
$this
->
param
->
getExecutionDate
()
&&
$item
->
getPaiementDate
()
>=
1
)
{
if
(
$item
->
getPaiementDate
()
<=
$this
->
param
->
getExecutionDate
()
&&
$item
->
getPaiementDate
()
>=
1
)
{
if
(
$item
->
getLastMonthPayed
()
=
=
$nowMonth
)
{
if
(
$item
->
getLastMonthPayed
()
>
=
$nowMonth
)
{
return
true
;
return
true
;
}
}
}
else
{
}
else
{
if
(
$item
->
getLastMonthPayed
()
=
=
$lastMonth
)
{
if
(
$item
->
getLastMonthPayed
()
>
=
$lastMonth
)
{
return
true
;
return
true
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment