Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDFHER-39 - deletion of opening hours category #1569

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

kasperbirch1
Copy link
Contributor

@kasperbirch1 kasperbirch1 commented Sep 16, 2024

Link to issue

https://reload.atlassian.net/browse/DDFHER-39

Description

This pull request enables the administrator, local administrator, and editor roles to delete opening hour categories. Upon deletion, the user will be notified of the number of associated opening hours. Additionally, a pre-delete hook has been implemented to automatically remove all related opening hours when a category term is deleted.

Test

https://varnish.pr-1569.dpl-cms.dplplat01.dpl.reload.dk/admin/structure/taxonomy/manage/opening_hours_categories/overview

https://varnish.pr-1569.dpl-cms.dplplat01.dpl.reload.dk/node/10/edit/opening-hours

@github-actions github-actions bot temporarily deployed to pr-1569 September 16, 2024 11:57 Destroyed
@kasperbirch1 kasperbirch1 assigned kasperg, xendk and rasben and unassigned kasperg, xendk and rasben Sep 16, 2024
@kasperbirch1 kasperbirch1 force-pushed the DDFHER-39-deletion-of-opening-hours-category branch from 0bdc5bf to 713d0c3 Compare September 17, 2024 09:11
@github-actions github-actions bot temporarily deployed to pr-1569 September 17, 2024 09:12 Destroyed
Allow the `administrator`, `local administrator`, and `editor` to delete an opening hour category.

Unclear why this setting was previously enabled for `user.role.editor.yml`.
Now, when a user deletes a category, a message will display indicating the number of associated opening hours.

To facilitate this, the `$categoryId` parameter was added to the `loadMultiple` method in the `OpeningHoursRepository`.

At present, no specific action occurs on term deletion. Handling this will be part of the next commit.
This architecture caused several issues, but we eventually discovered that the problem was due to the order of submit callbacks. We resolved it by using `array_unshift($form['actions']['submit']['#submit'], 'dpl_opening_hours_term_delete_submit');` to adjust the order. However, we are not fully satisfied with this approach, and in the next commit, I have implemented `dpl_opening_hours_taxonomy_term_predelete` to handle the deletion process more cleanly.
Implemented `hook_taxonomy_term_predelete()` to automatically delete associated opening hours when a category term is deleted. This ensures that all related opening hours are cleaned up upon term deletion.
@kasperbirch1 kasperbirch1 force-pushed the DDFHER-39-deletion-of-opening-hours-category branch from 713d0c3 to 38ddd85 Compare September 17, 2024 09:33
@github-actions github-actions bot temporarily deployed to pr-1569 September 17, 2024 09:33 Destroyed
@github-actions github-actions bot temporarily deployed to pr-1569 September 18, 2024 07:56 Destroyed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants