diff --git a/gestioasso/settings/cof_prod.py b/gestioasso/settings/cof_prod.py index 4089f8cf..280dab3f 100644 --- a/gestioasso/settings/cof_prod.py +++ b/gestioasso/settings/cof_prod.py @@ -203,8 +203,3 @@ MAIL_DATA = { "REPLYTO": "BdA-Revente ", }, } - -# Max lookback date into kfet history -KFET_HISTORY_DATE_LIMIT = timedelta(weeks=1) -# limite plus longue pour les chef/trez -KFET_HISTORY_LONG_DATE_LIMIT = timedelta(days=30) diff --git a/kfet/forms.py b/kfet/forms.py index f93ff068..aba6d7c4 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -482,6 +482,16 @@ class KFetConfigForm(ConfigForm): label="Durée pour annuler une commande sans mot de passe", initial=timedelta(minutes=5), ) + kfet_history_limit = forms.DurationField( + label="Limite de confidentialité de l'historique", + initial=timedelta(days=7), + help_text="Les éléments plus vieux que cette durée seront masqués", + ) + kfet_history_long_limit = forms.DurationField( + label="Limite de confidentialité de l'historique pour chef/trez", + initial=timedelta(days=30), + help_text="Limite plus longue en cas de problème de compta", + ) class FilterHistoryForm(forms.Form): @@ -489,10 +499,7 @@ class FilterHistoryForm(forms.Form): label=_("De"), widget=DateTimeWidget, required=False, - help_text="Limité à {} jours ({} pour les chefs/trez)".format( - settings.KFET_HISTORY_DATE_LIMIT.days, - settings.KFET_HISTORY_LONG_DATE_LIMIT.days, - ), + help_text="Limité pour raisons de confidentialité", ) end = forms.DateTimeField(label=_("À"), widget=DateTimeWidget, required=False) checkout = forms.ModelChoiceField( diff --git a/kfet/views.py b/kfet/views.py index ca280728..859dc60d 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1414,8 +1414,8 @@ def cancel_operations(request): def get_history_limit(user) -> timedelta: """returns the earliest date the user can view history""" if user.has_perm("access_old_history"): - return datetime.today() - settings.KFET_HISTORY_LONG_DATE_LIMIT - return datetime.today() - settings.KFET_HISTORY_DATE_LIMIT + return datetime.today() - kfet_config.history_long_limit + return datetime.today() - kfet_config.history_limit @login_required