diff --git a/contrib/forms/__init__.py b/contrib/forms/__init__.py index d19fdd8d..b9efe94d 100644 --- a/contrib/forms/__init__.py +++ b/contrib/forms/__init__.py @@ -190,7 +190,13 @@ def get_scholarship_choices(uuid, person): return EMPTY_CHOICE + ((uuid, format_scholarship(scholarship)),) -def get_past_academic_years_choices(person, exclude_current=False, current_year=None, academic_years=None): +def get_past_academic_years_choices( + person, + exclude_current=False, + current_year=None, + academic_years=None, + format_label_function=None, +): """Return a list of choices of past academic years.""" if academic_years is None: academic_years = AcademicYearService.get_academic_years(person) @@ -203,8 +209,15 @@ def get_past_academic_years_choices(person, exclude_current=False, current_year= lower_year = current_year - 100 + if format_label_function is None: + + def default_format_label_function(academic_year): + return f"{academic_year.year}-{academic_year.year + 1}" + + format_label_function = default_format_label_function + return EMPTY_CHOICE + tuple( - (academic_year.year, f"{academic_year.year}-{academic_year.year + 1}") + (academic_year.year, format_label_function(academic_year)) for academic_year in academic_years if current_year >= academic_year.year >= lower_year ) diff --git a/contrib/forms/education.py b/contrib/forms/education.py index c912026f..e22a8aa4 100644 --- a/contrib/forms/education.py +++ b/contrib/forms/education.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,33 +23,36 @@ # see http://www.gnu.org/licenses/. # # ############################################################################## +import datetime + from dal import forward from django import forms from django.utils.safestring import mark_safe -from django.utils.translation import gettext_lazy as _, pgettext_lazy +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import pgettext_lazy +from osis_document.contrib.widgets import HiddenFileWidget from admission.constants import FIELD_REQUIRED_MESSAGE from admission.contrib.enums import HAS_DIPLOMA_CHOICES from admission.contrib.enums.secondary_studies import ( + EDUCATIONAL_TYPES, BelgianCommunitiesOfEducation, DiplomaTypes, - EDUCATIONAL_TYPES, Equivalence, ForeignDiplomaTypes, GotDiploma, ) +from admission.contrib.forms import EMPTY_CHOICE +from admission.contrib.forms import AdmissionFileUploadField as FileUploadField from admission.contrib.forms import ( autocomplete, get_country_initial_choices, get_high_school_initial_choices, get_language_initial_choices, get_past_academic_years_choices, - EMPTY_CHOICE, - AdmissionFileUploadField as FileUploadField, ) from admission.contrib.forms.specific_question import ConfigurableFormMixin -from admission.services.reference import CountriesService, AcademicYearService -from osis_document.contrib.widgets import HiddenFileWidget +from admission.services.reference import AcademicYearService, CountriesService def disable_fields(condition, fields, fields_to_keep_enabled_names=None): @@ -155,6 +158,12 @@ class BachelorAdmissionEducationForm(BaseAdmissionEducationForm): max_files=1, required=False, ) + first_cycle_admission_exam_year = forms.TypedChoiceField( + label=_('Year of obtaining this proof'), + widget=autocomplete.Select2(), + coerce=int, + required=False, + ) class Media: js = ("js/dependsOn.min.js",) @@ -166,6 +175,17 @@ def __init__(self, *args, **kwargs): foreign_diploma = self.initial.get("foreign_diploma") high_school_diploma_alternative = self.initial.get("high_school_diploma_alternative") + today = datetime.date.today() + if today.month >= 11: + current_year = today.year + else: + current_year = today.year - 1 + self.fields['first_cycle_admission_exam_year'].choices = get_past_academic_years_choices( + kwargs['person'], + current_year=current_year, + format_label_function=lambda academic_year: str(academic_year.year + 1), + ) + diploma = belgian_diploma or foreign_diploma # Select the correct diploma type if one has been saved if diploma: @@ -177,6 +197,9 @@ def __init__(self, *args, **kwargs): self.fields['first_cycle_admission_exam'].initial = high_school_diploma_alternative.get( "first_cycle_admission_exam" ) + self.fields['first_cycle_admission_exam_year'].initial = high_school_diploma_alternative.get( + "first_cycle_admission_exam_year" + ) disable_fields(not self.can_update_diploma, self.fields, {self.configurable_form_field_name}) def clean(self): diff --git a/contrib/views/common/form_tabs/education.py b/contrib/views/common/form_tabs/education.py index f86cc550..8bb73af9 100644 --- a/contrib/views/common/form_tabs/education.py +++ b/contrib/views/common/form_tabs/education.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,12 +29,12 @@ from admission.constants import LINGUISTIC_REGIMES_WITHOUT_TRANSLATION, PLUS_5_ISO_CODES from admission.contrib.enums.secondary_studies import ( + HAS_DIPLOMA_CHOICES, BelgianCommunitiesOfEducation, DiplomaTypes, Equivalence, ForeignDiplomaTypes, GotDiploma, - HAS_DIPLOMA_CHOICES, ) from admission.contrib.enums.specific_question import Onglets from admission.contrib.enums.training_choice import TrainingType @@ -45,7 +45,10 @@ BaseAdmissionEducationForm, ) from admission.contrib.views.mixins import LoadDossierViewMixin -from admission.services.mixins import FormMixinWithSpecificQuestions, WebServiceFormMixin +from admission.services.mixins import ( + FormMixinWithSpecificQuestions, + WebServiceFormMixin, +) from admission.services.person import ( ContinuingEducationAdmissionPersonService, GeneralEducationAdmissionPersonService, @@ -238,12 +241,16 @@ def prepare_data(self, main_form_data): } first_cycle_admission_exam = data.pop("first_cycle_admission_exam", []) + first_cycle_admission_exam_year = data.pop("first_cycle_admission_exam_year", "") if graduated_from_high_school == GotDiploma.NO.name: return { 'specific_question_answers': data.get('specific_question_answers'), 'graduated_from_high_school': graduated_from_high_school, 'graduated_from_high_school_year': data.get('graduated_from_high_school_year'), - 'high_school_diploma_alternative': {'first_cycle_admission_exam': first_cycle_admission_exam}, + 'high_school_diploma_alternative': { + 'first_cycle_admission_exam': first_cycle_admission_exam, + 'first_cycle_admission_exam_year': first_cycle_admission_exam_year, + }, } # The candidate has a diploma or will have one this year diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index f77631fe..ff53bcca 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -127,9 +127,10 @@ msgstr "" #, python-format msgid "" "
On the basis of the information you have provided on your previous " -"experience, you do not appear to meet the eligibility requirements for the course %(course_title)s. " -"p>
Please check your previous course data or choose another course.
" +"experience, you do not appear to meet the eligibility requirements for the course " +"%(course_title)s.Please check your previous course data or " +"choose another course.
" msgstr "" #, python-format @@ -169,8 +170,8 @@ msgid "" msgstr "" msgid "" -"A technical or IT problem? Contact the Service Desk" +"A technical or IT problem? Contact the Service Desk" msgstr "" msgid "A transcript for all years" @@ -306,9 +307,10 @@ msgid "" "Answer according to the European Framework of Reference for Languages (CEFR) " "classification. Detailed explanations of this framework can be found at https://www.coe.int/en/web/common-european-framework-reference-" -"languages/table-1-cefr-3.3-common-reference-levels-global-scale " +"languages/table-1-cefr-3.3-common-reference-levels-global-scale\" " +"target=\"_blank\"> https://www.coe.int/en/web/common-european-framework-" +"reference-languages/table-1-cefr-3.3-common-reference-levels-global-scale " +"a>" msgstr "" msgid "" @@ -2792,8 +2794,8 @@ msgstr "" #, python-format msgid "" -"Would you like to switch courses this academic year at UCLouvain? (Informations)" +"Would you like to switch courses this academic year at UCLouvain? (Informations)" msgstr "" msgid "" @@ -2812,6 +2814,9 @@ msgstr "" msgid "Year of birth" msgstr "" +msgid "Year of obtaining this proof" +msgstr "" + msgid "Year without enrolling in the course." msgstr "" @@ -2894,8 +2899,9 @@ msgid "" msgstr "" msgid "" -"You can find more information on the French Community webpage https://equisup.cfwb.be/" +"You can find more information on the French Community webpage https://equisup.cfwb.be/" +"" msgstr "" msgid "You can specify the locality or postcode in your search." @@ -2980,8 +2986,8 @@ msgstr "" #, python-brace-format msgid "" -"Your completed and signed reorientation form ({url})" +"Your completed and signed reorientation form ({url})" msgstr "" msgid "Your data have been saved" @@ -2996,8 +3002,8 @@ msgid "" msgstr "" msgid "" -"Your joint supervision information can be completed later. Please input \"No" -"\" if you don't have information yet." +"Your joint supervision information can be completed later. Please input " +"\"No\" if you don't have information yet." msgstr "" #, python-brace-format diff --git a/locale/fr_BE/LC_MESSAGES/django.po b/locale/fr_BE/LC_MESSAGES/django.po index 5091d2f6..6f172d11 100644 --- a/locale/fr_BE/LC_MESSAGES/django.po +++ b/locale/fr_BE/LC_MESSAGES/django.po @@ -151,15 +151,16 @@ msgstr "" #, python-format msgid "" "On the basis of the information you have provided on your previous " -"experience, you do not appear to meet the eligibility requirements for the course %(course_title)s. " -"p>
Please check your previous course data or choose another course.
" +"experience, you do not appear to meet the eligibility requirements for the course " +"%(course_title)s.Please check your previous course data or " +"choose another course.
" msgstr "" "Sur base des éléments que vous avez renseignés dans votre parcours " -"antérieur, vous ne semblez pas remplir les conditions d'accès de la formation %(course_title)s." -"
Nous vous invitons à vérifier les données de votre parcours antérieur " -"ou à choisir une autre formation.
" +"antérieur, vous ne semblez pas remplir les conditions d'accès de la formation " +"%(course_title)s.Nous vous invitons à vérifier les données " +"de votre parcours antérieur ou à choisir une autre formation.
" #, python-format msgid "" @@ -221,8 +222,8 @@ msgstr "" "ne peut pas avoir de tuteur. Un garant n’est en aucun cas un tuteur légal." msgid "" -"A technical or IT problem? Contact the Service Desk" +"A technical or IT problem? Contact the Service Desk" msgstr "" "Un problème technique ou informatique ? Contactez le Service Desk" @@ -368,9 +369,10 @@ msgid "" "Answer according to the European Framework of Reference for Languages (CEFR) " "classification. Detailed explanations of this framework can be found at https://www.coe.int/en/web/common-european-framework-reference-" -"languages/table-1-cefr-3.3-common-reference-levels-global-scale " +"languages/table-1-cefr-3.3-common-reference-levels-global-scale\" " +"target=\"_blank\"> https://www.coe.int/en/web/common-european-framework-" +"reference-languages/table-1-cefr-3.3-common-reference-levels-global-scale " +"a>" msgstr "" "Répondez en respectant le classement du cadre européen de référence pour les " "langues (CECRL). Des explications détaillées sur ce cadre de référence se " @@ -2965,8 +2967,8 @@ msgid "" "To choose this course, you need to cancel your " "application and create a new one." msgstr "" -"Pour pouvoir choisir cette formation, il est nécessaire d'annuler votre demande et d'en créer une nouvelle." +"Pour pouvoir choisir cette formation, il est nécessaire d'annuler votre demande et d'en créer une nouvelle." msgid "" "To claim this Belgian student status, you will need to reside in Belgium " @@ -3213,8 +3215,8 @@ msgstr "" #, python-format msgid "" -"Would you like to switch courses this academic year at UCLouvain? (Informations)" +"Would you like to switch courses this academic year at UCLouvain? (Informations)" msgstr "" "Souhaitez-vous vous réorienter pour cette année académique, à l’UCLouvain ? " "(Informations)" @@ -3237,6 +3239,9 @@ msgstr "Année" msgid "Year of birth" msgstr "Année de naissance" +msgid "Year of obtaining this proof" +msgstr "Année d’obtention de cette attestation" + msgid "Year without enrolling in the course." msgstr "Année sans inscription à la formation." @@ -3325,8 +3330,9 @@ msgstr "" "pour votre dossier (justificatifs, preuve de niveau de langue, ...)." msgid "" -"You can find more information on the French Community webpage https://equisup.cfwb.be/" +"You can find more information on the French Community webpage https://equisup.cfwb.be/" +"" msgstr "" "Vous trouverez davantage d'information sur la page de la Communauté " "française https://" @@ -3397,15 +3403,14 @@ msgstr "" msgid "Your Belgian student status" msgstr "Situation d’assimilation qui vous correspond" - msgid "" "Your UCLouvain account has been created. If you have not yet activated it, " "please follow the instructions received by email and log in with your " "UCLouvain account to access your registrations." msgstr "" "Votre compte UCLouvain a été créé. Si vous ne l'avez pas encore activé, " -"veuillez suivre les instructions reçues par mail et connectez-vous avec votre " -"compte UCLouvain pour accéder à vos inscriptions." +"veuillez suivre les instructions reçues par mail et connectez-vous avec " +"votre compte UCLouvain pour accéder à vos inscriptions." msgid "" "Your application cannot be confirmed. The admission requirements do not " @@ -3441,8 +3446,8 @@ msgstr "Votre formulaire de réorientation complété et signé" #, python-brace-format msgid "" -"Your completed and signed reorientation form ({url})" +"Your completed and signed reorientation form ({url})" msgstr "" "Votre formulaire de réorientation complété et signé ({url})" @@ -3461,8 +3466,8 @@ msgstr "" "manquants." msgid "" -"Your joint supervision information can be completed later. Please input \"No" -"\" if you don't have information yet." +"Your joint supervision information can be completed later. Please input " +"\"No\" if you don't have information yet." msgstr "" "Vos informations de cotutelle pourront être complétées ultérieurement; " "veuillez indiquer \"non\" si vous ne disposez pas encore des informations" diff --git a/requirements.txt b/requirements.txt index ace874a7..185bc3a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -git+https://github.com/uclouvain/osis-admission-sdk.git@build-1.0.115 +git+https://github.com/uclouvain/osis-admission-sdk.git@build-1.0.116 phonenumberslite==8.13.48 diff --git a/templates/admission/details/education.html b/templates/admission/details/education.html index 8ef29724..8d0193e4 100644 --- a/templates/admission/details/education.html +++ b/templates/admission/details/education.html @@ -8,7 +8,7 @@ * The core business involves the administration of students, teachers, * courses, programs and so on. * - * Copyright (C) 2015-2023 Université catholique de Louvain + * Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) * * This program is free software: you can redistribute it and/or modify @@ -97,6 +97,7 @@ {% endpanel %} {% panel _('Attachments') %} {% field_data _("Certificate of passing the bachelor's course entrance exam") high_school_diploma_alternative.first_cycle_admission_exam %} + {% field_data _("Year of obtaining this proof") high_school_diploma_alternative.first_cycle_admission_exam_year.year|add:1 %} {% endpanel %} {% else %} diff --git a/templates/admission/general_education/forms/bachelor_education.html b/templates/admission/general_education/forms/bachelor_education.html index 40d8ce6a..34128206 100644 --- a/templates/admission/general_education/forms/bachelor_education.html +++ b/templates/admission/general_education/forms/bachelor_education.html @@ -8,7 +8,7 @@ * The core business involves the administration of students, teachers, * courses, programs and so on. * - * Copyright (C) 2015-2024 Université catholique de Louvain + * Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) * * This program is free software: you can redistribute it and/or modify @@ -186,6 +186,7 @@ {% panel _("Attachments") %}