1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-02-24 09:01:18 +00:00

Compare commits

..

No commits in common. "e8f4ca1e09336d554719e184ff59a7cd01344053" and "0887e4bbde66c152e8263f6d40cf40ace8b52272" have entirely different histories.

10 changed files with 588 additions and 665 deletions

View File

@ -655,7 +655,8 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
if club.name != "Kfet" and club.parent_club and not Membership.objects.filter(
user=form.instance.user,
club=club.parent_club,
date_start__gte=club.parent_club.membership_start,
date_start__lte=timezone.now(),
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

View File

@ -1235,7 +1235,7 @@
"type": "view",
"mask": 1,
"field": "",
"permanent": true,
"permanent": false,
"description": "Voir le dernier WEI"
}
},
@ -1267,7 +1267,7 @@
"type": "add",
"mask": 1,
"field": "",
"permanent": true,
"permanent": false,
"description": "M'inscrire au dernier WEI"
}
},
@ -1331,7 +1331,7 @@
"type": "view",
"mask": 1,
"field": "",
"permanent": true,
"permanent": false,
"description": "Voir ma propre inscription WEI"
}
},
@ -1379,7 +1379,7 @@
"type": "change",
"mask": 1,
"field": "soge_credit",
"permanent": true,
"permanent": false,
"description": "Indiquer si mon inscription WEI est payée par la Société générale tant qu'elle n'est pas validée"
}
},
@ -1427,7 +1427,7 @@
"type": "change",
"mask": 1,
"field": "birth_date",
"permanent": true,
"permanent": false,
"description": "Modifier la date de naissance de ma propre inscription WEI"
}
},
@ -1459,7 +1459,7 @@
"type": "change",
"mask": 1,
"field": "gender",
"permanent": true,
"permanent": false,
"description": "Modifier le genre de ma propre inscription WEI"
}
},
@ -1491,7 +1491,7 @@
"type": "change",
"mask": 1,
"field": "health_issues",
"permanent": true,
"permanent": false,
"description": "Modifier mes problèmes de santé de mon inscription WEI"
}
},
@ -1523,7 +1523,7 @@
"type": "change",
"mask": 1,
"field": "emergency_contact_name",
"permanent": true,
"permanent": false,
"description": "Modifier le nom du contact en cas d'urgence de mon inscription WEI"
}
},
@ -1555,7 +1555,7 @@
"type": "change",
"mask": 1,
"field": "emergency_contact_phone",
"permanent": true,
"permanent": false,
"description": "Modifier le téléphone du contact en cas d'urgence de mon inscription WEI"
}
},
@ -1699,7 +1699,7 @@
"type": "add",
"mask": 3,
"field": "",
"permanent": true,
"permanent": false,
"description": "Créer une adhésion WEI pour le dernier WEI"
}
},
@ -2003,7 +2003,7 @@
"type": "change",
"mask": 1,
"field": "clothing_cut",
"permanent": true,
"permanent": false,
"description": "Modifier ma coupe de vêtements de mon inscription WEI"
}
},
@ -2035,7 +2035,7 @@
"type": "change",
"mask": 1,
"field": "clothing_size",
"permanent": true,
"permanent": false,
"description": "Modifier la taille de vêtements de mon inscription WEI"
}
},
@ -2243,7 +2243,7 @@
"type": "change",
"mask": 1,
"field": "information_json",
"permanent": true,
"permanent": false,
"description": "Modifier mes préférences en terme de bus et d'équipe si mon inscription n'est pas validée et que je suis en 2A+"
}
},
@ -3495,7 +3495,7 @@
"model": "permission.role",
"pk": 20,
"fields": {
"for_club": 1,
"for_club": 2,
"name": "PC Kfet",
"permissions": [
6,

View File

@ -262,33 +262,6 @@ class WEIRegistration(models.Model):
"""
self.information_json = json.dumps(information, indent=2)
@property
def fee(self):
bde = Club.objects.get(pk=1)
kfet = Club.objects.get(pk=2)
kfet_member = Membership.objects.filter(
club_id=kfet.id,
user=self.user,
date_start__gte=kfet.membership_start,
).exists()
bde_member = Membership.objects.filter(
club_id=bde.id,
user=self.user,
date_start__gte=bde.membership_start,
).exists()
fee = self.wei.membership_fee_paid if self.user.profile.paid \
else self.wei.membership_fee_unpaid
if not kfet_member:
fee += kfet.membership_fee_paid if self.user.profile.paid \
else kfet.membership_fee_unpaid
if not bde_member:
fee += bde.membership_fee_paid if self.user.profile.paid \
else bde.membership_fee_unpaid
return fee
@property
def is_validated(self):
try:

View File

@ -43,7 +43,6 @@ class WEIRegistrationTable(tables.Table):
edit = tables.LinkColumn(
'wei:wei_update_registration',
orderable=False,
args=[A('pk')],
verbose_name=_("Edit"),
text=_("Edit"),
@ -54,14 +53,18 @@ class WEIRegistrationTable(tables.Table):
}
}
)
validate = tables.Column(
validate = tables.LinkColumn(
'wei:validate_registration',
args=[A('pk')],
verbose_name=_("Validate"),
orderable=False,
accessor=A('pk'),
text=_("Validate"),
attrs={
'th': {
'id': 'validate-membership-header'
},
'a': {
'class': 'btn btn-success',
'data-type': 'validate-membership'
}
}
)
@ -69,7 +72,6 @@ class WEIRegistrationTable(tables.Table):
delete = tables.LinkColumn(
'wei:wei_delete_registration',
args=[A('pk')],
orderable=False,
verbose_name=_("delete"),
text=_("Delete"),
attrs={
@ -94,20 +96,7 @@ class WEIRegistrationTable(tables.Table):
registration=record,
)
)
if not hasperm:
return format_html("<span class='no-perm'></span>")
url = reverse_lazy('wei:validate_registration', args=(record.pk,))
text = _('Validate')
if record.fee > record.user.note.balance:
btn_class = 'btn-secondary'
tooltip = _("The user does not have enough money.")
else:
btn_class = 'btn-success'
tooltip = _("The user has enough money, you can validate the registration.")
return format_html(f"<a class=\"btn {btn_class}\" data-type='validate-membership' data-toggle=\"tooltip\" "
f"title=\"{tooltip}\" href=\"{url}\">{text}</a>")
return _("Validate") if hasperm else format_html("<span class='no-perm'></span>")
def render_delete(self, record):
hasperm = PermissionBackend.check_perm(get_current_authenticated_user(), "wei.delete_weimembership", record)
@ -119,8 +108,7 @@ class WEIRegistrationTable(tables.Table):
}
model = WEIRegistration
template_name = 'django_tables2/bootstrap4.html'
fields = ('user', 'user__first_name', 'user__last_name', 'first_year', 'caution_check',
'edit', 'validate', 'delete',)
fields = ('user', 'user__first_name', 'user__last_name', 'first_year', 'caution_check',)
row_attrs = {
'class': 'table-row',
'id': lambda record: "row-" + str(record.pk),

View File

@ -3,7 +3,6 @@
import subprocess
from datetime import timedelta, date
from unittest import skip
from api.tests import TestAPI
from django.conf import settings
@ -813,7 +812,6 @@ class TestWEISurveyAlgorithm(TestCase):
)
CurrentSurvey(self.registration).save()
@skip # FIXME Write good unit tests
def test_survey_algorithm(self):
CurrentSurvey.get_algorithm_class()().run_algorithm()

View File

@ -222,7 +222,7 @@ class WEIMembershipsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableVi
| Q(team__name__iregex=pattern)
)
return qs
return qs[:20]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -256,7 +256,7 @@ class WEIRegistrationsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTable
| Q(user__note__alias__normalized_name__iregex="^" + Alias.normalize(pattern))
)
return qs
return qs[:20]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -818,13 +818,22 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
date_start__gte=bde.membership_start,
).exists()
context["fee"] = registration.fee
fee = registration.wei.membership_fee_paid if registration.user.profile.paid \
else registration.wei.membership_fee_unpaid
if not context["kfet_member"]:
fee += kfet.membership_fee_paid if registration.user.profile.paid \
else kfet.membership_fee_unpaid
if not context["bde_member"]:
fee += bde.membership_fee_paid if registration.user.profile.paid \
else bde.membership_fee_unpaid
context["fee"] = fee
form = context["form"]
if registration.soge_credit:
form.fields["credit_amount"].initial = registration.fee
form.fields["credit_amount"].initial = fee
else:
form.fields["credit_amount"].initial = max(0, registration.fee - registration.user.note.balance)
form.fields["credit_amount"].initial = max(0, fee - registration.user.note.balance)
return context

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-29 14:06+0200\n"
"POT-Creation-Date: 2021-08-25 23:24+0200\n"
"PO-Revision-Date: 2020-11-16 20:02+0000\n"
"Last-Translator: Yohann D'ANELLO <ynerant@crans.org>\n"
"Language-Team: French <http://translate.ynerant.fr/projects/nk20/nk20/fr/>\n"
@ -461,7 +461,7 @@ msgstr "créer"
#: apps/logs/models.py:65 apps/note/tables.py:165 apps/note/tables.py:201
#: apps/permission/models.py:127 apps/treasury/tables.py:38
#: apps/wei/tables.py:73
#: apps/wei/tables.py:75
msgid "delete"
msgstr "supprimer"
@ -508,7 +508,7 @@ msgstr "rôles"
msgid "fee"
msgstr "cotisation"
#: apps/member/apps.py:14 apps/wei/tables.py:193 apps/wei/tables.py:224
#: apps/member/apps.py:14 apps/wei/tables.py:181 apps/wei/tables.py:212
msgid "member"
msgstr "adhérent"
@ -1137,7 +1137,7 @@ msgstr "Modifier le club"
msgid "Add new member to the club"
msgstr "Ajouter un nouveau membre au club"
#: apps/member/views.py:642 apps/wei/views.py:917
#: apps/member/views.py:642 apps/wei/views.py:924
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
@ -1443,8 +1443,8 @@ msgstr ""
"mode de paiement et un utilisateur ou un club"
#: apps/note/models/transactions.py:355 apps/note/models/transactions.py:358
#: apps/note/models/transactions.py:361 apps/wei/views.py:922
#: apps/wei/views.py:926
#: apps/note/models/transactions.py:361 apps/wei/views.py:929
#: apps/wei/views.py:933
msgid "This field is required."
msgstr "Ce champ est requis."
@ -1479,13 +1479,13 @@ msgstr "Pas de motif spécifié"
#: apps/note/tables.py:169 apps/note/tables.py:203 apps/treasury/tables.py:39
#: apps/treasury/templates/treasury/invoice_confirm_delete.html:30
#: apps/treasury/templates/treasury/sogecredit_detail.html:65
#: apps/wei/tables.py:74 apps/wei/tables.py:114
#: apps/wei/tables.py:76 apps/wei/tables.py:103
#: apps/wei/templates/wei/weiregistration_confirm_delete.html:31
msgid "Delete"
msgstr "Supprimer"
#: apps/note/tables.py:197 apps/note/templates/note/conso_form.html:132
#: apps/wei/tables.py:48 apps/wei/tables.py:49
#: apps/wei/tables.py:47 apps/wei/tables.py:48
#: apps/wei/templates/wei/base.html:89
#: apps/wei/templates/wei/bus_detail.html:20
#: apps/wei/templates/wei/busteam_detail.html:20
@ -2363,7 +2363,7 @@ msgstr ""
"demande de crédit."
#: apps/treasury/templates/treasury/sogecredit_detail.html:63
#: apps/wei/tables.py:59 apps/wei/tables.py:101
#: apps/wei/tables.py:59 apps/wei/tables.py:60 apps/wei/tables.py:99
msgid "Validate"
msgstr "Valider"
@ -2429,7 +2429,7 @@ msgid "WEI"
msgstr "WEI"
#: apps/wei/forms/registration.py:51 apps/wei/models.py:118
#: apps/wei/models.py:315
#: apps/wei/models.py:288
msgid "bus"
msgstr "bus"
@ -2467,7 +2467,7 @@ msgstr "Sélectionnez les rôles qui vous intéressent."
msgid "This team doesn't belong to the given bus."
msgstr "Cette équipe n'appartient pas à ce bus."
#: apps/wei/forms/surveys/wei2021.py:31
#: apps/wei/forms/surveys/wei2021.py:30
msgid "Choose a word:"
msgstr "Choisissez un mot :"
@ -2593,52 +2593,44 @@ msgstr ""
"Informations sur l'inscription (bus pour les 2A+, questionnaire pour les "
"1A), encodées en JSON"
#: apps/wei/models.py:304
#: apps/wei/models.py:277
msgid "WEI User"
msgstr "Participant au WEI"
#: apps/wei/models.py:305
#: apps/wei/models.py:278
msgid "WEI Users"
msgstr "Participants au WEI"
#: apps/wei/models.py:325
#: apps/wei/models.py:298
msgid "team"
msgstr "équipe"
#: apps/wei/models.py:335
#: apps/wei/models.py:308
msgid "WEI registration"
msgstr "Inscription au WEI"
#: apps/wei/models.py:339
#: apps/wei/models.py:312
msgid "WEI membership"
msgstr "Adhésion au WEI"
#: apps/wei/models.py:340
#: apps/wei/models.py:313
msgid "WEI memberships"
msgstr "Adhésions au WEI"
#: apps/wei/tables.py:104
msgid "The user does not have enough money."
msgstr "L'utilisateur n'a pas assez d'argent."
#: apps/wei/tables.py:107
msgid "The user has enough money, you can validate the registration."
msgstr "L'utilisateur a assez d'argent, l'inscription est possible."
#: apps/wei/tables.py:139
#: apps/wei/tables.py:127
msgid "Year"
msgstr "Année"
#: apps/wei/tables.py:177 apps/wei/templates/wei/bus_detail.html:32
#: apps/wei/tables.py:165 apps/wei/templates/wei/bus_detail.html:32
#: apps/wei/templates/wei/busteam_detail.html:50
msgid "Teams"
msgstr "Équipes"
#: apps/wei/tables.py:186 apps/wei/tables.py:227
#: apps/wei/tables.py:174 apps/wei/tables.py:215
msgid "Members count"
msgstr "Nombre de membres"
#: apps/wei/tables.py:193 apps/wei/tables.py:224
#: apps/wei/tables.py:181 apps/wei/tables.py:212
msgid "members"
msgstr "adhérents"
@ -2658,11 +2650,11 @@ msgstr "Prix du WEI (étudiants)"
msgid "WEI list"
msgstr "Liste des WEI"
#: apps/wei/templates/wei/base.html:81 apps/wei/views.py:510
#: apps/wei/templates/wei/base.html:81 apps/wei/views.py:508
msgid "Register 1A"
msgstr "Inscrire un 1A"
#: apps/wei/templates/wei/base.html:85 apps/wei/views.py:578
#: apps/wei/templates/wei/base.html:85 apps/wei/views.py:576
msgid "Register 2A+"
msgstr "Inscrire un 2A+"
@ -2691,8 +2683,8 @@ msgstr "Télécharger au format PDF"
#: apps/wei/templates/wei/survey.html:11
#: apps/wei/templates/wei/survey_closed.html:11
#: apps/wei/templates/wei/survey_end.html:11 apps/wei/views.py:973
#: apps/wei/views.py:1028 apps/wei/views.py:1038
#: apps/wei/templates/wei/survey_end.html:11 apps/wei/views.py:980
#: apps/wei/views.py:1035 apps/wei/views.py:1045
msgid "Survey WEI"
msgstr "Questionnaire WEI"
@ -2910,31 +2902,31 @@ msgstr "Ajouter un nouveau bus"
msgid "Update bus"
msgstr "Modifier le bus"
#: apps/wei/views.py:366
#: apps/wei/views.py:364
msgid "Manage bus"
msgstr "Gérer le bus"
#: apps/wei/views.py:393
#: apps/wei/views.py:391
msgid "Create new team"
msgstr "Créer une nouvelle équipe"
#: apps/wei/views.py:433
#: apps/wei/views.py:431
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/wei/views.py:464
#: apps/wei/views.py:462
msgid "Manage WEI team"
msgstr "Gérer l'équipe WEI"
#: apps/wei/views.py:486
#: apps/wei/views.py:484
msgid "Register first year student to the WEI"
msgstr "Inscrire un 1A au WEI"
#: apps/wei/views.py:532 apps/wei/views.py:613
#: apps/wei/views.py:530 apps/wei/views.py:611
msgid "This user is already registered to this WEI."
msgstr "Cette personne est déjà inscrite au WEI."
#: apps/wei/views.py:537
#: apps/wei/views.py:535
msgid ""
"This user can't be in her/his first year since he/she has already "
"participated to a WEI."
@ -2942,27 +2934,27 @@ msgstr ""
"Cet utilisateur ne peut pas être en première année puisqu'il a déjà "
"participé à un WEI."
#: apps/wei/views.py:554
#: apps/wei/views.py:552
msgid "Register old student to the WEI"
msgstr "Inscrire un 2A+ au WEI"
#: apps/wei/views.py:597 apps/wei/views.py:686
#: apps/wei/views.py:595 apps/wei/views.py:684
msgid "You already opened an account in the Société générale."
msgstr "Vous avez déjà ouvert un compte auprès de la société générale."
#: apps/wei/views.py:643
#: apps/wei/views.py:641
msgid "Update WEI Registration"
msgstr "Modifier l'inscription WEI"
#: apps/wei/views.py:746
#: apps/wei/views.py:744
msgid "Delete WEI registration"
msgstr "Supprimer l'inscription WEI"
#: apps/wei/views.py:757
#: apps/wei/views.py:755
msgid "You don't have the right to delete this WEI registration."
msgstr "Vous n'avez pas la permission de supprimer cette inscription au WEI."
#: apps/wei/views.py:776
#: apps/wei/views.py:774
msgid "Validate WEI registration"
msgstr "Valider l'inscription WEI"

View File

@ -159,6 +159,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="alert alert-danger">
{% trans "You are not a BDE member anymore. Please renew your membership if you want to use the note." %}
</div>
{% elif not user|is_member:"Kfet" %}
<div class="alert alert-warning">
{% trans "You are not a Kfet member, so you can't use your note account." %}
</div>
{% endif %}
{% if not user.profile.email_confirmed %}