diff --git a/pom.xml b/pom.xml
index 0556badb..6997e0d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
fr.insee.pearljam
pearljam-back-office
- 5.1.4
+ 5.1.5
Pearl-Jam-Back-Office
Back-office services for PearlJam
diff --git a/src/main/java/fr/insee/pearljam/api/dto/surveyunit/SurveyUnitDto.java b/src/main/java/fr/insee/pearljam/api/dto/surveyunit/SurveyUnitDto.java
index a8027300..866402d8 100644
--- a/src/main/java/fr/insee/pearljam/api/dto/surveyunit/SurveyUnitDto.java
+++ b/src/main/java/fr/insee/pearljam/api/dto/surveyunit/SurveyUnitDto.java
@@ -7,7 +7,6 @@
import fr.insee.pearljam.api.domain.ContactAttemptConfiguration;
import fr.insee.pearljam.api.domain.ContactOutcomeConfiguration;
import fr.insee.pearljam.api.domain.IdentificationConfiguration;
-import fr.insee.pearljam.api.domain.SurveyUnit;
import fr.insee.pearljam.api.dto.address.AddressDto;
import fr.insee.pearljam.api.dto.campaign.CampaignDto;
import fr.insee.pearljam.api.dto.person.PersonDto;
@@ -67,35 +66,12 @@ public class SurveyUnitDto {
private IdentificationConfiguration identificationConfiguration;
private ContactOutcomeConfiguration contactOutcomeConfiguration;
private ContactAttemptConfiguration contactAttemptConfiguration;
+ private boolean useLetterCommunication;
private List persons;
private AddressDto address;
- public SurveyUnitDto() {
- }
-
- public SurveyUnitDto(SurveyUnit su, SurveyUnitVisibilityDto visibility, Boolean extended) {
- this.id = su.getId();
- this.campaign = su.getCampaign().getId();
- this.campaignLabel = su.getCampaign().getLabel();
- this.managementStartDate = visibility.managementStartDate();
- this.interviewerStartDate = visibility.interviewerStartDate();
- this.identificationPhaseStartDate = visibility.identificationPhaseStartDate();
- this.collectionStartDate = visibility.collectionStartDate();
- this.collectionEndDate = visibility.collectionEndDate();
- this.endDate = visibility.endDate();
- this.identificationConfiguration = su.getCampaign().getIdentificationConfiguration();
- this.contactAttemptConfiguration = su.getCampaign().getContactAttemptConfiguration();
- this.contactOutcomeConfiguration = su.getCampaign().getContactOutcomeConfiguration();
- if (Boolean.TRUE.equals(extended)) {
- this.persons = su.getPersons().stream()
- .map(PersonDto::new)
- .toList();
- this.address = new AddressDto(su.getAddress());
- }
- }
-
public SurveyUnitDto(String idSurveyUnit, CampaignDto campaign, SurveyUnitVisibilityDto visibility) {
this.id = idSurveyUnit;
this.campaign = campaign.getId();
@@ -106,6 +82,7 @@ public SurveyUnitDto(String idSurveyUnit, CampaignDto campaign, SurveyUnitVisibi
this.collectionStartDate = visibility.collectionStartDate();
this.collectionEndDate = visibility.collectionEndDate();
this.endDate = visibility.endDate();
+ this.useLetterCommunication = visibility.useLetterCommunication();
this.identificationConfiguration = campaign.getIdentificationConfiguration();
this.contactAttemptConfiguration = campaign.getContactAttemptConfiguration();
this.contactOutcomeConfiguration = campaign.getContactOutcomeConfiguration();
diff --git a/src/main/java/fr/insee/pearljam/api/surveyunit/dto/SurveyUnitVisibilityDto.java b/src/main/java/fr/insee/pearljam/api/surveyunit/dto/SurveyUnitVisibilityDto.java
index 5e1f6a7f..efa9d91d 100644
--- a/src/main/java/fr/insee/pearljam/api/surveyunit/dto/SurveyUnitVisibilityDto.java
+++ b/src/main/java/fr/insee/pearljam/api/surveyunit/dto/SurveyUnitVisibilityDto.java
@@ -20,7 +20,8 @@ public record SurveyUnitVisibilityDto(
Long identificationPhaseStartDate,
Long collectionStartDate,
Long collectionEndDate,
- Long endDate
+ Long endDate,
+ boolean useLetterCommunication
) {
public static SurveyUnitVisibilityDto fromModel(Visibility visibility) {
@@ -30,6 +31,7 @@ public static SurveyUnitVisibilityDto fromModel(Visibility visibility) {
visibility.identificationPhaseStartDate(),
visibility.collectionStartDate(),
visibility.collectionEndDate(),
- visibility.endDate());
+ visibility.endDate(),
+ visibility.useLetterCommunication());
}
}
diff --git a/src/main/resources/db/dataset/reinit-test-data.sql b/src/main/resources/db/dataset/reinit-test-data.sql
index c86568a2..312d70dc 100644
--- a/src/main/resources/db/dataset/reinit-test-data.sql
+++ b/src/main/resources/db/dataset/reinit-test-data.sql
@@ -116,7 +116,7 @@ INSERT INTO visibility (
) VALUES
('OU-NORTH', 'SIMPSONS2020X00',1721903754305, 1719225354304, 1724582154306, 1719138954303, 1719052554302, 1718966154301, true),
('OU-SOUTH', 'SIMPSONS2020X00',1721903754315, 1719225354314, 1724582154316, 1719138954310, 1719052554309, 1718966154308, false),
- ('OU-NORTH', 'VQS2021X00',1721903754308, 1719225354308, 1724582154308, 1719138954308, 1719052554308, 1718966154308, true),
+ ('OU-NORTH', 'VQS2021X00',1721903754308, 1719225354308, 1724582154308, 1719138954308, 1719052554308, 1718966154308, false),
('OU-SOUTH', 'VQS2021X00',1721903754308, 1719225354308, 1724582154308, 1719138954308, 1719052554308, 1718966154308, true),
('OU-SOUTH', 'XCLOSEDX00',1719052554308, 1718966154308, 1719225354308, 1718879754308, 1718789354308, 1718706954308, true),
('OU-SOUTH', 'ZCLOSEDX00',1719052554308, 1718966154308, 1719225354308, 1718879754308, 1718789354308, 1718706954308, true),
diff --git a/src/test/java/fr/insee/pearljam/integration/surveyunit/SurveyUnitIT.java b/src/test/java/fr/insee/pearljam/integration/surveyunit/SurveyUnitIT.java
index 74df6729..3bf45240 100644
--- a/src/test/java/fr/insee/pearljam/integration/surveyunit/SurveyUnitIT.java
+++ b/src/test/java/fr/insee/pearljam/integration/surveyunit/SurveyUnitIT.java
@@ -70,7 +70,8 @@ void testGetAllSurveyUnits() throws Exception {
"endDate":1724582154306,
"identificationConfiguration":"IASCO",
"contactOutcomeConfiguration":"F2F",
- "contactAttemptConfiguration":"F2F"
+ "contactAttemptConfiguration":"F2F",
+ "useLetterCommunication": true
},
{
"id":"12",
@@ -84,7 +85,8 @@ void testGetAllSurveyUnits() throws Exception {
"endDate":1724582154306,
"identificationConfiguration":"IASCO",
"contactOutcomeConfiguration":"F2F",
- "contactAttemptConfiguration":"F2F"
+ "contactAttemptConfiguration":"F2F",
+ "useLetterCommunication": true
},
{
"id":"20",
@@ -98,7 +100,8 @@ void testGetAllSurveyUnits() throws Exception {
"endDate":1724582154308,
"identificationConfiguration":"IASCO",
"contactOutcomeConfiguration":"TEL",
- "contactAttemptConfiguration":"TEL"
+ "contactAttemptConfiguration":"TEL",
+ "useLetterCommunication": false
}
]
""";
@@ -387,7 +390,7 @@ void testPutSurveyUnitDetail() throws Exception {
},
"communicationRequests":[
{
- "communicationTemplateId":4,
+ "communicationTemplateId":5,
"reason":"REFUSAL",
"creationTimestamp": 1721903754305
},
@@ -499,7 +502,7 @@ void testPutSurveyUnitDetail() throws Exception {
},
"communicationRequests":[
{
- "communicationTemplateId":4,
+ "communicationTemplateId":5,
"reason":"REFUSAL",
"emitter":"INTERVIEWER",
"status":[