mirror of https://gitlab.crans.org/bde/nk20
The BDE membership and the club membership must now be in two parts
This commit is contained in:
parent
905d65371f
commit
bcd96b2ed8
|
@ -13,15 +13,29 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
{% if additional_fee_renewal %}
|
{% if additional_fee_renewal %}
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
{% if renewal %}
|
{% if renewal %}
|
||||||
|
{% if club.name == "Kfet" %} {# Auto-renewal #}
|
||||||
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
|
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
|
||||||
The user is not a member of the club·s {{ clubs }}. An additional fee of {{ pretty_fee }}
|
The user is not a member of the club·s {{ clubs }}. An additional fee of {{ pretty_fee }}
|
||||||
will be charged to renew automatically the membership in this/these club·s.
|
will be charged to renew automatically the membership in this/these club·s.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
|
||||||
|
The user is not a member of the club·s {{ clubs }}. Please create the required memberships,
|
||||||
|
otherwise it will fail.
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if club.name == "Kfet" %}
|
||||||
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
|
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
|
||||||
This club has parents {{ clubs }}. An additional fee of {{ pretty_fee }}
|
This club has parents {{ clubs }}. An additional fee of {{ pretty_fee }}
|
||||||
will be charged to adhere automatically to this/these club·s.
|
will be charged to adhere automatically to this/these club·s.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
{% else %}
|
||||||
|
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
|
||||||
|
This club has parents {{ clubs }}. Please make sure that the user is a member of this or these club·s,
|
||||||
|
otherwise the creation of this membership will fail.
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -610,6 +610,9 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||||
bank = form.cleaned_data["bank"]
|
bank = form.cleaned_data["bank"]
|
||||||
soge = form.cleaned_data["soge"] and not user.profile.soge and (club.name == "BDE" or club.name == "Kfet")
|
soge = form.cleaned_data["soge"] and not user.profile.soge and (club.name == "BDE" or club.name == "Kfet")
|
||||||
|
|
||||||
|
if not credit_type:
|
||||||
|
credit_amount = 0
|
||||||
|
|
||||||
if not soge and user.note.balance + credit_amount < fee and not Membership.objects.filter(
|
if not soge and user.note.balance + credit_amount < fee and not Membership.objects.filter(
|
||||||
club__name="Kfet",
|
club__name="Kfet",
|
||||||
user=user,
|
user=user,
|
||||||
|
@ -631,6 +634,16 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||||
form.add_error('user', _('User is already a member of the club'))
|
form.add_error('user', _('User is already a member of the club'))
|
||||||
error = True
|
error = True
|
||||||
|
|
||||||
|
# Must join the parent club before joining this club, except for the Kfet club where it can be at the same time.
|
||||||
|
if club.name != "Kfet" and not Membership.objects.filter(
|
||||||
|
user=form.instance.user,
|
||||||
|
club=club.parent_club,
|
||||||
|
date_start__lte=club.parent_club.membership_start,
|
||||||
|
date_end__gte=club.parent_club.membership_end,
|
||||||
|
).exists():
|
||||||
|
form.add_error('user', _('User is not a member of the parent club') + ' ' + club.parent_club.name)
|
||||||
|
error = True
|
||||||
|
|
||||||
if club.membership_start and form.instance.date_start < club.membership_start:
|
if club.membership_start and form.instance.date_start < club.membership_start:
|
||||||
form.add_error('user', _("The membership must start after {:%m-%d-%Y}.")
|
form.add_error('user', _("The membership must start after {:%m-%d-%Y}.")
|
||||||
.format(form.instance.club.membership_start))
|
.format(form.instance.club.membership_start))
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue