8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

Supprime la vue 'recharge' qui faisait doublon avec 'credit_solde'

This commit is contained in:
Hugo LEVY-FALK 2018-07-03 21:38:10 +02:00
parent ebe5633fcd
commit 328c030cc4
4 changed files with 19 additions and 47 deletions

View file

@ -31,7 +31,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %}
{% bootstrap_form_errors factureform %}
{% if title %}
<h3>{{title}}</h3>
{% endif %}
{% if balance %}
<h4>{% trans "Current balance :" %}{{balance}}€</h4>
{% endif %}
<form class="form" method="post">
{% csrf_token %}
{% if articlesformset %}

View file

@ -138,11 +138,6 @@ urlpatterns = [
views.new_facture_solde,
name='new_facture_solde'
),
url(
r'^recharge/$',
views.recharge,
name='recharge'
),
url(r'^$', views.index, name='index'),
] + payment_methods.urls.urlpatterns

View file

@ -326,39 +326,6 @@ def del_facture(request, facture, **_kwargs):
}, 'cotisations/delete.html', request)
# TODO : change solde to balance
@login_required
@can_create(Facture)
@can_edit(User)
def credit_solde(request, user, **_kwargs):
"""
View used to edit the balance of a user.
Can be use either to increase or decrease a user's balance.
"""
# TODO : change facture to invoice
invoice = CreditSoldeForm(request.POST or None)
if invoice.is_valid():
invoice_instance = invoice.save(commit=False)
invoice_instance.user = user
invoice_instance.save()
new_purchase = Vente.objects.create(
facture=invoice_instance,
name="solde",
prix=invoice.cleaned_data['montant'],
number=1
)
new_purchase.save()
messages.success(
request,
_("Balance successfully updated.")
)
return redirect(reverse('cotisations:index'))
return form({
'factureform': invoice,
'action_name': _("Edit")
}, 'cotisations/facture.html', request)
@login_required
@can_create(Article)
def add_article(request):
@ -815,11 +782,14 @@ def new_facture_solde(request, userid):
}, 'cotisations/new_facture_solde.html', request)
# TODO : change recharge to refill
# TODO : change solde to balance
@login_required
def recharge(request):
@can_create(Facture)
@can_edit(User)
def credit_solde(request, user, **_kwargs):
"""
View used to refill the balance by using online payment.
View used to edit the balance of a user.
Can be use either to increase or decrease a user's balance.
"""
refill_form = RechargeForm(request.POST or None, user=request.user)
if refill_form.is_valid():
@ -835,6 +805,8 @@ def recharge(request):
)
return invoice.paiement.end_payment(invoice, request)
return form({
'rechargeform': refill_form,
'solde': request.user.solde
}, 'cotisations/recharge.html', request)
'factureform': refill_form,
'balance': request.user.solde,
'title': _("Refill your balance"),
'action_name': _("Pay")
}, 'cotisations/facture.html', request)

View file

@ -34,7 +34,7 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p>
{% if user_solde %}
<p>Votre solde est de <span class="badge">{{ users.solde }}€</span>.
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:recharge' %}">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
<i class="fa fa-euro-sign"></i>
Recharger
</a>
@ -165,7 +165,7 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<th>Solde</th>
<td>{{ users.solde }} €
{% if user_solde %}
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:recharge' %}">
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
<i class="fa fa-euro-sign"></i>
Recharger
</a>