-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1573 from maykinmedia/2950-use-zaaktype-naam-as-o…
…mschrijving Make case title description explicitly configurable from the source ZGW fields
- Loading branch information
Showing
10 changed files
with
158 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...openzaak/migrations/0060_remove_openzaakconfig_use_zaak_omschrijving_as_title_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Generated by Django 4.2.18 on 2025-01-22 12:06 | ||
import logging | ||
|
||
from django.db import migrations, models | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def migrate_use_zaak_omschrijving_as_title(apps, _): | ||
from open_inwoner.openzaak.constants import ZaakTitleDisplayChoices | ||
|
||
OpenZaakConfig = apps.get_model("openzaak", "OpenZaakConfig") | ||
|
||
if config := OpenZaakConfig.objects.first(): | ||
if config.use_zaak_omschrijving_as_title: | ||
logger.info( | ||
"Setting OpenZaakConfig.derive_zaak_titel_from to %s because " | ||
"OpenZaakConfig.use_zaak_omschrijving_as_title = True", | ||
ZaakTitleDisplayChoices.zaak_omschrijving, | ||
) | ||
config.derive_zaak_titel_from = ZaakTitleDisplayChoices.zaak_omschrijving | ||
else: | ||
logger.info( | ||
"Setting OpenZaakConfig.derive_zaak_titel_from to %s because " | ||
"OpenZaakConfig.use_zaak_omschrijving_as_title = False", | ||
ZaakTitleDisplayChoices.zaaktype_omschrijving, | ||
) | ||
config.derive_zaak_titel_from = ( | ||
ZaakTitleDisplayChoices.zaaktype_omschrijving | ||
) | ||
|
||
config.save() | ||
|
||
# ZaakTitleDisplayChoices.zaaktype_omschrijving is a newly added option, so it won't | ||
# be the default for anybody. | ||
|
||
|
||
def reverse_migrate_use_zaak_omschrijving_as_title(apps, _): | ||
from open_inwoner.openzaak.constants import ZaakTitleDisplayChoices | ||
|
||
OpenZaakConfig = apps.get_model("openzaak", "OpenZaakConfig") | ||
|
||
if config := OpenZaakConfig.objects.first(): | ||
if config.derive_zaak_titel_from == ZaakTitleDisplayChoices.zaak_omschrijving: | ||
config.use_zaak_omschrijving_as_title = True | ||
else: | ||
config.use_zaak_omschrijving_as_title = False | ||
|
||
config.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("openzaak", "0059_openzaakconfig_show_cases_without_status"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="openzaakconfig", | ||
name="derive_zaak_titel_from", | ||
field=models.CharField( | ||
choices=[ | ||
( | ||
"zaak_omschrijving", | ||
"The description of the case (`zaak.omschrijving`)", | ||
), | ||
( | ||
"zaaktype_omschrijving", | ||
"The description of the case's type (`zaaktype.omschrijving`)", | ||
), | ||
( | ||
"zaaktype_onderwerp", | ||
"The subject of the case's type (`zaaktype.onderwerp`)", | ||
), | ||
], | ||
default="zaaktype_omschrijving", | ||
help_text="Which field from the underlying zaaksysteem to use to display the title for a zaak (e.g. on the Mijn Aanvragen page).", | ||
verbose_name="Derive the case title from", | ||
), | ||
), | ||
migrations.RunPython( | ||
code=migrate_use_zaak_omschrijving_as_title, | ||
reverse_code=reverse_migrate_use_zaak_omschrijving_as_title, | ||
), | ||
migrations.RemoveField( | ||
model_name="openzaakconfig", | ||
name="use_zaak_omschrijving_as_title", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters