Commit b932702c by Damien Moulard

fix impossible de cotiser par cb quand solde emlc à 0

parent cf595865
......@@ -154,11 +154,16 @@ jQuery(document).ready(function() {
form.submit()
}
});
$('.cotisationSubmit').on('click', function(e){
$('.cotisationMLCSubmit').on('click', function(e){
// Stop form submition
e.preventDefault();
var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'mlc'
if (form.checkValidity()) {
var div = '.confirmCotisation'
......@@ -172,5 +177,11 @@ jQuery(document).ready(function() {
form.submit()
}
});
$('.cotisationCBSubmit').on('click', function(e){
var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'cb'
});
});
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@
"app": {
"js": [
"/build/runtime.420770e4.js",
"/build/app.a5bdb92a.js"
"/build/app.a1cf5950.js"
],
"css": [
"/build/app.0ecb0d81.css"
......
......@@ -2,7 +2,7 @@
"build/admin.css": "/build/admin.4d653142.css",
"build/admin.js": "/build/admin.3024c297.js",
"build/app.css": "/build/app.0ecb0d81.css",
"build/app.js": "/build/app.a5bdb92a.js",
"build/app.js": "/build/app.a1cf5950.js",
"build/runtime.js": "/build/runtime.420770e4.js",
"build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js",
"build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js",
......
......@@ -52,13 +52,8 @@ class UserController extends AbstractController
if ($form->isSubmitted()) {
$cotisation = $form->getData();
if ($form->get('payMLC')->isClicked()) {
$cotisation->setMoyen(MoyenEnum::MOYEN_MLC);
} else {
$cotisation->setMoyen(MoyenEnum::MOYEN_CB);
}
if ($form->isValid()) {
if ($form->get('payMLC')->isClicked() || !$form->get('payMLC')->isClicked() && !$form->get('payCB')->isClicked()) {
if ($cotisation->getMoyen() == MoyenEnum::MOYEN_MLC) {
$cotisation->setRecu(true);
$this->em->persist($cotisation);
$this->em->flush();
......@@ -78,7 +73,7 @@ class UserController extends AbstractController
} else {
$this->addFlash(
'error',
$this->translator->trans('Problème avec la cotisation !')
$this->translator->trans('Problème avec la cotisation !') . ' ' . $form->getErrors()
);
}
}
......
......@@ -88,21 +88,21 @@ class CotiserFormType extends AbstractType
'data' => MoyenEnum::MOYEN_MLC,
))
;
// ->add('moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen de paiement :',
// 'choices' => $canPayWithMlc ? [MoyenEnum::getTypeName(MoyenEnum::MOYEN_MLC) => MoyenEnum::MOYEN_MLC, MoyenEnum::getTypeName(MoyenEnum::MOYEN_CB) => MoyenEnum::MOYEN_CB] : [MoyenEnum::getTypeName(MoyenEnum::MOYEN_CB) => MoyenEnum::MOYEN_CB]
// ))
if ($canPayWithMlc) {
$builder->add('payMLC', SubmitType::class, array(
'label' => "Payer en eMLC",
'attr' => [
'class' => 'btn-primary btn cotisationSubmit'
'class' => 'btn-primary btn cotisationMLCSubmit'
]
));
}
if ($canPayWithCB) {
$builder->add('payCB', SubmitType::class, ['label' => "Payer en CB"]);
$builder->add('payCB', SubmitType::class, array(
'label' => "Payer en CB",
'attr' => [
'class' => 'btn-primary btn cotisationCBSubmit'
]
));
}
if ($this->security->getUser()->isGranted('ROLE_ADHERENT')) {
......
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