Commit 970e19ce by Yvon

prevent cancelling transactions which happened before last reconversion

parent 2072962f
......@@ -8,6 +8,7 @@ use App\Entity\CotisationPrestataire;
use App\Entity\GlobalParameter;
use App\Entity\Payment;
use App\Entity\Prestataire;
use App\Entity\Reconversion;
use App\Entity\TransactionPrestataireAdherent;
use App\Entity\User;
use App\Entity\TransactionAdherentPrestataire;
......@@ -31,6 +32,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface;
use Twig\Environment;
use App\Entity\Flux;
class UserController extends AbstractController
{
......@@ -285,6 +287,22 @@ class UserController extends AbstractController
return $this->redirectToRoute('index');
}
//Prevent cancelling transactions which happened before the most recent reconversion (SSA Gironde sprint 4 ; see sprint 5 for CCAS specific case)
if (
$this->em->getRepository(Flux::class)->getQueryByPrestataire(
$presta,
null,
Reconversion::TYPE_RECONVERSION_PRESTATAIRE,
$transactionAdherentPrestataire->getCreatedAt()->format("Y-m-d H:i:s")
)->getResult()
) {
$this->addFlash(
'error',
'Cette transaction ne plus être annulée car une reconversion a été demandée depuis.'
);
return $this->redirectToRoute('index');
}
//Create new transaction in opposite direction
$flux = new TransactionPrestataireAdherent();
$flux->setExpediteur($presta);
......
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