diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js
index 1bdeef8e..0e2bad18 100644
--- a/kfet/static/kfet/js/kfet.js
+++ b/kfet/static/kfet/js/kfet.js
@@ -65,8 +65,11 @@ function getErrorsHtml(data) {
content += '
'+data['errors']['missing_perms'][i]+'';
content += '';
}
- if ('negative' in data['errors'])
- content += 'Autorisation de négatif requise';
+ if ('negative' in data['errors']) {
+ for (var i=0; iAutorisation de négatif requise pour '+data['errors']['negative'][i]+'';
+ }
+ }
if ('addcost' in data['errors']) {
content += '';
if (data['errors']['addcost'].indexOf('__all__') != -1)
diff --git a/kfet/views.py b/kfet/views.py
index a2da8a7b..987fd3de 100644
--- a/kfet/views.py
+++ b/kfet/views.py
@@ -897,7 +897,7 @@ def kpsul_perform_operations(request):
if missing_perms:
data['errors']['missing_perms'] = missing_perms
if stop:
- data['errors']['negative'] = True
+ data['errors']['negative'] = [operationgroup.on_acc.trigramme]
return JsonResponse(data, status=403)
# If 1 perm is required, filling who perform the operations
@@ -1088,19 +1088,22 @@ def kpsul_cancel_operations(request):
data['warnings']['already_canceled'] = opes_already_canceled
return JsonResponse(data)
+ negative_accounts = []
# Checking permissions or stop
for account in to_accounts_balances:
(perms, stop) = account.perms_to_perform_operation(
amount = to_accounts_balances[account])
required_perms |= perms
stop_all = stop_all or stop
+ if stop:
+ negative_accounts.append(account.trigramme)
if stop_all or not request.user.has_perms(required_perms):
missing_perms = get_missing_perms(required_perms, request.user)
if missing_perms:
data['errors']['missing_perms'] = missing_perms
if stop_all:
- data['errors']['negative'] = True
+ data['errors']['negative'] = negative_accounts
return JsonResponse(data, status=403)
canceled_by = required_perms and request.user.profile.account_kfet or None
@@ -1322,19 +1325,22 @@ def perform_transfers(request):
stop_all = False
+ negative_accounts = []
# Checking if ok on all accounts
for account in to_accounts_balances:
(perms, stop) = account.perms_to_perform_operation(
amount = to_accounts_balances[account])
required_perms |= perms
stop_all = stop_all or stop
+ if stop:
+ negative_accounts.append(account.trigramme)
if stop_all or not request.user.has_perms(required_perms):
missing_perms = get_missing_perms(required_perms, request.user)
if missing_perms:
data['errors']['missing_perms'] = missing_perms
if stop_all:
- data['errors']['negative'] = True
+ data['errors']['negative'] = negative_accounts
return JsonResponse(data, status=403)
# Creating transfer group