Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #992 from yverdon/feature/yc-1199
Browse files Browse the repository at this point in the history
YC-1199: Add message when editing awaiting supplement submission
  • Loading branch information
rbovard authored May 8, 2024
2 parents c0886e8 + f1725a6 commit 9bf8bb3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
{% else %}
{% translate "Vous pouvez la consulter sur le lien suivant" %}: {{ submission_url }}
{% endif %}

{% translate "Avec nos meilleures salutations," %}
{% if administrative_entity.custom_signature %}
{{ administrative_entity.custom_signature }}
Expand Down
24 changes: 24 additions & 0 deletions geocity/apps/submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,15 @@ def anonymous_submission(request):
raise Http404


def display_warning_message_for_awaiting_supplement_submission(request):
messages.warning(
request,
_(
"N'oubliez pas de renvoyer le formulaire une fois que vous aurez ajouté les compléments demandés."
),
)


@redirect_bad_status_to_detail
@login_required
@user_passes_test(has_profile)
Expand Down Expand Up @@ -1450,6 +1459,9 @@ def submission_fields(request, submission_id):
if form_payment is not None:
requires_online_payment = form_payment.requires_online_payment

if submission.status == models.Submission.STATUS_AWAITING_SUPPLEMENT:
display_warning_message_for_awaiting_supplement_submission(request)

if request.method == "POST":
# Disable `required` fields validation to allow partial save
form = forms.FieldsForm(
Expand Down Expand Up @@ -1650,6 +1662,9 @@ def submission_appendices(request, submission_id):
current_step_type=StepType.APPENDICES,
)

if submission.status == models.Submission.STATUS_AWAITING_SUPPLEMENT:
display_warning_message_for_awaiting_supplement_submission(request)

if request.method == "POST":
form = forms.AppendicesForm(
instance=submission,
Expand Down Expand Up @@ -1703,6 +1718,9 @@ def submission_contacts(request, submission_id):
request.POST or None, instance=submission
)

if submission.status == models.Submission.STATUS_AWAITING_SUPPLEMENT:
display_warning_message_for_awaiting_supplement_submission(request)

if request.method == "POST":
formset = forms.get_submission_contacts_formset_initiated(
submission, data=request.POST
Expand Down Expand Up @@ -1777,6 +1795,9 @@ def submission_geo_time(request, submission_id):
).all(),
)

if submission.status == models.Submission.STATUS_AWAITING_SUPPLEMENT:
display_warning_message_for_awaiting_supplement_submission(request)

if request.method == "POST":
if formset.is_valid():
with transaction.atomic():
Expand Down Expand Up @@ -1973,6 +1994,9 @@ def submission_submit(request, submission_id):
if step.errors_count and step.url
]

if submission.status == models.Submission.STATUS_AWAITING_SUPPLEMENT:
display_warning_message_for_awaiting_supplement_submission(request)

if request.method == "POST":
if incomplete_steps:
raise SuspiciousOperation
Expand Down

0 comments on commit 9bf8bb3

Please sign in to comment.