Skip to content

Commit fc0b34f

Browse files
committed
fix: wording and allow if company has privated data
1 parent b9c30e9 commit fc0b34f

File tree

6 files changed

+46
-16
lines changed

6 files changed

+46
-16
lines changed

packages/app/src/api/core-domain/infra/pdf/templates/DeclarationReceipt.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ export const DeclarationReceipt = (input: DeclarationOpmc) => {
3737

3838
const nafCode = declaration.company.nafCode.getValue();
3939

40+
const { address, postalCode, city } = declaration.company;
41+
let addressValue = "Information non diffusible";
42+
if (
43+
!(address?.includes("[ND]") || address === undefined) &&
44+
!(postalCode?.getValue()?.includes("[ND]") || postalCode?.getValue() === undefined) &&
45+
!(city?.includes("[ND]") || city === undefined)
46+
) {
47+
addressValue = `${address} ${postalCode?.getValue()} ${city}`;
48+
}
49+
4050
const table: BaseReceiptTemplateProps["table"] = [
4151
{
4252
title: "Informations déclarant",
@@ -76,9 +86,7 @@ export const DeclarationReceipt = (input: DeclarationOpmc) => {
7686
},
7787
{
7888
key: "Adresse",
79-
value: `${declaration.company.address} ${declaration.company.postalCode?.getValue()} ${
80-
declaration.company.city
81-
}`,
89+
value: addressValue,
8290
},
8391
...(declaration.company.ues?.name === undefined
8492
? []

packages/app/src/api/core-domain/infra/pdf/templates/RepresentationEquilibreeReceipt.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export interface RepresentationEquilibreeReceiptProps {
2121
export const RepresentationEquilibreeReceipt = ({ repEq }: RepresentationEquilibreeReceiptProps) => {
2222
const nafCode = repEq.company.nafCode.getValue();
2323

24+
const { address, postalCode, city } = repEq.company;
25+
let addressValue = "Information non diffusible";
26+
if (
27+
!(address?.includes("[ND]") || address === undefined) &&
28+
!(postalCode?.getValue()?.includes("[ND]") || postalCode?.getValue() === undefined) &&
29+
!(city?.includes("[ND]") || city === undefined)
30+
) {
31+
addressValue = `${address} ${postalCode?.getValue()} ${city}`;
32+
}
33+
2434
const table: BaseReceiptTemplateProps["table"] = [
2535
{
2636
title: "Informations déclarant",
@@ -52,7 +62,7 @@ export const RepresentationEquilibreeReceipt = ({ repEq }: RepresentationEquilib
5262
},
5363
{
5464
key: "Adresse",
55-
value: `${repEq.company.address} ${repEq.company.postalCode?.getValue()} ${repEq.company.city}`,
65+
value: addressValue,
5666
},
5767
],
5868
},

packages/app/src/app/(default)/index-egapro/declaration/commencer/CommencerForm.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,21 @@ export const prepareDataWithExistingDeclaration = async (
106106
entreprise: {
107107
...baseFormData.entreprise,
108108
entrepriseDéclarante: {
109-
adresse: company?.firstMatchingEtablissement.address,
109+
adresse: company?.firstMatchingEtablissement.address.includes("[ND]")
110+
? "Information non diffusible"
111+
: company?.firstMatchingEtablissement.address,
110112
codeNaf: company.activitePrincipaleUniteLegale,
111-
codePostal: company.firstMatchingEtablissement?.codePostalEtablissement,
113+
codePostal: company.firstMatchingEtablissement?.codePostalEtablissement.includes("[ND]")
114+
? undefined
115+
: company.firstMatchingEtablissement?.codePostalEtablissement,
112116
codePays: company.firstMatchingEtablissement?.codePaysEtrangerEtablissement
113117
? COUNTRIES_COG_TO_ISO[company.firstMatchingEtablissement?.codePaysEtrangerEtablissement]
114118
: undefined,
115119
raisonSociale: company.simpleLabel,
116120
siren,
117-
commune: company.firstMatchingEtablissement?.libelleCommuneEtablissement,
121+
commune: company.firstMatchingEtablissement?.libelleCommuneEtablissement.includes("[ND]")
122+
? undefined
123+
: company.firstMatchingEtablissement?.libelleCommuneEtablissement,
118124
département: countyCode,
119125
région: countyCode ? COUNTY_TO_REGION[countyCode] : undefined,
120126
},

packages/app/src/app/(default)/representation-equilibree/(funnel)/entreprise/Form.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ export const EntrepriseForm = () => {
4545
const { address, countryCodeCOG, postalCode } = getAdditionalMeta(company);
4646

4747
const companyDto: CompanyDTO = {
48-
address,
49-
city: company.firstMatchingEtablissement.libelleCommuneEtablissement,
48+
address: address.includes("[ND]") ? "Information non diffusible" : address,
49+
city: company.firstMatchingEtablissement.libelleCommuneEtablissement.includes("[ND]")
50+
? ""
51+
: company.firstMatchingEtablissement.libelleCommuneEtablissement,
5052
countryIsoCode: COUNTRIES_COG_TO_ISO[countryCodeCOG],
5153
nafCode: company.activitePrincipaleUniteLegale,
5254
name: company.simpleLabel,
53-
postalCode,
55+
postalCode: postalCode?.includes("[ND]") ? "" : postalCode,
5456
siren: company.siren,
5557
};
5658

packages/app/src/app/(default)/representation-equilibree/(funnel)/validation/RecapRepEq.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ export const ValidationRecapRepEq = () => {
9191
declaredAt: "",
9292
modifiedAt: "",
9393
company: {
94-
address,
95-
city: company.firstMatchingEtablissement.libelleCommuneEtablissement,
94+
address: address.includes("[ND]") ? "Information non diffusible" : address,
95+
city: company.firstMatchingEtablissement.libelleCommuneEtablissement.includes("[ND]")
96+
? ""
97+
: company.firstMatchingEtablissement.libelleCommuneEtablissement,
9698
countryCode: COUNTRIES_COG_TO_ISO[countryCodeCOG],
9799
county: countyCode ?? void 0,
98100
nafCode: company.activitePrincipaleUniteLegale,
99101
name: company.simpleLabel,
100-
postalCode: postalCode ?? "",
102+
postalCode: postalCode?.includes("[ND]") ? "" : postalCode ?? "",
101103
region: regionCode ?? void 0,
102104
},
103105
};

packages/app/src/common/core-domain/helpers/entreprise.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ export const getAdditionalMeta = (company: Entreprise) => {
77
? inseeCodeToCounty(company.firstMatchingEtablissement.codeCommuneEtablissement)
88
: undefined;
99
const regionCode = countyCode ? COUNTY_TO_REGION[countyCode] : null;
10-
const postalCode = company.firstMatchingEtablissement.codePostalEtablissement
11-
? company.firstMatchingEtablissement.codePostalEtablissement
12-
: undefined;
10+
const postalCode =
11+
company.firstMatchingEtablissement.codePostalEtablissement &&
12+
!company.firstMatchingEtablissement.codePostalEtablissement.includes("[ND]")
13+
? company.firstMatchingEtablissement.codePostalEtablissement
14+
: undefined;
1315
const address = postalCode
1416
? company.firstMatchingEtablissement.address.split(postalCode)[0].trim()
1517
: company.firstMatchingEtablissement.address;

0 commit comments

Comments
 (0)