Commit 838fee71 by Damien Moulard

Merge branch…

Merge branch '6233-pouvoir-annuler-les-transactions-ccas-du-mois-courant-mais-pas-au-dela' into 'ssa-gironde'

6233 pouvoir annuler les transactions ccas du mois courant mais pas au dela

See merge request cooperatic/kohinos-tav!96
parents b4bbd62d 7a518f57
......@@ -287,7 +287,25 @@ class UserController extends AbstractController
return $this->redirectToRoute('index');
}
//Prevent cancelling transactions which happened before a reconversion (to avoid refunding money that's been reconverted)
//Ccas transactions.
if ($transactionAdherentPrestataire->getIsCcas()) {
//Allowed if and only if transaction is from current month
$now = new \DateTime();
if (
$transactionAdherentPrestataire->getCreatedAt()->format('m') !== $now->format('m')
|| $transactionAdherentPrestataire->getCreatedAt()->format('Y') !== $now->format('Y')
) {
//display the same error message for CCAS or non CCAS as prestataire are not supposed to know if a transaction is CCAS or not
$this->addFlash(
'error',
'Cette transaction ne plus être annulée car une reconversion a été demandée depuis.'
);
return $this->redirectToRoute('index');
}
}
//Non ccas transactions,
else {
//we prevent cancelling transactions which happened before a reconversion (to avoid refunding money that's been reconverted)
if (
$this->em->getRepository(Flux::class)->getQueryByPrestataire(
$presta,
......@@ -302,6 +320,7 @@ class UserController extends AbstractController
);
return $this->redirectToRoute('index');
}
}
//Create new transaction in opposite direction
$flux = new TransactionPrestataireAdherent();
......
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