mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-20 17:41:55 +02:00
The BDE membership and the club membership must now be in two parts
This commit is contained in:
@ -13,15 +13,29 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% if additional_fee_renewal %}
|
||||
<div class="alert alert-warning">
|
||||
{% if renewal %}
|
||||
{% 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 }}
|
||||
will be charged to renew automatically the membership in this/these club·s.
|
||||
{% endblocktrans %}
|
||||
{% if club.name == "Kfet" %} {# Auto-renewal #}
|
||||
{% 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 }}
|
||||
will be charged to renew automatically the membership in this/these club·s.
|
||||
{% endblocktrans %}
|
||||
{% 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 %}
|
||||
{% 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 }}
|
||||
will be charged to adhere automatically to this/these club·s.
|
||||
{% endblocktrans %}
|
||||
{% if club.name == "Kfet" %}
|
||||
{% 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 }}
|
||||
will be charged to adhere automatically to this/these club·s.
|
||||
{% 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 %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -610,6 +610,9 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
bank = form.cleaned_data["bank"]
|
||||
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(
|
||||
club__name="Kfet",
|
||||
user=user,
|
||||
@ -631,6 +634,16 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
|
||||
form.add_error('user', _('User is already a member of the club'))
|
||||
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:
|
||||
form.add_error('user', _("The membership must start after {:%m-%d-%Y}.")
|
||||
.format(form.instance.club.membership_start))
|
||||
|
Reference in New Issue
Block a user