Commit af2f99fc authored by Fardale's avatar Fardale

[readhession] obligation d'accepter les cgu

parent 7245a82b
......@@ -223,6 +223,9 @@ class AdhesionForm(forms.Form):
nbrmois = forms.IntegerField(min_value=0, max_value=12, required=True)
mode = forms.ChoiceField(label=_(u'Mode de réglement'), required=True)
class CguForm(forms.Form):
check = forms.BooleanField(required=True)
class ComptecransForm(forms.Form):
login = forms.CharField(label=_(u'Login Crans'), required=False)
def __init__(self, ldap_user=None, ldap_conn=None, ptype=None, *args, **kwargs):
......
......@@ -43,7 +43,7 @@ Le non respect de ces documents peut entraîner ta déconnexion temporaire ou d
Une preuve d'adhésion est disponible dans l'onglet <a href="{% url 'factures:index' %}">factures</a> de l'Intranet.
</div>
<label> J’ai bien pris connaissance des documents cités et approuve leur contenu. Je m’engage de plus à aller les
consulter en cas de changements. <input type="checkbox" required> </label>
consulter en cas de changements. {{ cgu.check }} {{ cgu.check.errors }} </label>
{% endif %}
......
......@@ -30,7 +30,7 @@ from intranet import settings
from gestion.config import factures, cotisation
from forms import BaseCompteForm, CompteForm, BasePassForm, PassForm, MailForm, AliasForm, SoldeForm, VenteForm, AdhesionForm, ComptecransForm, DemenagementForm, NewCompteForm, EmenagementForm, NewClubForm
from forms import BaseCompteForm, CompteForm, BasePassForm, PassForm, MailForm, AliasForm, SoldeForm, VenteForm, AdhesionForm, CguForm, ComptecransForm, DemenagementForm, NewCompteForm, EmenagementForm, NewClubForm
from django.forms.utils import ErrorList
from intranet.mixins import CableurOrSelfMixin, CableurMixin
......@@ -443,11 +443,13 @@ class AdhesionView(CableurOrSelfMixin, RedirectHomeMixin, View):
template_name = "compte/adhesion.html"
def get(self, request, uid, ptype, cablage, *args, **kwargs):
form = AdhesionForm(request.POST, is_cableur=cablage)
cgu = CguForm(request.POST)
return render(
request,
self.template_name,
{
'form': form,
'cgu': cgu,
'ptype': ptype,
'ide': uid,
'cablage': cablage,
......@@ -497,10 +499,11 @@ class AdhesionView(CableurOrSelfMixin, RedirectHomeMixin, View):
# On traite le post
form = AdhesionForm(request.POST, is_cableur=cablage)
cgu = CguForm(request.POST)
luser = get_admin_luser(request, uid, ptype, 'w')
if form.is_valid():
#EN 2 etapes, on renvoie
if 'confirm' in request.POST.keys():
if 'confirm' in request.POST.keys() and cgu.is_valid():
######## Facturation de la connexion ########
mois = form.cleaned_data['nbrmois']
mois, prix, readhesion = prix(mois, luser, ptype, cablage)
......@@ -573,6 +576,7 @@ class AdhesionView(CableurOrSelfMixin, RedirectHomeMixin, View):
request,
self.template_name,
{'form': form,
'cgu': cgu,
'ptype': ptype,
'ide': uid},
)
......@@ -580,6 +584,7 @@ class AdhesionView(CableurOrSelfMixin, RedirectHomeMixin, View):
request,
self.template_name,
{'form': form,
'cgu': cgu,
'ptype': ptype,
'ide': uid,
'confirm': True,
......@@ -592,6 +597,7 @@ class AdhesionView(CableurOrSelfMixin, RedirectHomeMixin, View):
request,
self.template_name,
{'form': form,
'cgu': cgu,
'ptype': ptype,
'ide': uid,
'cablage': cablage},
......
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