1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

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) 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,7 +4,6 @@
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
@ -45,14 +44,6 @@ 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)
@ -124,10 +115,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,7 +17,6 @@ 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 _
@ -57,11 +56,7 @@ 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 22:25+0200\n" "POT-Creation-Date: 2020-07-31 17:00+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: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 #: 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: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 #: 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:167 #: apps/note/models/transactions.py:66 apps/permission/models.py:158
#: 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:127 #: templates/note/transaction_form.html:126
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:137 #: apps/logs/models.py:35 apps/permission/models.py:128
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/permission/models.py:130 apps/wei/tables.py:65 #: 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:133 #: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
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: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" 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:788 #: apps/member/views.py:529 apps/wei/views.py:778
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:230 #: apps/note/models/transactions.py:228
#: 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:141 #: templates/note/transaction_form.html:140
msgid "Transfer" msgid "Transfer"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:253 #: apps/note/models/transactions.py:251
msgid "Template" msgid "Template"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:268 #: apps/note/models/transactions.py:266
msgid "first_name" msgid "first_name"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:273 #: apps/note/models/transactions.py:271
msgid "bank" msgid "bank"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:279 #: apps/note/models/transactions.py:277
#: 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:279 templates/note/transaction_form.html:24 #: apps/note/models/transactions.py:277 templates/note/transaction_form.html:24
msgid "Debit" msgid "Debit"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:290 #: apps/note/models/transactions.py:288
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:307 apps/note/models/transactions.py:312 #: apps/note/models/transactions.py:305 apps/note/models/transactions.py:310
msgid "membership transaction" msgid "membership transaction"
msgstr "" 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" msgid "membership transactions"
msgstr "" msgstr ""
@ -915,79 +915,67 @@ msgstr ""
msgid "Consumptions" msgid "Consumptions"
msgstr "" msgstr ""
#: apps/permission/models.py:92 #: apps/permission/models.py:83
#, 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:94 #: apps/permission/models.py:85
#, python-brace-format #, python-brace-format
msgid "Can {type} {model} in {query}" msgid "Can {type} {model} in {query}"
msgstr "" msgstr ""
#: apps/permission/models.py:107 #: apps/permission/models.py:98
msgid "rank" msgid "rank"
msgstr "" msgstr ""
#: apps/permission/models.py:120 #: apps/permission/models.py:111
msgid "permission mask" msgid "permission mask"
msgstr "" msgstr ""
#: apps/permission/models.py:121 #: apps/permission/models.py:112
msgid "permission masks" msgid "permission masks"
msgstr "" msgstr ""
#: apps/permission/models.py:127 #: apps/permission/models.py:152
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:174 #: apps/permission/models.py:165
msgid "mask" msgid "mask"
msgstr "" msgstr ""
#: apps/permission/models.py:180 #: apps/permission/models.py:171
msgid "field" msgid "field"
msgstr "" msgstr ""
#: apps/permission/models.py:185 #: apps/permission/models.py:176
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:186 templates/permission/all_rights.html:26 #: apps/permission/models.py:177 templates/permission/all_rights.html:26
msgid "permanent" msgid "permanent"
msgstr "" msgstr ""
#: apps/permission/models.py:197 #: apps/permission/models.py:188
msgid "permission" msgid "permission"
msgstr "" msgstr ""
#: apps/permission/models.py:198 apps/permission/models.py:337 #: apps/permission/models.py:189 apps/permission/models.py:328
msgid "permissions" msgid "permissions"
msgstr "" msgstr ""
#: apps/permission/models.py:203 #: apps/permission/models.py:194
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:342 #: apps/permission/models.py:333
msgid "for club" msgid "for club"
msgstr "" msgstr ""
#: apps/permission/models.py:352 apps/permission/models.py:353 #: apps/permission/models.py:343 apps/permission/models.py:344
msgid "role permissions" msgid "role permissions"
msgstr "" msgstr ""
@ -1012,7 +1000,7 @@ msgid ""
"{model_name}." "{model_name}."
msgstr "" msgstr ""
#: apps/permission/views.py:44 templates/base.html:136 #: apps/permission/views.py:44 templates/base.html:135
msgid "Rights" msgid "Rights"
msgstr "" msgstr ""
@ -1145,7 +1133,7 @@ msgstr ""
msgid "Description" msgid "Description"
msgstr "" 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" msgid "Name"
msgstr "" msgstr ""
@ -1546,113 +1534,113 @@ msgstr ""
msgid "members" msgid "members"
msgstr "" msgstr ""
#: apps/wei/views.py:56 #: apps/wei/views.py:55
msgid "Search WEI" msgid "Search WEI"
msgstr "" 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" msgid "Create WEI"
msgstr "" msgstr ""
#: apps/wei/views.py:94 #: apps/wei/views.py:84
msgid "WEI Detail" msgid "WEI Detail"
msgstr "" msgstr ""
#: apps/wei/views.py:189 #: apps/wei/views.py:179
msgid "View members of the WEI" msgid "View members of the WEI"
msgstr "" msgstr ""
#: apps/wei/views.py:217 #: apps/wei/views.py:207
msgid "Find WEI Membership" msgid "Find WEI Membership"
msgstr "" msgstr ""
#: apps/wei/views.py:227 #: apps/wei/views.py:217
msgid "View registrations to the WEI" msgid "View registrations to the WEI"
msgstr "" msgstr ""
#: apps/wei/views.py:253 #: apps/wei/views.py:243
msgid "Find WEI Registration" msgid "Find WEI Registration"
msgstr "" msgstr ""
#: apps/wei/views.py:264 #: apps/wei/views.py:254
msgid "Update the WEI" msgid "Update the WEI"
msgstr "" msgstr ""
#: apps/wei/views.py:285 #: apps/wei/views.py:275
msgid "Create new bus" msgid "Create new bus"
msgstr "" msgstr ""
#: apps/wei/views.py:316 #: apps/wei/views.py:306
msgid "Update bus" msgid "Update bus"
msgstr "" msgstr ""
#: apps/wei/views.py:346 #: apps/wei/views.py:336
msgid "Manage bus" msgid "Manage bus"
msgstr "" msgstr ""
#: apps/wei/views.py:373 #: apps/wei/views.py:363
msgid "Create new team" msgid "Create new team"
msgstr "" msgstr ""
#: apps/wei/views.py:405 #: apps/wei/views.py:395
msgid "Update team" msgid "Update team"
msgstr "" msgstr ""
#: apps/wei/views.py:436 #: apps/wei/views.py:426
msgid "Manage WEI team" msgid "Manage WEI team"
msgstr "" msgstr ""
#: apps/wei/views.py:458 #: apps/wei/views.py:448
msgid "Register first year student to the WEI" msgid "Register first year student to the WEI"
msgstr "" 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" msgid "Register 1A"
msgstr "" 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." msgid "This user is already registered to this WEI."
msgstr "" msgstr ""
#: apps/wei/views.py:496 #: apps/wei/views.py:486
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:513 #: apps/wei/views.py:503
msgid "Register old student to the WEI" msgid "Register old student to the WEI"
msgstr "" 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+" msgid "Register 2A+"
msgstr "" 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." msgid "You already opened an account in the Société générale."
msgstr "" msgstr ""
#: apps/wei/views.py:591 #: apps/wei/views.py:581
msgid "Update WEI Registration" msgid "Update WEI Registration"
msgstr "" msgstr ""
#: apps/wei/views.py:681 #: apps/wei/views.py:671
msgid "Delete WEI registration" msgid "Delete WEI registration"
msgstr "" msgstr ""
#: apps/wei/views.py:692 #: apps/wei/views.py:682
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:711 #: apps/wei/views.py:701
msgid "Validate WEI registration" msgid "Validate WEI registration"
msgstr "" msgstr ""
#: apps/wei/views.py:792 #: apps/wei/views.py:782
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: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.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"
@ -1787,11 +1775,11 @@ msgstr ""
msgid "Registrations" msgid "Registrations"
msgstr "" msgstr ""
#: templates/base.html:141 #: templates/base.html:139
msgid "Administration" msgid "Administration"
msgstr "" msgstr ""
#: templates/base.html:180 #: templates/base.html:178
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."
@ -1962,7 +1950,7 @@ msgstr ""
msgid "Double consumptions" msgid "Double consumptions"
msgstr "" 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" msgid "Recent transactions history"
msgstr "" msgstr ""
@ -1986,7 +1974,7 @@ msgstr ""
msgid "Reason" msgid "Reason"
msgstr "" msgstr ""
#: templates/note/transaction_form.html:111 #: templates/note/transaction_form.html:110
msgid "Transfer type" msgid "Transfer type"
msgstr "" msgstr ""
@ -2034,10 +2022,6 @@ 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 ""
@ -2382,7 +2366,7 @@ msgstr ""
msgid "View WEI" msgid "View WEI"
msgstr "" msgstr ""
#: templates/wei/weiclub_list.html:18 #: templates/wei/weiclub_list.html:16
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 22:25+0200\n" "POT-Creation-Date: 2020-07-31 17:00+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: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 #: 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: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 #: 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:167 #: apps/note/models/transactions.py:66 apps/permission/models.py:158
#: 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:127 #: templates/note/transaction_form.html:126
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:137 #: apps/logs/models.py:35 apps/permission/models.py:128
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/permission/models.py:130 apps/wei/tables.py:65 #: 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:133 #: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
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: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" 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:788 #: apps/member/views.py:529 apps/wei/views.py:778
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:230 #: apps/note/models/transactions.py:228
#: 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:141 #: templates/note/transaction_form.html:140
msgid "Transfer" msgid "Transfer"
msgstr "Virement" msgstr "Virement"
#: apps/note/models/transactions.py:253 #: apps/note/models/transactions.py:251
msgid "Template" msgid "Template"
msgstr "Bouton" msgstr "Bouton"
#: apps/note/models/transactions.py:268 #: apps/note/models/transactions.py:266
msgid "first_name" msgid "first_name"
msgstr "prénom" msgstr "prénom"
#: apps/note/models/transactions.py:273 #: apps/note/models/transactions.py:271
msgid "bank" msgid "bank"
msgstr "banque" msgstr "banque"
#: apps/note/models/transactions.py:279 #: apps/note/models/transactions.py:277
#: 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:279 templates/note/transaction_form.html:24 #: apps/note/models/transactions.py:277 templates/note/transaction_form.html:24
msgid "Debit" msgid "Debit"
msgstr "Débit" msgstr "Débit"
#: apps/note/models/transactions.py:290 #: apps/note/models/transactions.py:288
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:307 apps/note/models/transactions.py:312 #: apps/note/models/transactions.py:305 apps/note/models/transactions.py:310
msgid "membership transaction" msgid "membership transaction"
msgstr "Transaction d'adhésion" 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" msgid "membership transactions"
msgstr "Transactions d'adhésion" msgstr "Transactions d'adhésion"
@ -927,53 +927,41 @@ msgstr "Modifier le bouton"
msgid "Consumptions" msgid "Consumptions"
msgstr "Consommations" msgstr "Consommations"
#: apps/permission/models.py:92 #: apps/permission/models.py:83
#, 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:94 #: apps/permission/models.py:85
#, 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:107 #: apps/permission/models.py:98
msgid "rank" msgid "rank"
msgstr "Rang" msgstr "Rang"
#: apps/permission/models.py:120 #: apps/permission/models.py:111
msgid "permission mask" msgid "permission mask"
msgstr "masque de permissions" msgstr "masque de permissions"
#: apps/permission/models.py:121 #: apps/permission/models.py:112
msgid "permission masks" msgid "permission masks"
msgstr "masques de permissions" msgstr "masques de permissions"
#: apps/permission/models.py:127 #: apps/permission/models.py:152
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:174 #: apps/permission/models.py:165
msgid "mask" msgid "mask"
msgstr "masque" msgstr "masque"
#: apps/permission/models.py:180 #: apps/permission/models.py:171
msgid "field" msgid "field"
msgstr "champ" msgstr "champ"
#: apps/permission/models.py:185 #: apps/permission/models.py:176
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."
@ -981,29 +969,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:186 templates/permission/all_rights.html:26 #: apps/permission/models.py:177 templates/permission/all_rights.html:26
msgid "permanent" msgid "permanent"
msgstr "permanent" msgstr "permanent"
#: apps/permission/models.py:197 #: apps/permission/models.py:188
msgid "permission" msgid "permission"
msgstr "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" msgid "permissions"
msgstr "permissions" msgstr "permissions"
#: apps/permission/models.py:203 #: apps/permission/models.py:194
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:342 #: apps/permission/models.py:333
msgid "for club" msgid "for club"
msgstr "s'applique au 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" msgid "role permissions"
msgstr "Permissions par rôles" msgstr "Permissions par rôles"
@ -1034,7 +1022,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:136 #: apps/permission/views.py:44 templates/base.html:135
msgid "Rights" msgid "Rights"
msgstr "Droits" msgstr "Droits"
@ -1172,7 +1160,7 @@ msgstr "Objet"
msgid "Description" msgid "Description"
msgstr "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" msgid "Name"
msgstr "Nom" msgstr "Nom"
@ -1590,75 +1578,75 @@ msgstr "Nombre de membres"
msgid "members" msgid "members"
msgstr "adhérents" msgstr "adhérents"
#: apps/wei/views.py:56 #: apps/wei/views.py:55
msgid "Search WEI" msgid "Search WEI"
msgstr "Chercher un 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" msgid "Create WEI"
msgstr "Créer un WEI" msgstr "Créer un WEI"
#: apps/wei/views.py:94 #: apps/wei/views.py:84
msgid "WEI Detail" msgid "WEI Detail"
msgstr "Détails du WEI" msgstr "Détails du WEI"
#: apps/wei/views.py:189 #: apps/wei/views.py:179
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:217 #: apps/wei/views.py:207
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:227 #: apps/wei/views.py:217
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:253 #: apps/wei/views.py:243
msgid "Find WEI Registration" msgid "Find WEI Registration"
msgstr "Trouver une inscription au WEI" msgstr "Trouver une inscription au WEI"
#: apps/wei/views.py:264 #: apps/wei/views.py:254
msgid "Update the WEI" msgid "Update the WEI"
msgstr "Modifier le WEI" msgstr "Modifier le WEI"
#: apps/wei/views.py:285 #: apps/wei/views.py:275
msgid "Create new bus" msgid "Create new bus"
msgstr "Ajouter un nouveau bus" msgstr "Ajouter un nouveau bus"
#: apps/wei/views.py:316 #: apps/wei/views.py:306
msgid "Update bus" msgid "Update bus"
msgstr "Modifier le bus" msgstr "Modifier le bus"
#: apps/wei/views.py:346 #: apps/wei/views.py:336
msgid "Manage bus" msgid "Manage bus"
msgstr "Gérer le bus" msgstr "Gérer le bus"
#: apps/wei/views.py:373 #: apps/wei/views.py:363
msgid "Create new team" msgid "Create new team"
msgstr "Créer une nouvelle équipe" msgstr "Créer une nouvelle équipe"
#: apps/wei/views.py:405 #: apps/wei/views.py:395
msgid "Update team" msgid "Update team"
msgstr "Modifier l'équipe" msgstr "Modifier l'équipe"
#: apps/wei/views.py:436 #: apps/wei/views.py:426
msgid "Manage WEI team" msgid "Manage WEI team"
msgstr "Gérer l'équipe WEI" msgstr "Gérer l'équipe WEI"
#: apps/wei/views.py:458 #: apps/wei/views.py:448
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:470 templates/wei/weiclub_info.html:62 #: apps/wei/views.py:460 templates/wei/weiclub_info.html:62
msgid "Register 1A" msgid "Register 1A"
msgstr "Inscrire un 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." 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:496 #: apps/wei/views.py:486
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."
@ -1666,39 +1654,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:513 #: apps/wei/views.py:503
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:525 templates/wei/weiclub_info.html:65 #: apps/wei/views.py:515 templates/wei/weiclub_info.html:65
msgid "Register 2A+" msgid "Register 2A+"
msgstr "Inscrire un 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." 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:591 #: apps/wei/views.py:581
msgid "Update WEI Registration" msgid "Update WEI Registration"
msgstr "Modifier l'inscription WEI" msgstr "Modifier l'inscription WEI"
#: apps/wei/views.py:681 #: apps/wei/views.py:671
msgid "Delete WEI registration" msgid "Delete WEI registration"
msgstr "Supprimer l'inscription WEI" 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." 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:711 #: apps/wei/views.py:701
msgid "Validate WEI registration" msgid "Validate WEI registration"
msgstr "Valider l'inscription WEI" 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." 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: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.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"
@ -1842,11 +1830,11 @@ msgstr "Clubs"
msgid "Registrations" msgid "Registrations"
msgstr "Inscriptions" msgstr "Inscriptions"
#: templates/base.html:141 #: templates/base.html:139
msgid "Administration" msgid "Administration"
msgstr "Administration" msgstr "Administration"
#: templates/base.html:180 #: templates/base.html:178
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."
@ -2022,7 +2010,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:152 #: templates/note/conso_form.html:150 templates/note/transaction_form.html:151
msgid "Recent transactions history" msgid "Recent transactions history"
msgstr "Historique des transactions récentes" msgstr "Historique des transactions récentes"
@ -2046,7 +2034,7 @@ msgstr "Action"
msgid "Reason" msgid "Reason"
msgstr "Raison" msgstr "Raison"
#: templates/note/transaction_form.html:111 #: templates/note/transaction_form.html:110
msgid "Transfer type" msgid "Transfer type"
msgstr "Type de transfert" 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" 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 :"
@ -2486,7 +2470,7 @@ msgstr "Ajouter un bus"
msgid "View WEI" msgid "View WEI"
msgstr "Voir le WEI" msgstr "Voir le WEI"
#: templates/wei/weiclub_list.html:18 #: templates/wei/weiclub_list.html:16
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 : " + JSON.parse(err.responseText)["detail"], "danger", 10000); "de cette transaction : " + err.responseText, "danger");
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", 10000); addMsg("La transaction n'a pas pu être validée pour cause de solde insuffisant.", "danger");
}).fail(function () { }).fail(function () {
reset(); reset();
errMsg(e.responseJSON, 10000); errMsg(e.responseJSON);
}); });
}); });
} }

View File

@ -14,14 +14,8 @@ 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("");
let amount_field = $("#amount"); $("#amount").val("");
amount_field.val(""); $("#reason").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("");
@ -146,9 +140,7 @@ $(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
sources_notes_display.length = 0; reset(false);
sources.length = 0;
$("#source_note_list").html("");
let source_note = $("#source_note"); let source_note = $("#source_note");
source_note.focus(); source_note.focus();
@ -178,45 +170,15 @@ $(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) {
// We copy the arrays to ensure that transactions are well-processed even if the form is reset dests_notes_display.forEach(function (dest) {
[...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": amount, "amount": 100 * $("#amount").val(),
"reason": reason, "reason": $("#reason").val(),
"valid": true, "valid": true,
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
"resourcetype": "Transaction", "resourcetype": "Transaction",
@ -226,8 +188,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 * 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 été fait avec succès !", "success", 10000); + " vers la note " + dest.name + " a été fait avec succès !", "success");
reset(); reset();
}).fail(function (err) { // do it again but valid = false }).fail(function (err) { // do it again but valid = false
@ -235,8 +197,8 @@ $("#btn_transfer").click(function() {
{ {
"csrfmiddlewaretoken": CSRF_TOKEN, "csrfmiddlewaretoken": CSRF_TOKEN,
"quantity": source.quantity * dest.quantity, "quantity": source.quantity * dest.quantity,
"amount": amount, "amount": 100 * $("#amount").val(),
"reason": reason, "reason": $("#reason").val(),
"valid": false, "valid": false,
"invalidity_reason": "Solde insuffisant", "invalidity_reason": "Solde insuffisant",
"polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": TRANSFER_POLYMORPHIC_CTYPE,
@ -247,12 +209,16 @@ $("#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 * 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é : Solde insuffisant", "danger", 10000); + " vers la note " + dest.name + " a échoué : Solde insuffisant", "danger");
reset();
}).fail(function (err) { }).fail(function (err) {
addMsg("Le transfert de " 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"); + " 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')) { } 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; let given_reason = $("#reason").val();
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;
@ -282,7 +248,7 @@ $("#btn_transfer").click(function() {
{ {
"csrfmiddlewaretoken": CSRF_TOKEN, "csrfmiddlewaretoken": CSRF_TOKEN,
"quantity": 1, "quantity": 1,
"amount": amount, "amount": 100 * $("#amount").val(),
"reason": reason, "reason": reason,
"valid": true, "valid": true,
"polymorphic_ctype": SPECIAL_TRANSFER_POLYMORPHIC_CTYPE, "polymorphic_ctype": SPECIAL_TRANSFER_POLYMORPHIC_CTYPE,
@ -295,10 +261,11 @@ $("#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", 10000); addMsg("Le crédit/retrait a bien été effectué !", "success");
reset(); reset();
}).fail(function (err) { }).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> <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,5 +8,4 @@
<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|escapejs }}", {{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name }}",
{{ button.id }}, "{{ button.name|escapejs }}"); {{ button.id }}, "{{ button.name }}");
}); });
{% 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|escapejs }}", {{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name }}",
{{ button.id }}, "{{ button.name|escapejs }}"); {{ button.id }}, "{{ button.name }}");
}); });
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -100,8 +100,7 @@ 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" /> <input class="form-control mx-auto d-block" type="text" id="reason" required />
<p id="reason-required" class="invalid-feedback"></p>
</div> </div>
</div> </div>
@ -161,7 +160,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|escapejs }}"; username = "{{ user.username }}";
</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 "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 %} {% empty %}
<em>{% trans "No associated permission" %}</em> <em>{% trans "No associated permission" %}</em>
{% endfor %} {% endfor %}