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
fbf78c7b
Commit
fbf78c7b
authored
Oct 18, 2024
by
Kohinos Cooperatic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
payment hotfix for tests in preprod env
parent
9a51843b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
15 deletions
+27
-15
UserAdherentController.php
src/Controller/UserAdherentController.php
+3
-9
UserComptoirController.php
src/Controller/UserComptoirController.php
+2
-2
TAVCotisationUtils.php
src/Utils/TAVCotisationUtils.php
+22
-4
No files found.
src/Controller/UserAdherentController.php
View file @
fbf78c7b
...
...
@@ -128,17 +128,11 @@ class UserAdherentController extends FluxController
* Returns error message or null if no error.
*/
private
function
paiementCotisTavValidation
(
$flux
)
{
//Look for existing recurring payment
if
(
$reason
=
$this
->
tavCotisationsUtils
->
checkExistingRecurringPayment
(
$flux
->
getDestinataire
()
->
getUser
()
->
getEmail
()))
{
return
implode
(
" "
,
array_column
(
$reason
,
'reason'
));
}
// Look for existing cotisation
if
(
$this
->
tavCotisationsUtils
->
checkExistingCotisation
(
$flux
))
{
return
"Cotisation déjà payée ce mois-ci."
;
}
$destinataire
=
$flux
->
getDestinataire
();
if
(
$reason
=
$this
->
tavCotisationsUtils
->
preventCotisationDuplication
(
$destinataire
))
{
return
$reason
;
}
// Look for cotisation data depending on active process
if
(
true
==
$this
->
getParameter
(
'household_based_allowance'
))
{
...
...
src/Controller/UserComptoirController.php
View file @
fbf78c7b
...
...
@@ -205,10 +205,10 @@ class UserComptoirController extends FluxController
$flux
=
$form
->
getData
();
// Look for existing cotisation
if
(
$
this
->
tavCotisationsUtils
->
checkExistingCotisation
(
$flux
))
{
if
(
$
reason
=
$this
->
tavCotisationsUtils
->
preventCotisationDuplication
(
$flux
->
getDestinataire
()
))
{
$this
->
addFlash
(
'error'
,
$this
->
translator
->
trans
(
'L\'adhérent•e a déjà payé sa cotisation ce mois-ci.'
)
$this
->
translator
->
trans
(
$reason
)
);
return
$this
->
redirectToRoute
(
'index'
);
...
...
src/Utils/TAVCotisationUtils.php
View file @
fbf78c7b
...
...
@@ -33,15 +33,32 @@ class TAVCotisationUtils
}
/**
* Check if cotisation already exist this month the the recipient of the given Flux.
* Check if there is an active recurring paiement or if cotisation already exist this month
* by returning a descriptive reason string if so, else an empty string.
*/
public
function
checkExistingCotisation
(
Flux
$flux
)
public
function
preventCotisationDuplication
(
Adherent
$adherent
)
{
//Look for existing recurring payment
if
(
$reason
=
$this
->
checkExistingRecurringPayment
(
$adherent
->
getUser
()
->
getEmail
()))
{
return
implode
(
" "
,
array_column
(
$reason
,
'reason'
));
}
//Look for existing cotisation
if
(
$this
->
checkExistingCotisation
(
$adherent
))
{
return
"Cotisation déjà payée ce mois-ci."
;
}
return
""
;
}
/**
* Check if cotisation already exist this month.
*/
private
function
checkExistingCotisation
(
Adherent
$adherent
)
{
$first_day_this_month
=
date
(
'Y-m-01'
);
$last_day_this_month
=
date
(
'Y-m-t'
);
$existing
=
$this
->
em
->
getRepository
(
Flux
::
class
)
->
getTavCotisationsBetweenDates
(
$
flux
->
getDestinataire
()
,
$
adherent
,
$first_day_this_month
,
$last_day_this_month
);
...
...
@@ -50,7 +67,8 @@ class TAVCotisationUtils
}
/**
* Returns a descriptive string of existing payment, or empty string.
* Returns an array containing a descriptive string of existing payment
* as well as other information about the payment, or an empty array.
*
* @param String $userEmail
*/
...
...
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