Skip to content

Commit

Permalink
fix: Hardcode tax revenue autofill for
Browse files Browse the repository at this point in the history
demande-logement-social.gouv.fr

On demande-logement-social.gouv.fr, we need to be able to autofill
the tax revenue for the two last years.

Previously, the two tax revenue fields had the target date like
"2022" in the "tag" field. But the form has changed and now, there is
no way to know the date of the tax revenue we want.

For the moment we hardcode the year targeted by each field with the
field ID.
  • Loading branch information
zatteo committed Sep 17, 2024
1 parent a83d30b commit 16d447d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/cozy/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@ const makeYearFilterFunction = (field: AutofillField) => {

const getValueInField = (field: AutofillField, regex: string): any => {
for (const paperAttribute of PaperAutoFillConstants.PaperAttributes) {
// Special case for demande-logement-social.gouv.fr
if (field.htmlID.includes("montantMoins1")) {
return 2023;
}
if (field.htmlID.includes("montantMoins2")) {
return 2022;
}

const matches = field[paperAttribute]?.match(regex);

if (matches) {
Expand Down

0 comments on commit 16d447d

Please sign in to comment.