Compare commits

..

4 Commits

Author SHA1 Message Date
Yohann D'ANELLO d7b834d908 Translate rights 2020-07-31 22:29:23 +02:00
Yohann D'ANELLO dca655949e Improve transfer UI 2020-07-31 21:24:23 +02:00
Yohann D'ANELLO 932a546213 Better error messages 2020-07-31 19:43:03 +02:00
Yohann D'ANELLO d8127e8936 Escape strings 2020-07-31 19:00:19 +02:00
14 changed files with 440 additions and 403 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@
import functools import functools
import json import json
import operator import operator
from time import sleep
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@ -44,6 +45,14 @@ class InstancedPermission:
else: else:
oldpk = obj.pk oldpk = obj.pk
# Ensure previous models are deleted # 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(): for o in self.model.model_class().objects.filter(pk=obj.pk).all():
o._force_delete = True o._force_delete = True
Model.delete(o) Model.delete(o)
@ -115,10 +124,10 @@ class PermissionMask(models.Model):
class Permission(models.Model): class Permission(models.Model):
PERMISSION_TYPES = [ PERMISSION_TYPES = [
('add', 'add'), ('add', _('add')),
('view', 'view'), ('view', _('view')),
('change', 'change'), ('change', _('change')),
('delete', 'delete') ('delete', _('delete'))
] ]
model = models.ForeignKey( model = models.ForeignKey(

View File

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

View File

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

View File

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

View File

@ -369,7 +369,7 @@ function de_validate(id, validated) {
}, },
error: function (err) { error: function (err) {
addMsg("Une erreur est survenue lors de la validation/dévalidation " + addMsg("Une erreur est survenue lors de la validation/dévalidation " +
"de cette transaction : " + err.responseText, "danger"); "de cette transaction : " + JSON.parse(err.responseText)["detail"], "danger", 10000);
refreshBalance(); refreshBalance();
// error if this method doesn't exist. Please define it. // 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 "template": template
}).done(function() { }).done(function() {
reset(); reset();
addMsg("La transaction n'a pas pu être validée pour cause de solde insuffisant.", "danger"); addMsg("La transaction n'a pas pu être validée pour cause de solde insuffisant.", "danger", 10000);
}).fail(function () { }).fail(function () {
reset(); reset();
errMsg(e.responseJSON); errMsg(e.responseJSON, 10000);
}); });
}); });
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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