- Issue created by @einarulfhednar
- @einarulfhednar opened merge request.
- πͺπΈSpain einarulfhednar
Problem/Motivation
When we have the scheduled newsletter enabled and we want to disable it by unchecking the 'Enable scheduled newsletter' option, visually the option remains checked and in the 'simplenews_scheduler' table of the database the status of the 'activated' column never changes to 0.
This is because, when the data is collected from the database (line 39 of the simplenws_scheduler.module file) a condition is not set to select those rows that have the status of the 'activated' column to 1 and, therefore, it never goes through the else on line 50 of the same file.
Steps to reproduce
- Check Activate scheduled newsletter option.
- Click Save scheduler settings button.
- Uncheck Activate scheduled newsletter option.
- Click Save scheduler settings button.
Proposed resolution
In the data fetching (line 39 of the simplenews_scheduler.module file) add the condition to select the rows of the 'activated' column to 1.
With this we get that, if there are no elements, it passes by else of the condition of line 46 and the variable $checked is set to FALSE.
- Status changed to Needs review
about 1 year ago 3:49pm 23 October 2023 - π©πͺGermany JoCowood Kamp-Lintfort
Hi einarulfhednar,
thank you for your merge request.
I think the solution is good but not perfect. If you add the condition, you cannot access the remaining config of the inactive schedule. If a user wants to disable the scheduling but keeping the interval, date values and so on, this is not possible. The user will loose the rest of the config.
What about setting the following patch? It sets checked based on the record and repairs the conditional invisible state of all following form fields, which was part of the code but broken.
- π©πͺGermany JoCowood Kamp-Lintfort
My colleague goldfit found a bug in my patch. The submit button gets invisible, too. You cannot save a disabled scheduler. This is not part of my changes but the original code. I fixed that in the new patch.
- π©πͺGermany JoCowood Kamp-Lintfort
Hey einarulfhednar,
I would be more then happy to fix this bug in 4.0.0-alpha3 but I need a review. Do you mind reviewing my latest patch from #5?
- Status changed to RTBC
5 months ago 6:35am 12 June 2024 - πΊπ¦Ukraine andriy khomych
I can confirm this issue, it even happens when you enable scheduling.
The #5 patch works, thanks.
I am moving it to RTBC.