Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2020 City of Espoo"
SPDX-License-Identifier = "LGPL-2.1-or-later"

[[annotations]]
path = "service/src/main/resources/document-templates/**.template.json"
precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2025 City of Espoo"
SPDX-License-Identifier = "LGPL-2.1-or-later"

[[annotations]]
path = ".nvmrc"
precedence = "aggregate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const statusesByType: Record<ChildDocumentType, DocumentStatus[]> = {
HOJKS: ['DRAFT', 'PREPARED', 'COMPLETED'],
MIGRATED_VASU: ['COMPLETED'],
MIGRATED_LEOPS: ['COMPLETED'],
MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION: ['COMPLETED'],
MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION: ['COMPLETED'],
VASU: ['DRAFT', 'PREPARED', 'COMPLETED'],
LEOPS: ['DRAFT', 'PREPARED', 'COMPLETED'],
CITIZEN_BASIC: ['DRAFT', 'CITIZEN_DRAFT', 'COMPLETED'],
Expand Down Expand Up @@ -79,7 +81,9 @@ export const isChildDocumentPublishable = (
) =>
status !== 'COMPLETED' &&
type !== 'CITIZEN_BASIC' &&
type !== 'OTHER_DECISION'
type !== 'OTHER_DECISION' &&
type !== 'MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION' &&
type !== 'MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION'

export const isChildDocumentDecidable = (
type: ChildDocumentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const caseManagementRequired: ChildDocumentType[] = [
'VASU',
'HOJKS',
'LEOPS',
'OTHER_DECISION'
'OTHER_DECISION',
'MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION',
'MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION'
]

export const documentTemplateForm = transformed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default React.memo(function TemplateModal({ onClose, mode }: Props) {
childDocumentTypes
.filter(
(type) =>
!type.startsWith('MIGRATED_') &&
(!type.startsWith('MIGRATED_') || mode.type === 'import') &&
(featureFlags.citizenChildDocumentTypes ||
type !== 'CITIZEN_BASIC') &&
(featureFlags.decisionChildDocumentTypes ||
Expand All @@ -80,7 +80,7 @@ export default React.memo(function TemplateModal({ onClose, mode }: Props) {
value: option,
label: i18n.documentTemplates.documentTypes[option]
})),
[i18n.documentTemplates]
[i18n.documentTemplates, mode.type]
)

const getLanguageOptions = useCallback(
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib-common/generated/api-types/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ export const childDocumentTypes = [
'HOJKS',
'MIGRATED_VASU',
'MIGRATED_LEOPS',
'MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION',
'MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION',
'VASU',
'LEOPS',
'CITIZEN_BASIC',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib-components/document-templates/documents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ export const getDocumentCategory = (
case 'OTHER':
return 'internal'
case 'OTHER_DECISION':
case 'MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION':
case 'MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION':
return 'decision'
case 'CITIZEN_BASIC':
return 'external'
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5258,6 +5258,10 @@ export const fi = {
HOJKS: 'HOJKS',
MIGRATED_VASU: 'Varhaiskasvatussuunnitelma (siirretty)',
MIGRATED_LEOPS: 'Esiopetuksen suunnitelma (siirretty)',
MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION:
'Päätös tuesta varhaiskasvatuksessa (siirretty)',
MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION:
'Päätös tuesta esiopetuksessa (siirretty)',
VASU: 'Varhaiskasvatussuunnitelma',
LEOPS: 'Esiopetuksen suunnitelma',
CITIZEN_BASIC: 'Huoltajan kanssa täytettävä asiakirja',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,18 @@ enum class ChildDocumentType(
decision = false,
autoCompleteAtEndOfValidity = false,
),
MIGRATED_DAYCARE_ASSISTANCE_NEED_DECISION(
statuses = listOf(DocumentStatus.COMPLETED),
manuallyPublishable = false,
decision = true,
autoCompleteAtEndOfValidity = false,
),
MIGRATED_PRESCHOOL_ASSISTANCE_NEED_DECISION(
statuses = listOf(DocumentStatus.COMPLETED),
manuallyPublishable = false,
decision = true,
autoCompleteAtEndOfValidity = false,
),
VASU(
statuses = listOf(DocumentStatus.DRAFT, DocumentStatus.PREPARED, DocumentStatus.COMPLETED),
manuallyPublishable = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,16 @@ fun Database.Transaction.forceUnpublishTemplate(id: DocumentTemplateId) {
sql(
"""
WITH documents_to_delete AS (
SELECT id, process_id FROM child_document
SELECT id, process_id, decision_id FROM child_document
WHERE template_id = ${bind(id)}
FOR UPDATE
), delete_processes AS (
DELETE FROM case_process ap
WHERE ap.id IN (SELECT d2d.process_id FROM documents_to_delete d2d)
), delete_documents AS (
DELETE FROM child_document cd WHERE cd.id IN (SELECT d2d.id FROM documents_to_delete d2d)
), delete_decisions AS (
DELETE FROM child_document_decision cdd WHERE cdd.id IN (SELECT d2d.decision_id FROM documents_to_delete d2d)
)
UPDATE document_template
SET published = false
Expand Down
Loading