Commit fc0b34f 1 parent b9c30e9 commit fc0b34f Copy full SHA for fc0b34f
File tree 6 files changed +46
-16
lines changed
api/core-domain/infra/pdf/templates
index-egapro/declaration/commencer
representation-equilibree/(funnel)
common/core-domain/helpers
6 files changed +46
-16
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ export const DeclarationReceipt = (input: DeclarationOpmc) => {
37
37
38
38
const nafCode = declaration . company . nafCode . getValue ( ) ;
39
39
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
+
40
50
const table : BaseReceiptTemplateProps [ "table" ] = [
41
51
{
42
52
title : "Informations déclarant" ,
@@ -76,9 +86,7 @@ export const DeclarationReceipt = (input: DeclarationOpmc) => {
76
86
} ,
77
87
{
78
88
key : "Adresse" ,
79
- value : `${ declaration . company . address } ${ declaration . company . postalCode ?. getValue ( ) } ${
80
- declaration . company . city
81
- } `,
89
+ value : addressValue ,
82
90
} ,
83
91
...( declaration . company . ues ?. name === undefined
84
92
? [ ]
Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ export interface RepresentationEquilibreeReceiptProps {
21
21
export const RepresentationEquilibreeReceipt = ( { repEq } : RepresentationEquilibreeReceiptProps ) => {
22
22
const nafCode = repEq . company . nafCode . getValue ( ) ;
23
23
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
+
24
34
const table : BaseReceiptTemplateProps [ "table" ] = [
25
35
{
26
36
title : "Informations déclarant" ,
@@ -52,7 +62,7 @@ export const RepresentationEquilibreeReceipt = ({ repEq }: RepresentationEquilib
52
62
} ,
53
63
{
54
64
key : "Adresse" ,
55
- value : ` ${ repEq . company . address } ${ repEq . company . postalCode ?. getValue ( ) } ${ repEq . company . city } ` ,
65
+ value : addressValue ,
56
66
} ,
57
67
] ,
58
68
} ,
Original file line number Diff line number Diff line change @@ -106,15 +106,21 @@ export const prepareDataWithExistingDeclaration = async (
106
106
entreprise : {
107
107
...baseFormData . entreprise ,
108
108
entrepriseDéclarante : {
109
- adresse : company ?. firstMatchingEtablissement . address ,
109
+ adresse : company ?. firstMatchingEtablissement . address . includes ( "[ND]" )
110
+ ? "Information non diffusible"
111
+ : company ?. firstMatchingEtablissement . address ,
110
112
codeNaf : company . activitePrincipaleUniteLegale ,
111
- codePostal : company . firstMatchingEtablissement ?. codePostalEtablissement ,
113
+ codePostal : company . firstMatchingEtablissement ?. codePostalEtablissement . includes ( "[ND]" )
114
+ ? undefined
115
+ : company . firstMatchingEtablissement ?. codePostalEtablissement ,
112
116
codePays : company . firstMatchingEtablissement ?. codePaysEtrangerEtablissement
113
117
? COUNTRIES_COG_TO_ISO [ company . firstMatchingEtablissement ?. codePaysEtrangerEtablissement ]
114
118
: undefined ,
115
119
raisonSociale : company . simpleLabel ,
116
120
siren,
117
- commune : company . firstMatchingEtablissement ?. libelleCommuneEtablissement ,
121
+ commune : company . firstMatchingEtablissement ?. libelleCommuneEtablissement . includes ( "[ND]" )
122
+ ? undefined
123
+ : company . firstMatchingEtablissement ?. libelleCommuneEtablissement ,
118
124
département : countyCode ,
119
125
région : countyCode ? COUNTY_TO_REGION [ countyCode ] : undefined ,
120
126
} ,
Original file line number Diff line number Diff line change @@ -45,12 +45,14 @@ export const EntrepriseForm = () => {
45
45
const { address, countryCodeCOG, postalCode } = getAdditionalMeta ( company ) ;
46
46
47
47
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 ,
50
52
countryIsoCode : COUNTRIES_COG_TO_ISO [ countryCodeCOG ] ,
51
53
nafCode : company . activitePrincipaleUniteLegale ,
52
54
name : company . simpleLabel ,
53
- postalCode,
55
+ postalCode : postalCode ?. includes ( "[ND]" ) ? "" : postalCode ,
54
56
siren : company . siren ,
55
57
} ;
56
58
Original file line number Diff line number Diff line change @@ -91,13 +91,15 @@ export const ValidationRecapRepEq = () => {
91
91
declaredAt : "" ,
92
92
modifiedAt : "" ,
93
93
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 ,
96
98
countryCode : COUNTRIES_COG_TO_ISO [ countryCodeCOG ] ,
97
99
county : countyCode ?? void 0 ,
98
100
nafCode : company . activitePrincipaleUniteLegale ,
99
101
name : company . simpleLabel ,
100
- postalCode : postalCode ?? "" ,
102
+ postalCode : postalCode ?. includes ( "[ND]" ) ? "" : postalCode ?? "" ,
101
103
region : regionCode ?? void 0 ,
102
104
} ,
103
105
} ;
Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ export const getAdditionalMeta = (company: Entreprise) => {
7
7
? inseeCodeToCounty ( company . firstMatchingEtablissement . codeCommuneEtablissement )
8
8
: undefined ;
9
9
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 ;
13
15
const address = postalCode
14
16
? company . firstMatchingEtablissement . address . split ( postalCode ) [ 0 ] . trim ( )
15
17
: company . firstMatchingEtablissement . address ;
You can’t perform that action at this time.
0 commit comments