Compare commits

..

No commits in common. "d7b834d9089e647084944b37ae4e24f3a03e5a72" and "8409ee4cc454328d5fb0071c6862244cb6a4ff44" have entirely different histories.

14 changed files with 403 additions and 440 deletions

View File

@ -208,9 +208,7 @@ class Transaction(PolymorphicModel):
super().save(*args, **kwargs)
# Save notes
self.source._force_save = True
self.source.save()
self.destination._force_save = True
self.destination.save()
def delete(self, **kwargs):

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
import functools
import json
import operator
from time import sleep
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
@ -45,14 +44,6 @@ class InstancedPermission:
else:
oldpk = obj.pk
# Ensure previous models are deleted
count = 0
while count < 1000:
if self.model.model_class().objects.filter(pk=obj.pk).exists():
# If the object exists, that means that one permission is currently checked.
# We wait before the other permission, at most 1 second.
sleep(1)
continue
break
for o in self.model.model_class().objects.filter(pk=obj.pk).all():
o._force_delete = True
Model.delete(o)
@ -124,10 +115,10 @@ class PermissionMask(models.Model):
class Permission(models.Model):
PERMISSION_TYPES = [
('add', _('add')),
('view', _('view')),
('change', _('change')),
('delete', _('delete'))
('add', 'add'),
('view', 'view'),
('change', 'change'),
('delete', 'delete')
]
model = models.ForeignKey(

View File

@ -17,7 +17,6 @@ from django.http import HttpResponse
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.urls import reverse_lazy
from django.utils import timezone
from django.views import View
from django.views.generic import DetailView, UpdateView, CreateView, RedirectView, TemplateView
from django.utils.translation import gettext_lazy as _
@ -57,11 +56,7 @@ class WEIListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["can_create_wei"] = PermissionBackend.check_perm(self.request.user, "wei.add_weiclub", WEIClub(
year=0,
date_start=timezone.now().date(),
date_end=timezone.now().date(),
))
context["can_create_wei"] = PermissionBackend.check_perm(self.request.user, "wei.add_weiclub", WEIClub())
return context

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-31 22:25+0200\n"
"POT-Creation-Date: 2020-07-31 17:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -46,7 +46,7 @@ msgstr ""
#: apps/activity/models.py:23 apps/activity/models.py:48
#: apps/member/models.py:151 apps/note/models/notes.py:188
#: apps/note/models/transactions.py:25 apps/note/models/transactions.py:45
#: apps/note/models/transactions.py:263 apps/permission/models.py:332
#: apps/note/models/transactions.py:261 apps/permission/models.py:323
#: apps/wei/models.py:65 apps/wei/models.py:117
#: templates/member/club_info.html:13 templates/member/profile_info.html:14
#: templates/registration/future_profile_detail.html:16
@ -71,14 +71,14 @@ msgid "activity types"
msgstr ""
#: apps/activity/models.py:53 apps/note/models/transactions.py:81
#: apps/permission/models.py:113 apps/permission/models.py:192
#: apps/permission/models.py:104 apps/permission/models.py:183
#: apps/wei/models.py:71 apps/wei/models.py:128
#: templates/activity/activity_detail.html:16
msgid "description"
msgstr ""
#: apps/activity/models.py:60 apps/note/models/notes.py:164
#: apps/note/models/transactions.py:66 apps/permission/models.py:167
#: apps/note/models/transactions.py:66 apps/permission/models.py:158
#: templates/activity/activity_detail.html:19
msgid "type"
msgstr ""
@ -193,7 +193,7 @@ msgstr ""
#: apps/activity/tables.py:79 apps/member/forms.py:107
#: apps/registration/forms.py:69 apps/treasury/forms.py:122
#: templates/note/transaction_form.html:127
#: templates/note/transaction_form.html:126
msgid "First name"
msgstr ""
@ -241,7 +241,7 @@ msgstr ""
msgid "IP Address"
msgstr ""
#: apps/logs/models.py:35 apps/permission/models.py:137
#: apps/logs/models.py:35 apps/permission/models.py:128
msgid "model"
msgstr ""
@ -267,7 +267,7 @@ msgid "edit"
msgstr ""
#: apps/logs/models.py:62 apps/note/tables.py:138 apps/note/tables.py:166
#: apps/permission/models.py:130 apps/wei/tables.py:65
#: apps/wei/tables.py:65
msgid "delete"
msgstr ""
@ -324,7 +324,7 @@ msgid "Credit amount"
msgstr ""
#: apps/member/forms.py:112 apps/registration/forms.py:74
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:133
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
msgid "Bank"
msgstr ""
@ -533,7 +533,7 @@ msgstr ""
msgid "fee"
msgstr ""
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:797
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:787
msgid "User is not a member of the parent club"
msgstr ""
@ -613,7 +613,7 @@ msgstr ""
msgid "Add new member to the club"
msgstr ""
#: apps/member/views.py:529 apps/wei/views.py:788
#: apps/member/views.py:529 apps/wei/views.py:778
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
@ -827,46 +827,46 @@ msgid ""
"is not active."
msgstr ""
#: apps/note/models/transactions.py:230
#: apps/note/models/transactions.py:228
#: templates/activity/activity_entry.html:13 templates/base.html:99
#: templates/note/transaction_form.html:15
#: templates/note/transaction_form.html:141
#: templates/note/transaction_form.html:140
msgid "Transfer"
msgstr ""
#: apps/note/models/transactions.py:253
#: apps/note/models/transactions.py:251
msgid "Template"
msgstr ""
#: apps/note/models/transactions.py:268
#: apps/note/models/transactions.py:266
msgid "first_name"
msgstr ""
#: apps/note/models/transactions.py:273
#: apps/note/models/transactions.py:271
msgid "bank"
msgstr ""
#: apps/note/models/transactions.py:279
#: apps/note/models/transactions.py:277
#: templates/activity/activity_entry.html:17
#: templates/note/transaction_form.html:20
msgid "Credit"
msgstr ""
#: apps/note/models/transactions.py:279 templates/note/transaction_form.html:24
#: apps/note/models/transactions.py:277 templates/note/transaction_form.html:24
msgid "Debit"
msgstr ""
#: apps/note/models/transactions.py:290
#: apps/note/models/transactions.py:288
msgid ""
"A special transaction is only possible between a Note associated to a "
"payment method and a User or a Club"
msgstr ""
#: apps/note/models/transactions.py:307 apps/note/models/transactions.py:312
#: apps/note/models/transactions.py:305 apps/note/models/transactions.py:310
msgid "membership transaction"
msgstr ""
#: apps/note/models/transactions.py:308 apps/treasury/models.py:227
#: apps/note/models/transactions.py:306 apps/treasury/models.py:227
msgid "membership transactions"
msgstr ""
@ -915,79 +915,67 @@ msgstr ""
msgid "Consumptions"
msgstr ""
#: apps/permission/models.py:92
#: apps/permission/models.py:83
#, python-brace-format
msgid "Can {type} {model}.{field} in {query}"
msgstr ""
#: apps/permission/models.py:94
#: apps/permission/models.py:85
#, python-brace-format
msgid "Can {type} {model} in {query}"
msgstr ""
#: apps/permission/models.py:107
#: apps/permission/models.py:98
msgid "rank"
msgstr ""
#: apps/permission/models.py:120
#: apps/permission/models.py:111
msgid "permission mask"
msgstr ""
#: apps/permission/models.py:121
#: apps/permission/models.py:112
msgid "permission masks"
msgstr ""
#: apps/permission/models.py:127
msgid "add"
msgstr ""
#: apps/permission/models.py:128
msgid "view"
msgstr ""
#: apps/permission/models.py:129
msgid "change"
msgstr ""
#: apps/permission/models.py:161
#: apps/permission/models.py:152
msgid "query"
msgstr ""
#: apps/permission/models.py:174
#: apps/permission/models.py:165
msgid "mask"
msgstr ""
#: apps/permission/models.py:180
#: apps/permission/models.py:171
msgid "field"
msgstr ""
#: apps/permission/models.py:185
#: apps/permission/models.py:176
msgid ""
"Tells if the permission should be granted even if the membership of the user "
"is expired."
msgstr ""
#: apps/permission/models.py:186 templates/permission/all_rights.html:26
#: apps/permission/models.py:177 templates/permission/all_rights.html:26
msgid "permanent"
msgstr ""
#: apps/permission/models.py:197
#: apps/permission/models.py:188
msgid "permission"
msgstr ""
#: apps/permission/models.py:198 apps/permission/models.py:337
#: apps/permission/models.py:189 apps/permission/models.py:328
msgid "permissions"
msgstr ""
#: apps/permission/models.py:203
#: apps/permission/models.py:194
msgid "Specifying field applies only to view and change permission types."
msgstr ""
#: apps/permission/models.py:342
#: apps/permission/models.py:333
msgid "for club"
msgstr ""
#: apps/permission/models.py:352 apps/permission/models.py:353
#: apps/permission/models.py:343 apps/permission/models.py:344
msgid "role permissions"
msgstr ""
@ -1012,7 +1000,7 @@ msgid ""
"{model_name}."
msgstr ""
#: apps/permission/views.py:44 templates/base.html:136
#: apps/permission/views.py:44 templates/base.html:135
msgid "Rights"
msgstr ""
@ -1145,7 +1133,7 @@ msgstr ""
msgid "Description"
msgstr ""
#: apps/treasury/models.py:48 templates/note/transaction_form.html:121
#: apps/treasury/models.py:48 templates/note/transaction_form.html:120
msgid "Name"
msgstr ""
@ -1546,113 +1534,113 @@ msgstr ""
msgid "members"
msgstr ""
#: apps/wei/views.py:56
#: apps/wei/views.py:55
msgid "Search WEI"
msgstr ""
#: apps/wei/views.py:74 templates/wei/weiclub_list.html:10
#: apps/wei/views.py:64 templates/wei/weiclub_list.html:9
msgid "Create WEI"
msgstr ""
#: apps/wei/views.py:94
#: apps/wei/views.py:84
msgid "WEI Detail"
msgstr ""
#: apps/wei/views.py:189
#: apps/wei/views.py:179
msgid "View members of the WEI"
msgstr ""
#: apps/wei/views.py:217
#: apps/wei/views.py:207
msgid "Find WEI Membership"
msgstr ""
#: apps/wei/views.py:227
#: apps/wei/views.py:217
msgid "View registrations to the WEI"
msgstr ""
#: apps/wei/views.py:253
#: apps/wei/views.py:243
msgid "Find WEI Registration"
msgstr ""
#: apps/wei/views.py:264
#: apps/wei/views.py:254
msgid "Update the WEI"
msgstr ""
#: apps/wei/views.py:285
#: apps/wei/views.py:275
msgid "Create new bus"
msgstr ""
#: apps/wei/views.py:316
#: apps/wei/views.py:306
msgid "Update bus"
msgstr ""
#: apps/wei/views.py:346
#: apps/wei/views.py:336
msgid "Manage bus"
msgstr ""
#: apps/wei/views.py:373
#: apps/wei/views.py:363
msgid "Create new team"
msgstr ""
#: apps/wei/views.py:405
#: apps/wei/views.py:395
msgid "Update team"
msgstr ""
#: apps/wei/views.py:436
#: apps/wei/views.py:426
msgid "Manage WEI team"
msgstr ""
#: apps/wei/views.py:458
#: apps/wei/views.py:448
msgid "Register first year student to the WEI"
msgstr ""
#: apps/wei/views.py:470 templates/wei/weiclub_info.html:62
#: apps/wei/views.py:460 templates/wei/weiclub_info.html:62
msgid "Register 1A"
msgstr ""
#: apps/wei/views.py:491 apps/wei/views.py:561
#: apps/wei/views.py:481 apps/wei/views.py:551
msgid "This user is already registered to this WEI."
msgstr ""
#: apps/wei/views.py:496
#: apps/wei/views.py:486
msgid ""
"This user can't be in her/his first year since he/she has already participed "
"to a WEI."
msgstr ""
#: apps/wei/views.py:513
#: apps/wei/views.py:503
msgid "Register old student to the WEI"
msgstr ""
#: apps/wei/views.py:525 templates/wei/weiclub_info.html:65
#: apps/wei/views.py:515 templates/wei/weiclub_info.html:65
msgid "Register 2A+"
msgstr ""
#: apps/wei/views.py:543 apps/wei/views.py:631
#: apps/wei/views.py:533 apps/wei/views.py:621
msgid "You already opened an account in the Société générale."
msgstr ""
#: apps/wei/views.py:591
#: apps/wei/views.py:581
msgid "Update WEI Registration"
msgstr ""
#: apps/wei/views.py:681
#: apps/wei/views.py:671
msgid "Delete WEI registration"
msgstr ""
#: apps/wei/views.py:692
#: apps/wei/views.py:682
msgid "You don't have the right to delete this WEI registration."
msgstr ""
#: apps/wei/views.py:711
#: apps/wei/views.py:701
msgid "Validate WEI registration"
msgstr ""
#: apps/wei/views.py:792
#: apps/wei/views.py:782
msgid "This user didn't give her/his caution check."
msgstr ""
#: apps/wei/views.py:829 apps/wei/views.py:882 apps/wei/views.py:892
#: apps/wei/views.py:819 apps/wei/views.py:872 apps/wei/views.py:882
#: templates/wei/survey.html:12 templates/wei/survey_closed.html:12
#: templates/wei/survey_end.html:12
msgid "Survey WEI"
@ -1787,11 +1775,11 @@ msgstr ""
msgid "Registrations"
msgstr ""
#: templates/base.html:141
#: templates/base.html:139
msgid "Administration"
msgstr ""
#: templates/base.html:180
#: templates/base.html:178
msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link."
@ -1962,7 +1950,7 @@ msgstr ""
msgid "Double consumptions"
msgstr ""
#: templates/note/conso_form.html:150 templates/note/transaction_form.html:152
#: templates/note/conso_form.html:150 templates/note/transaction_form.html:151
msgid "Recent transactions history"
msgstr ""
@ -1986,7 +1974,7 @@ msgstr ""
msgid "Reason"
msgstr ""
#: templates/note/transaction_form.html:111
#: templates/note/transaction_form.html:110
msgid "Transfer type"
msgstr ""
@ -2034,10 +2022,6 @@ msgstr ""
msgid "Own this role in the clubs"
msgstr ""
#: templates/permission/all_rights.html:26
msgid "Mask:"
msgstr ""
#: templates/permission/all_rights.html:26
msgid "Query:"
msgstr ""
@ -2382,7 +2366,7 @@ msgstr ""
msgid "View WEI"
msgstr ""
#: templates/wei/weiclub_list.html:18
#: templates/wei/weiclub_list.html:16
msgid "WEI listing"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-31 22:25+0200\n"
"POT-Creation-Date: 2020-07-31 17:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -47,7 +47,7 @@ msgstr "Vous ne pouvez pas inviter plus de 3 personnes à cette activité."
#: apps/activity/models.py:23 apps/activity/models.py:48
#: apps/member/models.py:151 apps/note/models/notes.py:188
#: apps/note/models/transactions.py:25 apps/note/models/transactions.py:45
#: apps/note/models/transactions.py:263 apps/permission/models.py:332
#: apps/note/models/transactions.py:261 apps/permission/models.py:323
#: apps/wei/models.py:65 apps/wei/models.py:117
#: templates/member/club_info.html:13 templates/member/profile_info.html:14
#: templates/registration/future_profile_detail.html:16
@ -72,14 +72,14 @@ msgid "activity types"
msgstr "types d'activité"
#: apps/activity/models.py:53 apps/note/models/transactions.py:81
#: apps/permission/models.py:113 apps/permission/models.py:192
#: apps/permission/models.py:104 apps/permission/models.py:183
#: apps/wei/models.py:71 apps/wei/models.py:128
#: templates/activity/activity_detail.html:16
msgid "description"
msgstr "description"
#: apps/activity/models.py:60 apps/note/models/notes.py:164
#: apps/note/models/transactions.py:66 apps/permission/models.py:167
#: apps/note/models/transactions.py:66 apps/permission/models.py:158
#: templates/activity/activity_detail.html:19
msgid "type"
msgstr "type"
@ -194,7 +194,7 @@ msgstr "Nom de famille"
#: apps/activity/tables.py:79 apps/member/forms.py:107
#: apps/registration/forms.py:69 apps/treasury/forms.py:122
#: templates/note/transaction_form.html:127
#: templates/note/transaction_form.html:126
msgid "First name"
msgstr "Prénom"
@ -242,7 +242,7 @@ msgstr "Logs"
msgid "IP Address"
msgstr "Adresse IP"
#: apps/logs/models.py:35 apps/permission/models.py:137
#: apps/logs/models.py:35 apps/permission/models.py:128
msgid "model"
msgstr "Modèle"
@ -268,7 +268,7 @@ msgid "edit"
msgstr "Modifier"
#: apps/logs/models.py:62 apps/note/tables.py:138 apps/note/tables.py:166
#: apps/permission/models.py:130 apps/wei/tables.py:65
#: apps/wei/tables.py:65
msgid "delete"
msgstr "Supprimer"
@ -325,7 +325,7 @@ msgid "Credit amount"
msgstr "Montant à créditer"
#: apps/member/forms.py:112 apps/registration/forms.py:74
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:133
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
msgid "Bank"
msgstr "Banque"
@ -538,7 +538,7 @@ msgstr "l'adhésion finit le"
msgid "fee"
msgstr "cotisation"
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:797
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:787
msgid "User is not a member of the parent club"
msgstr "L'utilisateur n'est pas membre du club parent"
@ -618,7 +618,7 @@ msgstr "Modifier le club"
msgid "Add new member to the club"
msgstr "Ajouter un nouveau membre au club"
#: apps/member/views.py:529 apps/wei/views.py:788
#: apps/member/views.py:529 apps/wei/views.py:778
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
@ -837,36 +837,36 @@ msgstr ""
"La transaction ne peut pas être sauvegardée puisque la note source ou la "
"note de destination n'est pas active."
#: apps/note/models/transactions.py:230
#: apps/note/models/transactions.py:228
#: templates/activity/activity_entry.html:13 templates/base.html:99
#: templates/note/transaction_form.html:15
#: templates/note/transaction_form.html:141
#: templates/note/transaction_form.html:140
msgid "Transfer"
msgstr "Virement"
#: apps/note/models/transactions.py:253
#: apps/note/models/transactions.py:251
msgid "Template"
msgstr "Bouton"
#: apps/note/models/transactions.py:268
#: apps/note/models/transactions.py:266
msgid "first_name"
msgstr "prénom"
#: apps/note/models/transactions.py:273
#: apps/note/models/transactions.py:271
msgid "bank"
msgstr "banque"
#: apps/note/models/transactions.py:279
#: apps/note/models/transactions.py:277
#: templates/activity/activity_entry.html:17
#: templates/note/transaction_form.html:20
msgid "Credit"
msgstr "Crédit"
#: apps/note/models/transactions.py:279 templates/note/transaction_form.html:24
#: apps/note/models/transactions.py:277 templates/note/transaction_form.html:24
msgid "Debit"
msgstr "Débit"
#: apps/note/models/transactions.py:290
#: apps/note/models/transactions.py:288
msgid ""
"A special transaction is only possible between a Note associated to a "
"payment method and a User or a Club"
@ -874,11 +874,11 @@ msgstr ""
"Une transaction spéciale n'est possible que entre une note associée à un "
"mode de paiement et un utilisateur ou un club."
#: apps/note/models/transactions.py:307 apps/note/models/transactions.py:312
#: apps/note/models/transactions.py:305 apps/note/models/transactions.py:310
msgid "membership transaction"
msgstr "Transaction d'adhésion"
#: apps/note/models/transactions.py:308 apps/treasury/models.py:227
#: apps/note/models/transactions.py:306 apps/treasury/models.py:227
msgid "membership transactions"
msgstr "Transactions d'adhésion"
@ -927,53 +927,41 @@ msgstr "Modifier le bouton"
msgid "Consumptions"
msgstr "Consommations"
#: apps/permission/models.py:92
#: apps/permission/models.py:83
#, python-brace-format
msgid "Can {type} {model}.{field} in {query}"
msgstr "Can {type} {model}.{field} in {query}"
#: apps/permission/models.py:94
#: apps/permission/models.py:85
#, python-brace-format
msgid "Can {type} {model} in {query}"
msgstr "Can {type} {model} in {query}"
#: apps/permission/models.py:107
#: apps/permission/models.py:98
msgid "rank"
msgstr "Rang"
#: apps/permission/models.py:120
#: apps/permission/models.py:111
msgid "permission mask"
msgstr "masque de permissions"
#: apps/permission/models.py:121
#: apps/permission/models.py:112
msgid "permission masks"
msgstr "masques de permissions"
#: apps/permission/models.py:127
msgid "add"
msgstr "ajouter"
#: apps/permission/models.py:128
msgid "view"
msgstr "voir"
#: apps/permission/models.py:129
msgid "change"
msgstr "modifier"
#: apps/permission/models.py:161
#: apps/permission/models.py:152
msgid "query"
msgstr "requête"
#: apps/permission/models.py:174
#: apps/permission/models.py:165
msgid "mask"
msgstr "masque"
#: apps/permission/models.py:180
#: apps/permission/models.py:171
msgid "field"
msgstr "champ"
#: apps/permission/models.py:185
#: apps/permission/models.py:176
msgid ""
"Tells if the permission should be granted even if the membership of the user "
"is expired."
@ -981,29 +969,29 @@ msgstr ""
"Indique si la permission doit être attribuée même si l'adhésion de "
"l'utilisateur est expirée."
#: apps/permission/models.py:186 templates/permission/all_rights.html:26
#: apps/permission/models.py:177 templates/permission/all_rights.html:26
msgid "permanent"
msgstr "permanent"
#: apps/permission/models.py:197
#: apps/permission/models.py:188
msgid "permission"
msgstr "permission"
#: apps/permission/models.py:198 apps/permission/models.py:337
#: apps/permission/models.py:189 apps/permission/models.py:328
msgid "permissions"
msgstr "permissions"
#: apps/permission/models.py:203
#: apps/permission/models.py:194
msgid "Specifying field applies only to view and change permission types."
msgstr ""
"Spécifie le champ concerné, ne fonctionne que pour les permissions view et "
"change."
#: apps/permission/models.py:342
#: apps/permission/models.py:333
msgid "for club"
msgstr "s'applique au club"
#: apps/permission/models.py:352 apps/permission/models.py:353
#: apps/permission/models.py:343 apps/permission/models.py:344
msgid "role permissions"
msgstr "Permissions par rôles"
@ -1034,7 +1022,7 @@ msgstr ""
"Vous n'avez pas la permission de supprimer cette instance du modèle "
"{app_label}.{model_name}."
#: apps/permission/views.py:44 templates/base.html:136
#: apps/permission/views.py:44 templates/base.html:135
msgid "Rights"
msgstr "Droits"
@ -1172,7 +1160,7 @@ msgstr "Objet"
msgid "Description"
msgstr "Description"
#: apps/treasury/models.py:48 templates/note/transaction_form.html:121
#: apps/treasury/models.py:48 templates/note/transaction_form.html:120
msgid "Name"
msgstr "Nom"
@ -1590,75 +1578,75 @@ msgstr "Nombre de membres"
msgid "members"
msgstr "adhérents"
#: apps/wei/views.py:56
#: apps/wei/views.py:55
msgid "Search WEI"
msgstr "Chercher un WEI"
#: apps/wei/views.py:74 templates/wei/weiclub_list.html:10
#: apps/wei/views.py:64 templates/wei/weiclub_list.html:9
msgid "Create WEI"
msgstr "Créer un WEI"
#: apps/wei/views.py:94
#: apps/wei/views.py:84
msgid "WEI Detail"
msgstr "Détails du WEI"
#: apps/wei/views.py:189
#: apps/wei/views.py:179
msgid "View members of the WEI"
msgstr "Voir les membres du WEI"
#: apps/wei/views.py:217
#: apps/wei/views.py:207
msgid "Find WEI Membership"
msgstr "Trouver une adhésion au WEI"
#: apps/wei/views.py:227
#: apps/wei/views.py:217
msgid "View registrations to the WEI"
msgstr "Voir les inscriptions au WEI"
#: apps/wei/views.py:253
#: apps/wei/views.py:243
msgid "Find WEI Registration"
msgstr "Trouver une inscription au WEI"
#: apps/wei/views.py:264
#: apps/wei/views.py:254
msgid "Update the WEI"
msgstr "Modifier le WEI"
#: apps/wei/views.py:285
#: apps/wei/views.py:275
msgid "Create new bus"
msgstr "Ajouter un nouveau bus"
#: apps/wei/views.py:316
#: apps/wei/views.py:306
msgid "Update bus"
msgstr "Modifier le bus"
#: apps/wei/views.py:346
#: apps/wei/views.py:336
msgid "Manage bus"
msgstr "Gérer le bus"
#: apps/wei/views.py:373
#: apps/wei/views.py:363
msgid "Create new team"
msgstr "Créer une nouvelle équipe"
#: apps/wei/views.py:405
#: apps/wei/views.py:395
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/wei/views.py:436
#: apps/wei/views.py:426
msgid "Manage WEI team"
msgstr "Gérer l'équipe WEI"
#: apps/wei/views.py:458
#: apps/wei/views.py:448
msgid "Register first year student to the WEI"
msgstr "Inscrire un 1A au WEI"
#: apps/wei/views.py:470 templates/wei/weiclub_info.html:62
#: apps/wei/views.py:460 templates/wei/weiclub_info.html:62
msgid "Register 1A"
msgstr "Inscrire un 1A"
#: apps/wei/views.py:491 apps/wei/views.py:561
#: apps/wei/views.py:481 apps/wei/views.py:551
msgid "This user is already registered to this WEI."
msgstr "Cette personne est déjà inscrite au WEI."
#: apps/wei/views.py:496
#: apps/wei/views.py:486
msgid ""
"This user can't be in her/his first year since he/she has already participed "
"to a WEI."
@ -1666,39 +1654,39 @@ msgstr ""
"Cet utilisateur ne peut pas être en première année puisqu'iel a déjà "
"participé à un WEI."
#: apps/wei/views.py:513
#: apps/wei/views.py:503
msgid "Register old student to the WEI"
msgstr "Inscrire un 2A+ au WEI"
#: apps/wei/views.py:525 templates/wei/weiclub_info.html:65
#: apps/wei/views.py:515 templates/wei/weiclub_info.html:65
msgid "Register 2A+"
msgstr "Inscrire un 2A+"
#: apps/wei/views.py:543 apps/wei/views.py:631
#: apps/wei/views.py:533 apps/wei/views.py:621
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:591
#: apps/wei/views.py:581
msgid "Update WEI Registration"
msgstr "Modifier l'inscription WEI"
#: apps/wei/views.py:681
#: apps/wei/views.py:671
msgid "Delete WEI registration"
msgstr "Supprimer l'inscription WEI"
#: apps/wei/views.py:692
#: apps/wei/views.py:682
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:711
#: apps/wei/views.py:701
msgid "Validate WEI registration"
msgstr "Valider l'inscription WEI"
#: apps/wei/views.py:792
#: apps/wei/views.py:782
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:829 apps/wei/views.py:882 apps/wei/views.py:892
#: apps/wei/views.py:819 apps/wei/views.py:872 apps/wei/views.py:882
#: templates/wei/survey.html:12 templates/wei/survey_closed.html:12
#: templates/wei/survey_end.html:12
msgid "Survey WEI"
@ -1842,11 +1830,11 @@ msgstr "Clubs"
msgid "Registrations"
msgstr "Inscriptions"
#: templates/base.html:141
#: templates/base.html:139
msgid "Administration"
msgstr "Administration"
#: templates/base.html:180
#: templates/base.html:178
msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link."
@ -2022,7 +2010,7 @@ msgstr "Consommations simples"
msgid "Double consumptions"
msgstr "Consommations doubles"
#: templates/note/conso_form.html:150 templates/note/transaction_form.html:152
#: templates/note/conso_form.html:150 templates/note/transaction_form.html:151
msgid "Recent transactions history"
msgstr "Historique des transactions récentes"
@ -2046,7 +2034,7 @@ msgstr "Action"
msgid "Reason"
msgstr "Raison"
#: templates/note/transaction_form.html:111
#: templates/note/transaction_form.html:110
msgid "Transfer type"
msgstr "Type de transfert"
@ -2094,10 +2082,6 @@ msgstr "Filtrer les rôles que je possède dans au moins un club"
msgid "Own this role in the clubs"
msgstr "Possède ce rôle dans les clubs"
#: templates/permission/all_rights.html:26
msgid "Mask:"
msgstr "Masque :"
#: templates/permission/all_rights.html:26
msgid "Query:"
msgstr "Requête :"
@ -2486,7 +2470,7 @@ msgstr "Ajouter un bus"
msgid "View WEI"
msgstr "Voir le WEI"
#: templates/wei/weiclub_list.html:18
#: templates/wei/weiclub_list.html:16
msgid "WEI listing"
msgstr "Liste des WEI"

View File

@ -369,7 +369,7 @@ function de_validate(id, validated) {
},
error: function (err) {
addMsg("Une erreur est survenue lors de la validation/dévalidation " +
"de cette transaction : " + JSON.parse(err.responseText)["detail"], "danger", 10000);
"de cette transaction : " + err.responseText, "danger");
refreshBalance();
// error if this method doesn't exist. Please define it.

View File

@ -207,10 +207,10 @@ function consume(source, source_alias, dest, quantity, amount, reason, type, cat
"template": template
}).done(function() {
reset();
addMsg("La transaction n'a pas pu être validée pour cause de solde insuffisant.", "danger", 10000);
addMsg("La transaction n'a pas pu être validée pour cause de solde insuffisant.", "danger");
}).fail(function () {
reset();
errMsg(e.responseJSON, 10000);
errMsg(e.responseJSON);
});
});
}

View File

@ -14,14 +14,8 @@ function reset(refresh=true) {
dests.length = 0;
$("#source_note_list").html("");
$("#dest_note_list").html("");
let amount_field = $("#amount");
amount_field.val("");
amount_field.removeClass('is-invalid');
$("#amount-required").html("");
let reason_field = $("#reason");
reason_field.val("");
reason_field.removeClass('is-invalid');
$("#reason-required").html("");
$("#amount").val("");
$("#reason").val("");
$("#last_name").val("");
$("#first_name").val("");
$("#bank").val("");
@ -146,9 +140,7 @@ $(document).ready(function() {
$("#source_me").click(function() {
// Shortcut to set the current user as the only emitter
sources_notes_display.length = 0;
sources.length = 0;
$("#source_note_list").html("");
reset(false);
let source_note = $("#source_note");
source_note.focus();
@ -178,45 +170,15 @@ $(document).ready(function() {
});
$("#btn_transfer").click(function() {
let error = false;
let amount_field = $("#amount");
amount_field.removeClass('is-invalid');
$("#amount-required").html("");
let reason_field = $("#reason");
reason_field.removeClass('is-invalid');
$("#reason-required").html("");
if (!amount_field.val() || isNaN(amount_field.val()) || amount_field.val() <= 0) {
amount_field.addClass('is-invalid');
$("#amount-required").html("<strong>Ce champ est requis et doit comporter un nombre décimal strictement positif.</strong>");
error = true;
}
if (!reason_field.val()) {
reason_field.addClass('is-invalid');
$("#reason-required").html("<strong>Ce champ est requis.</strong>");
error = true;
}
if (error)
return;
let amount = 100 * amount_field.val();
let reason = reason_field.val();
if ($("#type_transfer").is(':checked')) {
// We copy the arrays to ensure that transactions are well-processed even if the form is reset
[...sources_notes_display].forEach(function (source) {
[...dests_notes_display].forEach(function (dest) {
sources_notes_display.forEach(function (source) {
dests_notes_display.forEach(function (dest) {
$.post("/api/note/transaction/transaction/",
{
"csrfmiddlewaretoken": CSRF_TOKEN,
"quantity": source.quantity * dest.quantity,
"amount": amount,
"reason": reason,
"amount": 100 * $("#amount").val(),
"reason": $("#reason").val(),
"valid": true,
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "Transaction",
@ -226,8 +188,8 @@ $("#btn_transfer").click(function() {
"destination_alias": dest.name
}).done(function () {
addMsg("Le transfert de "
+ pretty_money(source.quantity * dest.quantity * amount) + " de la note " + source.name
+ " vers la note " + dest.name + " a été fait avec succès !", "success", 10000);
+ pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name
+ " vers la note " + dest.name + " a été fait avec succès !", "success");
reset();
}).fail(function (err) { // do it again but valid = false
@ -235,8 +197,8 @@ $("#btn_transfer").click(function() {
{
"csrfmiddlewaretoken": CSRF_TOKEN,
"quantity": source.quantity * dest.quantity,
"amount": amount,
"reason": reason,
"amount": 100 * $("#amount").val(),
"reason": $("#reason").val(),
"valid": false,
"invalidity_reason": "Solde insuffisant",
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
@ -247,12 +209,16 @@ $("#btn_transfer").click(function() {
"destination_alias": dest.name
}).done(function () {
addMsg("Le transfert de "
+ pretty_money(source.quantity * dest.quantity * amount) + " de la note " + source.name
+ " vers la note " + dest.name + " a échoué : Solde insuffisant", "danger", 10000);
+ pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name
+ " vers la note " + dest.name + " a échoué : Solde insuffisant", "danger");
reset();
}).fail(function (err) {
addMsg("Le transfert de "
+ pretty_money(source.quantity * dest.quantity * amount) + " de la note " + source.name
+ pretty_money(source.quantity * dest.quantity * 100 * $("#amount").val()) + " de la note " + source.name
+ " vers la note " + dest.name + " a échoué : " + err.responseText, "danger");
reset();
});
});
});
@ -260,7 +226,7 @@ $("#btn_transfer").click(function() {
} else if ($("#type_credit").is(':checked') || $("#type_debit").is(':checked')) {
let special_note = $("#credit_type").val();
let user_note;
let given_reason = reason;
let given_reason = $("#reason").val();
let source, dest, reason;
if ($("#type_credit").is(':checked')) {
user_note = dests_notes_display[0].note.id;
@ -282,7 +248,7 @@ $("#btn_transfer").click(function() {
{
"csrfmiddlewaretoken": CSRF_TOKEN,
"quantity": 1,
"amount": amount,
"amount": 100 * $("#amount").val(),
"reason": reason,
"valid": true,
"polymorphic_ctype": SPECIAL_TRANSFER_POLYMORPHIC_CTYPE,
@ -295,10 +261,11 @@ $("#btn_transfer").click(function() {
"first_name": $("#first_name").val(),
"bank": $("#bank").val()
}).done(function () {
addMsg("Le crédit/retrait a bien été effectué !", "success", 10000);
addMsg("Le crédit/retrait a bien été effectué !", "success");
reset();
}).fail(function (err) {
addMsg("Le crédit/retrait a échoué : " + JSON.parse(err.responseText)["detail"], "danger", 10000);
addMsg("Le crédit/retrait a échoué : " + err.responseText, "danger");
reset();
});
}
});

View File

@ -131,11 +131,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
<a class="nav-link" href="{% url 'wei:current_wei_detail' %}"><i class="fas fa-bus"></i> {% trans 'WEI' %}</a>
</li>
{% endif %}
{% if user.is_authenticated %}
<li class="nav-item active">
<a class="nav-link" href="{% url 'permission:rights' %}"><i class="fas fa-balance-scale"></i> {% trans 'Rights' %}</a>
</li>
{% endif %}
<li class="nav-item active">
<a class="nav-link" href="{% url 'permission:rights' %}"><i class="fas fa-balance-scale"></i> {% trans 'Rights' %}</a>
</li>
{% if user.is_staff and ""|has_perm:user %}
<li class="nav-item active">
<a data-turbolinks="false" class="nav-link" href="{% url 'admin:index' %}"><i class="fas fa-user-cog"></i> {% trans 'Administration' %}</a>

View File

@ -8,5 +8,4 @@
<div class="input-group-append">
<span class="input-group-text"></span>
</div>
<p id="amount-required" class="invalid-feedback"></p>
</div>

View File

@ -161,8 +161,8 @@
{% if button.display %}
$("#highlighted_button{{ button.id }}").click(function() {
addConso({{ button.destination_id }}, {{ button.amount }},
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
{{ button.id }}, "{{ button.name|escapejs }}");
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name }}",
{{ button.id }}, "{{ button.name }}");
});
{% endif %}
{% endfor %}
@ -172,8 +172,8 @@
{% if button.display %}
$("#button{{ button.id }}").click(function() {
addConso({{ button.destination_id }}, {{ button.amount }},
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
{{ button.id }}, "{{ button.name|escapejs }}");
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name }}",
{{ button.id }}, "{{ button.name }}");
});
{% endif %}
{% endfor %}

View File

@ -100,8 +100,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="form-row">
<div class="col-md-12">
<label for="reason">{% trans "Reason" %} :</label>
<input class="form-control mx-auto d-block" type="text" id="reason" />
<p id="reason-required" class="invalid-feedback"></p>
<input class="form-control mx-auto d-block" type="text" id="reason" required />
</div>
</div>
@ -161,7 +160,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
TRANSFER_POLYMORPHIC_CTYPE = {{ polymorphic_ctype }};
SPECIAL_TRANSFER_POLYMORPHIC_CTYPE = {{ special_polymorphic_ctype }};
user_id = {{ user.note.pk }};
username = "{{ user.username|escapejs }}";
username = "{{ user.username }}";
</script>
<script src="/static/js/transfer.js"></script>
{% endblock %}

View File

@ -23,7 +23,7 @@
{% endif %}
<ul>
{% for permission in role.permissions.all %}
<li data-toggle="tooltip" title="{% trans "Mask:" %} {{ permission.mask }}, {% trans "Query:" %} {{ permission.query }}">{{ permission }} ({{ permission.get_type_display }} {{ permission.model }}{% if permission.permanent %}, {% trans "permanent" %}{% endif %})</li>
<li data-toggle="tooltip" title="{% trans "Query:" %} {{ permission.query }}">{{ permission }} ({{ permission.type }} {{ permission.model }}{% if permission.permanent %}, {% trans "permanent" %}{% endif %})</li>
{% empty %}
<em>{% trans "No associated permission" %}</em>
{% endfor %}