diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java index ceed375b9..1ebeeba80 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java @@ -26,6 +26,7 @@ public record ClerkInterpreterDTO( String country, String extraInformation, @NonNull List regions, - @NonNull ClerkInterpreterQualificationsDTO qualifications + @NonNull ClerkInterpreterQualificationsDTO qualifications, + @NonNull Boolean isAssuranceGiven ) implements ClerkInterpreterDTOCommonFields {} diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java index 97acf14d6..30d94e4d4 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java @@ -38,4 +38,6 @@ public interface ClerkInterpreterDTOCommonFields { String extraInformation(); List regions(); + + Boolean isAssuranceGiven(); } diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java index 9983bf67a..08c1244c2 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java @@ -32,7 +32,8 @@ public record ClerkInterpreterCreateDTO( @Size(max = 255) String country, @Size(max = 4096) String extraInformation, @NonNull @NotNull List regions, - @NonNull @NotEmpty @Valid List qualifications + @NonNull @NotEmpty @Valid List qualifications, + @NonNull @NotNull Boolean isAssuranceGiven ) implements ClerkInterpreterDTOCommonFields { public ClerkInterpreterCreateDTO { diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java index cb9dd3718..10a5b1e76 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java @@ -30,7 +30,8 @@ public record ClerkInterpreterUpdateDTO( @Size(max = 255) String town, @Size(max = 255) String country, @Size(max = 4096) String extraInformation, - @NonNull @NotNull List regions + @NonNull @NotNull List regions, + @NonNull @NotNull Boolean isAssuranceGiven ) implements ClerkInterpreterDTOCommonFields { public ClerkInterpreterUpdateDTO { diff --git a/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java b/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java index 5c2dd02b7..2b71f2122 100644 --- a/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java +++ b/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java @@ -48,4 +48,7 @@ public class Interpreter extends BaseEntity { @OneToMany(mappedBy = "interpreter") private List regions = new ArrayList<>(); + + @Column(name = "is_assurance_given", nullable = false) + private boolean isAssuranceGiven; } diff --git a/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java b/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java index e98f724dc..6ecb81171 100644 --- a/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java +++ b/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java @@ -20,6 +20,7 @@ public interface QualificationRepository extends BaseRepository { " WHERE q.beginDate <= CURRENT_DATE" + " AND CURRENT_DATE <= q.endDate" + " AND q.permissionToPublish = true" + + " AND i.isAssuranceGiven = true" + " AND q.deletedAt IS NULL" + " AND i.deletedAt IS NULL" + " GROUP BY i.id, q.fromLang, q.toLang" diff --git a/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java b/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java index 4eed78aea..2c552fbeb 100644 --- a/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java +++ b/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java @@ -171,6 +171,7 @@ private Optional createClerkInterpreterDTO( .extraInformation(interpreter.getExtraInformation()) .regions(regions) .qualifications(interpreterQualificationsDTO) + .isAssuranceGiven(interpreter.isAssuranceGiven()) .build() ); } @@ -308,6 +309,7 @@ private void copyFromInterpreterDTO(final Interpreter interpreter, final ClerkIn interpreter.setOtherContactInformation(dto.otherContactInfo()); interpreter.setPermissionToPublishOtherContactInfo(dto.permissionToPublishOtherContactInfo()); interpreter.setExtraInformation(dto.extraInformation()); + interpreter.setAssuranceGiven(dto.isAssuranceGiven()); final List regions = dto .regions() diff --git a/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml b/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml index 1328d5a48..6f9d5d255 100644 --- a/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml +++ b/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml @@ -526,5 +526,12 @@ name = 'OTHER' + + + + + + + diff --git a/backend/otr/src/test/java/fi/oph/otr/Factory.java b/backend/otr/src/test/java/fi/oph/otr/Factory.java index 39ea9a0bd..34f0d5be2 100644 --- a/backend/otr/src/test/java/fi/oph/otr/Factory.java +++ b/backend/otr/src/test/java/fi/oph/otr/Factory.java @@ -27,6 +27,7 @@ public static MeetingDate meetingDate(final LocalDate date) { public static Interpreter interpreter() { final Interpreter interpreter = new Interpreter(); interpreter.setOnrId(UUID.randomUUID().toString()); + interpreter.setAssuranceGiven(true); interpreter.setPermissionToPublishEmail(true); interpreter.setPermissionToPublishPhone(true); interpreter.setPermissionToPublishOtherContactInfo(false); diff --git a/backend/otr/src/test/java/fi/oph/otr/service/ClerkInterpreterServiceTest.java b/backend/otr/src/test/java/fi/oph/otr/service/ClerkInterpreterServiceTest.java index 656a9b58b..4f8bbebd5 100644 --- a/backend/otr/src/test/java/fi/oph/otr/service/ClerkInterpreterServiceTest.java +++ b/backend/otr/src/test/java/fi/oph/otr/service/ClerkInterpreterServiceTest.java @@ -336,6 +336,7 @@ public void testCreateInterpreter() { .permissionToPublishPhone(true) .otherContactInfo("other") .permissionToPublishOtherContactInfo(false) + .isAssuranceGiven(true) .street("Tulkintie 44") .postalCode("00100") .town("Helsinki") @@ -459,6 +460,7 @@ public void testCreateInterpreterWithExistingStudent() { .permissionToPublishEmail(false) .permissionToPublishPhone(true) .permissionToPublishOtherContactInfo(false) + .isAssuranceGiven(true) .regions(List.of("01")) .qualifications( List.of( @@ -526,6 +528,7 @@ public void testCreateInterpreterFailsForUnknownRegion() { .permissionToPublishEmail(false) .permissionToPublishPhone(true) .permissionToPublishOtherContactInfo(false) + .isAssuranceGiven(true) .regions(List.of("01", "This region does not exist")) .qualifications( List.of( @@ -569,6 +572,7 @@ public void testCreateInterpreterFailsForOnrIdAndIndividualisedMismatch() { .permissionToPublishEmail(false) .permissionToPublishPhone(true) .permissionToPublishOtherContactInfo(false) + .isAssuranceGiven(true) .regions(List.of("01")) .qualifications( List.of( @@ -674,6 +678,7 @@ public void testUpdateInterpreter() { .permissionToPublishPhone(false) .otherContactInfo("interpreter@test.invalid") .permissionToPublishOtherContactInfo(true) + .isAssuranceGiven(true) .extraInformation("extra") .regions(List.of("01")) .build(); @@ -742,6 +747,7 @@ public void testUpdateInterpreterWithDuplicateRegions() { .permissionToPublishPhone(false) .otherContactInfo("interpreter@test.invalid") .permissionToPublishOtherContactInfo(true) + .isAssuranceGiven(true) .extraInformation("extra") .regions(List.of("01", "01", "02")) .build(); @@ -803,6 +809,7 @@ public void testUpdateInterpreterFailsForUnknownRegion() { .permissionToPublishPhone(false) .otherContactInfo("interpreter@test.invalid") .permissionToPublishOtherContactInfo(true) + .isAssuranceGiven(true) .extraInformation("extra") .regions(List.of("This region code does not exist")) .build(); diff --git a/backend/otr/src/test/java/fi/oph/otr/service/PublicInterpreterServiceTest.java b/backend/otr/src/test/java/fi/oph/otr/service/PublicInterpreterServiceTest.java index 405ad14d7..09edc66e7 100644 --- a/backend/otr/src/test/java/fi/oph/otr/service/PublicInterpreterServiceTest.java +++ b/backend/otr/src/test/java/fi/oph/otr/service/PublicInterpreterServiceTest.java @@ -90,6 +90,16 @@ public void setup() { .identityNumber("3") .email("urho.heinanen@example.invalid") .phoneNumber("+3583456789") + .build(), + "7", + PersonalData + .builder() + .lastName("Ilmarinen") + .firstName("Seppo") + .nickName("Seppo") + .identityNumber("7") + .email("seppo.ilmarinen@example.invalid") + .phoneNumber("+358121234") .build() ) ); @@ -109,6 +119,7 @@ public void testOnlyPublishingPermittedAreReturned() { final Interpreter interpreter4 = createInterpreter("4"); final Interpreter interpreter5 = createInterpreterDeleted(); final Interpreter interpreter6 = createInterpreter("6"); + final Interpreter interpreter7 = createInterpreter("7"); final MeetingDate meetingDate = Factory.meetingDate(); entityManager.persist(meetingDate); @@ -118,6 +129,9 @@ public void testOnlyPublishingPermittedAreReturned() { interpreter1.setOtherContactInformation("oikeustulkki.company@invalid"); interpreter2.setPermissionToPublishPhone(false); + // Should be missing from public listing + interpreter7.setAssuranceGiven(false); + createRegion(interpreter2, "01"); createRegion(interpreter2, "02"); createRegion(interpreter3, "03"); @@ -149,6 +163,15 @@ public void testOnlyPublishingPermittedAreReturned() { nextWeek, true ); + final Qualification qualification71 = createQualification( + interpreter7, + meetingDate, + "FI", + "EN", + today, + tomorrow, + true + ); // Hidden, duplicate of qualification 21 createQualification(interpreter2, meetingDate, "FI", "SE", yesterday, nextWeek, true); diff --git a/frontend/packages/otr/public/i18n/en-GB/translation.json b/frontend/packages/otr/public/i18n/en-GB/translation.json index 18dc6600f..fd0b11359 100644 --- a/frontend/packages/otr/public/i18n/en-GB/translation.json +++ b/frontend/packages/otr/public/i18n/en-GB/translation.json @@ -57,6 +57,9 @@ "description": "You will lose the changes you have made.", "title": "Do you want to exit the modification view?" }, + "caveats": { + "isNotAssuranceGiven": "The registrations are not visible in the public list!" + }, "fields": { "country": "Country", "email": "Email", @@ -75,6 +78,7 @@ "address": "Address", "contactInformation": "Contact details", "extraInformation": "Additional information", + "isAssuranceGiven": "Declaration given", "personalInformation": "Personal data", "regions": "Operating area" }, diff --git a/frontend/packages/otr/public/i18n/fi-FI/translation.json b/frontend/packages/otr/public/i18n/fi-FI/translation.json index 226e89048..c8fad2ed5 100644 --- a/frontend/packages/otr/public/i18n/fi-FI/translation.json +++ b/frontend/packages/otr/public/i18n/fi-FI/translation.json @@ -57,6 +57,9 @@ "description": "Menetät tekemäsi muutokset.", "title": "Haluatko poistua muokkausnäkymästä?" }, + "caveats": { + "isNotAssuranceGiven": "Rekisteröinnit eivät ole näkyvissä julkisessa listauksessa!" + }, "fields": { "country": "Maa", "email": "Sähköpostiosoite", @@ -75,6 +78,7 @@ "address": "Osoite", "contactInformation": "Yhteystiedot", "extraInformation": "Lisätiedot", + "isAssuranceGiven": "Vakuutus annettu", "personalInformation": "Henkilötiedot", "regions": "Toiminta-alue" }, diff --git a/frontend/packages/otr/public/i18n/sv-SE/translation.json b/frontend/packages/otr/public/i18n/sv-SE/translation.json index 0c7e70d7a..af93c1a63 100644 --- a/frontend/packages/otr/public/i18n/sv-SE/translation.json +++ b/frontend/packages/otr/public/i18n/sv-SE/translation.json @@ -57,6 +57,9 @@ "description": "Du kommer att förlora dina ändringar.", "title": "Vill du lämna redigeringsvyn?" }, + "caveats": { + "isNotAssuranceGiven": "Registreringarna syns inte i den offentliga listan!" + }, "fields": { "country": "Land", "email": "E-postadress", @@ -75,6 +78,7 @@ "address": "Adress", "contactInformation": "Kontaktuppgifter", "extraInformation": "Ytterligare information", + "isAssuranceGiven": "Försäkran har getts", "personalInformation": "Personuppgifter", "regions": "Verksamhetsområde" }, diff --git a/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx b/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx index d6e852dd2..2d51172b4 100644 --- a/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx +++ b/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx @@ -7,6 +7,7 @@ import RadioGroup from '@mui/material/RadioGroup'; import TextField from '@mui/material/TextField'; import { ChangeEvent, useMemo, useState } from 'react'; import { + CustomSwitch, CustomTextField, CustomTextFieldProps, H2, @@ -429,6 +430,22 @@ export const ClerkInterpreterDetailsFields = ({ onChange={onFieldChange('regions')} disabled={isViewMode} /> +
+

{t('header.isAssuranceGiven')}

+ {t('caveats.isNotAssuranceGiven')} + ) + } + /> +
); }; diff --git a/frontend/packages/otr/src/interfaces/clerkInterpreter.ts b/frontend/packages/otr/src/interfaces/clerkInterpreter.ts index 78e9b1a35..531ea8c1c 100644 --- a/frontend/packages/otr/src/interfaces/clerkInterpreter.ts +++ b/frontend/packages/otr/src/interfaces/clerkInterpreter.ts @@ -22,6 +22,7 @@ export interface ClerkInterpreterTextFields { export interface ClerkInterpreterBasicInformation extends ClerkInterpreterTextFields { + isAssuranceGiven: boolean; permissionToPublishEmail: boolean; permissionToPublishPhone: boolean; permissionToPublishOtherContactInfo: boolean; diff --git a/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts b/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts index 72bd0b251..a2c79eedd 100644 --- a/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts +++ b/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts @@ -27,6 +27,7 @@ const initialState: ClerkNewInterpreterState = { town: '', country: '', extraInformation: '', + isAssuranceGiven: false, permissionToPublishEmail: false, permissionToPublishPhone: false, permissionToPublishOtherContactInfo: false, diff --git a/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts b/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts index 947ca82d6..0180c339b 100644 --- a/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts +++ b/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts @@ -11,6 +11,7 @@ export const clerkInterpreter = { firstName: 'Anneli Anna', nickName: 'Anneli', email: 'anneli.aaltonen@example.invalid', + isAssuranceGiven: true, permissionToPublishEmail: true, phoneNumber: '+358401000011', permissionToPublishPhone: true, diff --git a/frontend/packages/otr/src/utils/serialization.ts b/frontend/packages/otr/src/utils/serialization.ts index 313f7055a..a183a8ba7 100644 --- a/frontend/packages/otr/src/utils/serialization.ts +++ b/frontend/packages/otr/src/utils/serialization.ts @@ -43,6 +43,7 @@ export class SerializationUtils { static serializeClerkNewInterpreter(interpreter: ClerkNewInterpreter) { const { onrId, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail, @@ -58,6 +59,7 @@ export class SerializationUtils { return { ...textFields, onrId, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail, @@ -74,6 +76,7 @@ export class SerializationUtils { const { id, version, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail, @@ -90,6 +93,7 @@ export class SerializationUtils { ...textFields, id, version, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail,