mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-07-20 08:01:26 +02:00
Soge Credit changed
This commit is contained in:
@ -27,7 +27,7 @@ from django.views.generic.edit import BaseFormView, DeleteView
|
||||
from django_tables2 import SingleTableView, MultiTableMixin
|
||||
from api.viewsets import is_regex
|
||||
from member.models import Membership, Club
|
||||
from note.models import Transaction, NoteClub, Alias, SpecialTransaction, NoteSpecial
|
||||
from note.models import Transaction, NoteClub, Alias, SpecialTransaction
|
||||
from note.tables import HistoryTable
|
||||
from note_kfet.settings import BASE_DIR
|
||||
from permission.backends import PermissionBackend
|
||||
@ -662,7 +662,7 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
form.fields["user"].initial = self.request.user
|
||||
if "soge_credit" in form.fields:
|
||||
form.fields["soge_credit"].help_text = _('Check if you will open a Société Générale account')
|
||||
|
||||
|
||||
if "myself" in self.request.path and self.request.user.profile.soge:
|
||||
form.fields["soge_credit"].disabled = True
|
||||
form.fields["soge_credit"].help_text = _("You already opened an account in the Société générale.")
|
||||
@ -1007,15 +1007,6 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
}
|
||||
)
|
||||
|
||||
if registration.soge_credit:
|
||||
form.fields["credit_type"].disabled = True
|
||||
form.fields["credit_type"].initial = NoteSpecial.objects.get(special_type="Virement bancaire")
|
||||
form.fields["credit_amount"].disabled = True
|
||||
form.fields["last_name"].disabled = True
|
||||
form.fields["first_name"].disabled = True
|
||||
form.fields["bank"].disabled = True
|
||||
form.fields["bank"].initial = "Société générale"
|
||||
|
||||
if 'bus' in form.fields:
|
||||
# For 2A+ and hardcoded 1A
|
||||
form.fields["bus"].widget.attrs["api_url"] = "/api/wei/bus/?wei=" + str(registration.wei.pk)
|
||||
@ -1060,6 +1051,8 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
membership._force_renew_parent = True
|
||||
|
||||
fee = club.membership_fee_paid if user.profile.paid else club.membership_fee_unpaid
|
||||
if registration.soge_credit:
|
||||
fee = 2000
|
||||
|
||||
kfet = club.parent_club
|
||||
bde = kfet.parent_club
|
||||
@ -1086,7 +1079,7 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
first_name = form.cleaned_data["first_name"]
|
||||
bank = form.cleaned_data["bank"]
|
||||
|
||||
if credit_type is None or registration.soge_credit:
|
||||
if credit_type is None:
|
||||
credit_amount = 0
|
||||
|
||||
# Calculer le montant total nécessaire (frais + caution si transaction)
|
||||
@ -1095,7 +1088,7 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
total_needed += club.caution_amount
|
||||
|
||||
# Vérifier que l'utilisateur a assez d'argent pour tout payer
|
||||
if not registration.soge_credit and user.note.balance + credit_amount < total_needed:
|
||||
if user.note.balance + credit_amount < total_needed:
|
||||
form.add_error('credit_type',
|
||||
_("This user doesn't have enough money to join this club and pay the deposit. "
|
||||
"Current balance: %(balance)d€, credit: %(credit)d€, needed: %(needed)d€") % {
|
||||
|
Reference in New Issue
Block a user