From 01edf1f6886b2d4d2dd7bed597b9af979811694f Mon Sep 17 00:00:00 2001 From: imperosol Date: Tue, 27 Oct 2026 23:28:34 +0100 Subject: [PATCH] more precise error messages when searching users for click --- counter/forms.py | 8 +++++++- locale/fr/LC_MESSAGES/django.po | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/counter/forms.py b/counter/forms.py index 877c0e79..d80466e8 100644 --- a/counter/forms.py +++ b/counter/forms.py @@ -130,8 +130,14 @@ class GetUserForm(forms.Form): elif cleaned_data["id"]: customer = Customer.objects.filter(user=cleaned_data["id"]).first() - if customer is None or not customer.can_buy: + if customer is None: raise forms.ValidationError(_("User not found")) + if not customer.can_buy: + raise forms.ValidationError(_("This user cannot buy items on counters.")) + if customer.user.is_banned_counter: + raise forms.ValidationError( + _("This user is banned from AE places. Take him/her out if you can.") + ) cleaned_data["user_id"] = customer.user_id cleaned_data["user"] = customer.user return cleaned_data diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 133b4895..23011456 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-25 12:04+0100\n" +"POT-Creation-Date: 2026-10-27 23:26+0100\n" "PO-Revision-Date: 2016-07-18\n" "Last-Translator: Maréchal \n" @@ -3275,6 +3275,10 @@ msgstr "Erreur d'envoi du fichier %(file_name)s : %(msg)s" msgid "Apply rights recursively" msgstr "Appliquer les droits récursivement" +#: core/views/files.py +msgid "You cannot move this file there" +msgstr "Vous ne pouvez pas déplacer ce fichier là" + #: core/views/forms.py msgid "Ensure this timestamp is set in the future" msgstr "Assurez-vous que cet horodatage est dans le futur" @@ -3388,6 +3392,14 @@ msgstr "Cet UID est invalide" msgid "User not found" msgstr "Utilisateur non trouvé" +#: counter/forms.py +msgid "This user cannot buy items on counters." +msgstr "Cet utilisateur ne peut pas faire d'achats sur les comptoirs." + +#: counter/forms.py +msgid "This user is banned from AE places. Take him/her out if you can." +msgstr "Cette personne est ban comptoir. Faites-la sortir si vous le pouvez." + #: counter/forms.py msgid "You are not a barman of this counter." msgstr "Vous n'êtes pas barman sur ce comptoir." @@ -6114,7 +6126,8 @@ msgstr "Rendre cet emploi du temps publique" msgid "" "You can change this at any time in your preferences" msgstr "" -"Vous pouvez changer ceci n'importe quand dans vos préférences" +"Vous pouvez changer ceci n'importe quand dans vos " +"préférences" #: timetable/templates/timetable/generator.jinja msgid "Save timetable"