Commit c53a92cc by Damien Moulard

check if cotisation profile exists on adherent side

parent d32f7a49
......@@ -109,7 +109,7 @@ class FluxController extends AbstractController
TAVCotisationUtils $tavCotisationsUtils,
TokenGeneratorInterface $tokenGenerator,
ValidatorInterface $validator,
CsrfTokenManagerInterface $tokenManager,
CsrfTokenManagerInterface $tokenManager
) {
$this->security = $security;
$this->em = $em;
......
......@@ -137,6 +137,7 @@ class UserAdherentController extends FluxController
if ($form->isSubmitted() && $form->isValid()) {
// TODO: set CB payment when the functionality is validated
$flux = $form->getData();
// Look for existing cotisation
......@@ -149,6 +150,18 @@ class UserAdherentController extends FluxController
return $this->redirectToRoute('index');
}
$destinataire = $flux->getDestinataire();
$profile = $destinataire->getProfilDeCotisation();
if (is_null($profile)) {
$this->addFlash(
'error',
$this->translator->trans('Opération impossible : vous n\'avez pas de profil de cotisation associé. Veuillez contacter un administrateur.')
);
return $this->redirectToRoute('index');
}
if (null == $flux->getDon() || 0 == $flux->getDon()->getMontant()) {
$flux->setDon(null);
}
......
......@@ -40,7 +40,7 @@ class AchatMonnaieFormType extends FluxFormType
if (null != $profilDeCotisation) {
$montant = $profilDeCotisation->getMontant();
} else {
$montant = intval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT_DEFAULT));
$montant = false;
}
$builder
......
......@@ -6,22 +6,27 @@
{% block blockcontent %}
{% set form = getPayerCotisationTAVForm(app.user) %}
<p>
{{ 'Montant de la cotisation à payer'|trans }} : <span class="paiement_cotisation_montant">{{ form.montant.vars.value }}</span>
</p>
{% if form.montant.vars.value == false %}
<p>{{ 'Vous n\'avez pas de profil de cotisation associé, vous ne pouvez donc pas payer de cotisation.'|trans }}</p>
<p>{{ 'Veuillez contacter un administrateur.'|trans }}</p>
{% else %}
<p>
{{ 'Montant de la cotisation à payer'|trans }} : <span class="paiement_cotisation_montant">{{ form.montant.vars.value }}</span>
</p>
{{form_start(form)}}
{% if form.don is defined %}
{{ form_row(form.don, {row_attr:{style: 'max-width: 200px;margin: 0 auto;'}}) }}
<hr/>
<p><b>{{ 'TOTAL A PAYER'|trans }} : <span class="achat_monnaie_montant_total">{{ form.montant.vars.value }}</span></b></p>
{% endif %}
{% if form.save is defined %}
{{ form_widget(form.save) }}
{% endif %}
{% if form.saveHelloAsso is defined %}
{{ form_widget(form.saveHelloAsso) }}
{% endif %}
{{form_end(form)}}
{% endif %}
{{form_start(form)}}
{% if form.don is defined %}
{{ form_row(form.don, {row_attr:{style: 'max-width: 200px;margin: 0 auto;'}}) }}
<hr/>
<p><b>{{ 'TOTAL A PAYER'|trans }} : <span class="achat_monnaie_montant_total">{{ form.montant.vars.value }}</span></b></p>
{% endif %}
{% if form.save is defined %}
{{ form_widget(form.save) }}
{% endif %}
{% if form.saveHelloAsso is defined %}
{{ form_widget(form.saveHelloAsso) }}
{% endif %}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
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