diff --git a/apps/member/views.py b/apps/member/views.py index 30fbb139..edcb0feb 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -531,7 +531,12 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView): return super().form_invalid(form) if club.parent_club is not None: - if not Membership.objects.filter(user=form.instance.user, club=club.parent_club).exists(): + if not Membership.objects.filter( + user=form.instance.user, + club=club.parent_club, + date_start__lte=form.instance.date_start, + date_end__gte=form.instance.date_start, + ).exists(): form.add_error('user', _('User is not a member of the parent club') + ' ' + club.parent_club.name) return super().form_invalid(form) diff --git a/apps/wei/views.py b/apps/wei/views.py index ed76cc0f..7731f08b 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -728,8 +728,7 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Crea context["kfet_member"] = Membership.objects.filter( club__name="Kfet", user=registration.user, - date_start__lte=datetime.now().date(), - date_end__gte=datetime.now().date(), + date_start__gte=registration.wei.parent_club.membership_start, ).exists() return context @@ -788,9 +787,15 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Crea form.add_error('bus', _("This user didn't give her/his caution check.")) return super().form_invalid(form) - if club.parent_club is not None: - if not Membership.objects.filter(user=form.instance.user, club=club.parent_club).exists(): - form.add_error('user', _('User is not a member of the parent club') + ' ' + club.parent_club.name) + if club.parent_club is not None: # parent_club is never None: this is Kfet. + # We want that the user is member of the Kfet club *of this year*: the Kfet membership is included + # in the WEI registration. + if not Membership.objects.filter( + user=form.instance.user, + club=club.parent_club, # Kfet + date_start__gte=club.parent_club.membership_start, + ).exists(): + form.add_error('bus', _('User is not a member of the parent club') + ' ' + club.parent_club.name) return super().form_invalid(form) # Now, all is fine, the membership can be created. diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 3f207ceb..be04465e 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-03 18:38+0200\n" +"POT-Creation-Date: 2020-08-03 23:53+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -540,7 +540,7 @@ msgstr "" msgid "membership ends on" msgstr "" -#: apps/member/models.py:310 apps/member/views.py:535 apps/wei/views.py:793 +#: apps/member/models.py:310 apps/member/views.py:540 apps/wei/views.py:798 msgid "User is not a member of the parent club" msgstr "" @@ -549,7 +549,7 @@ msgstr "" msgid "The role {role} does not apply to the club {club}." msgstr "" -#: apps/member/models.py:328 apps/member/views.py:544 +#: apps/member/models.py:328 apps/member/views.py:549 msgid "User is already a member of the club" msgstr "" @@ -620,31 +620,31 @@ msgstr "" msgid "Add new member to the club" msgstr "" -#: apps/member/views.py:530 apps/wei/views.py:784 +#: apps/member/views.py:530 apps/wei/views.py:783 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." msgstr "" -#: apps/member/views.py:548 +#: apps/member/views.py:553 msgid "The membership must start after {:%m-%d-%Y}." msgstr "" -#: apps/member/views.py:553 +#: apps/member/views.py:558 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "" -#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574 +#: apps/member/views.py:575 apps/member/views.py:577 apps/member/views.py:579 #: apps/registration/views.py:290 apps/registration/views.py:292 #: apps/registration/views.py:294 msgid "This field is required." msgstr "" -#: apps/member/views.py:642 +#: apps/member/views.py:647 msgid "Manage roles of an user in the club" msgstr "" -#: apps/member/views.py:667 +#: apps/member/views.py:672 msgid "Members of the club" msgstr "" @@ -1448,7 +1448,7 @@ msgstr "" msgid "Bus" msgstr "" -#: apps/wei/models.py:100 templates/wei/weiclub_tables.html:79 +#: apps/wei/models.py:100 templates/wei/weiclub_tables.html:32 msgid "Buses" msgstr "" @@ -1704,25 +1704,25 @@ msgstr "" msgid "Validate WEI registration" msgstr "" -#: apps/wei/views.py:788 +#: apps/wei/views.py:787 msgid "This user didn't give her/his caution check." msgstr "" -#: apps/wei/views.py:825 apps/wei/views.py:878 apps/wei/views.py:888 +#: apps/wei/views.py:830 apps/wei/views.py:883 apps/wei/views.py:893 #: templates/wei/survey.html:12 templates/wei/survey_closed.html:12 #: templates/wei/survey_end.html:12 msgid "Survey WEI" msgstr "" -#: note_kfet/settings/base.py:155 +#: note_kfet/settings/base.py:156 msgid "German" msgstr "" -#: note_kfet/settings/base.py:156 +#: note_kfet/settings/base.py:157 msgid "English" msgstr "" -#: note_kfet/settings/base.py:157 +#: note_kfet/settings/base.py:158 msgid "French" msgstr "" @@ -1921,16 +1921,16 @@ msgstr "" msgid "There is no membership found with this pattern." msgstr "" -#: templates/member/club_tables.html:7 +#: templates/member/club_tables.html:9 msgid "Club managers" msgstr "" -#: templates/member/club_tables.html:20 +#: templates/member/club_tables.html:22 msgid "Club members" msgstr "" -#: templates/member/club_tables.html:33 templates/member/profile_tables.html:28 -#: templates/wei/weiclub_tables.html:105 +#: templates/member/club_tables.html:35 templates/member/profile_tables.html:26 +#: templates/wei/weiclub_tables.html:58 msgid "Transaction history" msgstr "" @@ -2470,23 +2470,23 @@ msgstr "" msgid "WEI listing" msgstr "" -#: templates/wei/weiclub_tables.html:63 +#: templates/wei/weiclub_tables.html:16 msgid "Register to the WEI! – 1A" msgstr "" -#: templates/wei/weiclub_tables.html:65 +#: templates/wei/weiclub_tables.html:18 msgid "Register to the WEI! – 2A+" msgstr "" -#: templates/wei/weiclub_tables.html:67 +#: templates/wei/weiclub_tables.html:20 msgid "Update my registration" msgstr "" -#: templates/wei/weiclub_tables.html:92 +#: templates/wei/weiclub_tables.html:45 msgid "Members of the WEI" msgstr "" -#: templates/wei/weiclub_tables.html:120 +#: templates/wei/weiclub_tables.html:73 msgid "Unvalidated registrations" msgstr "" @@ -2557,23 +2557,17 @@ msgstr "" #: templates/wei/weimembership_form.html:152 msgid "" -"\n" -" The WEI will be paid by Société générale. The " -"membership will be created even if the bank didn't pay the BDE yet.\n" -" The membership transaction will be created but " -"will be invalid. You will have to validate it once the bank\n" -" validated the creation of the account, or to " -"change the payment method.\n" -" " +"The WEI will be paid by Société générale. The membership will be created " +"even if the bank didn't pay the BDE yet. The membership transaction will be " +"created but will be invalid. You will have to validate it once the bank " +"validated the creation of the account, or to change the payment method." msgstr "" #: templates/wei/weimembership_form.html:162 #, python-format msgid "" -"\n" -" The note don't have enough money " -"(%(balance)s, %(pretty_fee)s required). The registration may fail.\n" -" " +"The note don't have enough money (%(balance)s, %(pretty_fee)s required). The " +"registration may fail." msgstr "" #: templates/wei/weimembership_form.html:169 @@ -2587,15 +2581,10 @@ msgstr "" #: templates/wei/weimembership_form.html:184 #, python-format msgid "" -"\n" -" This user is not a member of the Kfet club. " -"Please adhere\n" -" here if he/" -"she is in her/his first year\n" -" or here if he/she " -"was an old member before you validate\n" -" the registration of the WEI.\n" -" " +"This user is not a member of the Kfet club for the comming year. Please " +"adhere here if he/she is in her/his first " +"year or here if he/she was an old member " +"before you validate the registration of the WEI." msgstr "" #: templates/wei/weimembership_list.html:24 diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 8fedb67a..f1a36008 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-03 18:38+0200\n" +"POT-Creation-Date: 2020-08-03 23:53+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -545,7 +545,7 @@ msgstr "l'adhésion commence le" msgid "membership ends on" msgstr "l'adhésion finit le" -#: apps/member/models.py:310 apps/member/views.py:535 apps/wei/views.py:793 +#: apps/member/models.py:310 apps/member/views.py:540 apps/wei/views.py:798 msgid "User is not a member of the parent club" msgstr "L'utilisateur n'est pas membre du club parent" @@ -554,7 +554,7 @@ msgstr "L'utilisateur n'est pas membre du club parent" msgid "The role {role} does not apply to the club {club}." msgstr "Le rôle {role} ne s'applique pas au club {club}." -#: apps/member/models.py:328 apps/member/views.py:544 +#: apps/member/models.py:328 apps/member/views.py:549 msgid "User is already a member of the club" msgstr "L'utilisateur est déjà membre du club" @@ -625,7 +625,7 @@ msgstr "Modifier le club" msgid "Add new member to the club" msgstr "Ajouter un nouveau membre au club" -#: apps/member/views.py:530 apps/wei/views.py:784 +#: apps/member/views.py:530 apps/wei/views.py:783 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." @@ -633,25 +633,25 @@ msgstr "" "Cet utilisateur n'a pas assez d'argent pour rejoindre ce club et ne peut pas " "avoir un solde négatif." -#: apps/member/views.py:548 +#: apps/member/views.py:553 msgid "The membership must start after {:%m-%d-%Y}." msgstr "L'adhésion doit commencer après le {:%d/%m/%Y}." -#: apps/member/views.py:553 +#: apps/member/views.py:558 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}." -#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574 +#: apps/member/views.py:575 apps/member/views.py:577 apps/member/views.py:579 #: apps/registration/views.py:290 apps/registration/views.py:292 #: apps/registration/views.py:294 msgid "This field is required." msgstr "Ce champ est requis." -#: apps/member/views.py:642 +#: apps/member/views.py:647 msgid "Manage roles of an user in the club" msgstr "Gérer les rôles d'un utilisateur dans le club" -#: apps/member/views.py:667 +#: apps/member/views.py:672 msgid "Members of the club" msgstr "Membres du club" @@ -1483,7 +1483,7 @@ msgstr "" msgid "Bus" msgstr "Bus" -#: apps/wei/models.py:100 templates/wei/weiclub_tables.html:79 +#: apps/wei/models.py:100 templates/wei/weiclub_tables.html:32 msgid "Buses" msgstr "Bus" @@ -1750,25 +1750,25 @@ msgstr "Vous n'avez pas la permission de supprimer cette inscription au WEI." msgid "Validate WEI registration" msgstr "Valider l'inscription WEI" -#: apps/wei/views.py:788 +#: apps/wei/views.py:787 msgid "This user didn't give her/his caution check." msgstr "Cet utilisateur n'a pas donné son chèque de caution." -#: apps/wei/views.py:825 apps/wei/views.py:878 apps/wei/views.py:888 +#: apps/wei/views.py:830 apps/wei/views.py:883 apps/wei/views.py:893 #: templates/wei/survey.html:12 templates/wei/survey_closed.html:12 #: templates/wei/survey_end.html:12 msgid "Survey WEI" msgstr "Questionnaire WEI" -#: note_kfet/settings/base.py:155 +#: note_kfet/settings/base.py:156 msgid "German" msgstr "Allemand" -#: note_kfet/settings/base.py:156 +#: note_kfet/settings/base.py:157 msgid "English" msgstr "Anglais" -#: note_kfet/settings/base.py:157 +#: note_kfet/settings/base.py:158 msgid "French" msgstr "Français" @@ -1981,16 +1981,16 @@ msgstr "Filtrer par rôle :" msgid "There is no membership found with this pattern." msgstr "Il n'y a pas d'adhésion trouvée avec cette entrée." -#: templates/member/club_tables.html:7 +#: templates/member/club_tables.html:9 msgid "Club managers" msgstr "Bureau du club" -#: templates/member/club_tables.html:20 +#: templates/member/club_tables.html:22 msgid "Club members" msgstr "Membres du club" -#: templates/member/club_tables.html:33 templates/member/profile_tables.html:28 -#: templates/wei/weiclub_tables.html:105 +#: templates/member/club_tables.html:35 templates/member/profile_tables.html:26 +#: templates/wei/weiclub_tables.html:58 msgid "Transaction history" msgstr "Historique des transactions" @@ -2579,23 +2579,23 @@ msgstr "Voir le WEI" msgid "WEI listing" msgstr "Liste des WEI" -#: templates/wei/weiclub_tables.html:63 +#: templates/wei/weiclub_tables.html:16 msgid "Register to the WEI! – 1A" msgstr "M'inscrire au WEI ! – 1A" -#: templates/wei/weiclub_tables.html:65 +#: templates/wei/weiclub_tables.html:18 msgid "Register to the WEI! – 2A+" msgstr "M'inscrire au WEI ! – 2A+" -#: templates/wei/weiclub_tables.html:67 +#: templates/wei/weiclub_tables.html:20 msgid "Update my registration" msgstr "Modifier mon inscription" -#: templates/wei/weiclub_tables.html:92 +#: templates/wei/weiclub_tables.html:45 msgid "Members of the WEI" msgstr "Membres du WEI" -#: templates/wei/weiclub_tables.html:120 +#: templates/wei/weiclub_tables.html:73 msgid "Unvalidated registrations" msgstr "Inscriptions non validées" @@ -2666,14 +2666,10 @@ msgstr "avec les rôles suivants :" #: templates/wei/weimembership_form.html:152 msgid "" -"\n" -" The WEI will be paid by Société générale. The " -"membership will be created even if the bank didn't pay the BDE yet.\n" -" The membership transaction will be created but " -"will be invalid. You will have to validate it once the bank\n" -" validated the creation of the account, or to " -"change the payment method.\n" -" " +"The WEI will be paid by Société générale. The membership will be created " +"even if the bank didn't pay the BDE yet. The membership transaction will be " +"created but will be invalid. You will have to validate it once the bank " +"validated the creation of the account, or to change the payment method." msgstr "" "\n" "Le WEI va être payé par la Société générale. L'adhésion sera créée même si " @@ -2684,12 +2680,9 @@ msgstr "" " " #: templates/wei/weimembership_form.html:162 -#, python-format msgid "" -"\n" -" The note don't have enough money " -"(%(balance)s, %(pretty_fee)s required). The registration may fail.\n" -" " +"The note don't have enough money (%(balance)s, %(pretty_fee)s required). The " +"registration may fail." msgstr "" "\n" "La note n'a pas assez d'argent (%(balance)s, %(pretty_fee)s requis). " @@ -2705,20 +2698,14 @@ msgid "The user didn't give her/his caution check." msgstr "L'utilisateur n'a pas donné son chèque de caution." #: templates/wei/weimembership_form.html:184 -#, python-format msgid "" -"\n" -" This user is not a member of the Kfet club. " -"Please adhere\n" -" here if he/" -"she is in her/his first year\n" -" or here if he/she " -"was an old member before you validate\n" -" the registration of the WEI.\n" -" " +"This user is not a member of the Kfet club for the comming year. Please " +"adhere here if he/she is in her/his first " +"year or here if he/she was an old member " +"before you validate the registration of the WEI." msgstr "" "\n" -"Cet utilisateur n'est pas membre du club Kfet. Merci de le faire adhérer\n" +"Cet utilisateur n'est pas membre du club Kfet pour l'année à venir. Merci de le faire adhérer\n" "ici s'iel est en première année\n" "ou ici s'iel est un ancien membre avant de " "valider\n" @@ -2749,6 +2736,3 @@ msgstr "Il n'y a pas de pré-inscription en attente avec cette entrée." #: templates/wei/weiregistration_list.html:24 msgid "View validated memberships..." msgstr "Voir les adhésions validées ..." - -#~ msgid "Validate a registration" -#~ msgstr "Valider l'inscription" diff --git a/templates/wei/weimembership_form.html b/templates/wei/weimembership_form.html index d33c3de7..7c74457b 100644 --- a/templates/wei/weimembership_form.html +++ b/templates/wei/weimembership_form.html @@ -149,7 +149,7 @@ {% else %} {% if registration.soge_credit %}
- {% blocktrans %} + {% blocktrans trimmed %} The WEI will be paid by Société générale. The membership will be created even if the bank didn't pay the BDE yet. The membership transaction will be created but will be invalid. You will have to validate it once the bank validated the creation of the account, or to change the payment method. @@ -159,7 +159,7 @@ {% if registration.user.note.balance < fee %}
{% with pretty_fee=fee|pretty_money %} - {% blocktrans with balance=registration.user.note.balance|pretty_money %} + {% blocktrans trimmed with balance=registration.user.note.balance|pretty_money %} The note don't have enough money ({{ balance }}, {{ pretty_fee }} required). The registration may fail. {% endblocktrans %} {% endwith %} @@ -181,8 +181,8 @@
{% url 'registration:future_user_detail' pk=registration.user.pk as future_user_detail %} {% url 'member:club_detail' pk=club.parent_club.parent_club.pk as club_detail %} - {% blocktrans %} - This user is not a member of the Kfet club. Please adhere + {% blocktrans trimmed %} + This user is not a member of the Kfet club for the comming year. Please adhere here if he/she is in her/his first year or here if he/she was an old member before you validate the registration of the WEI.