Summary: | Smart-rules prefills junk date on page load | ||
---|---|---|---|
Product: | Koha | Reporter: | Peter Vashchuk <stalkernoid> |
Component: | System Administration | Assignee: | Peter Vashchuk <stalkernoid> |
Status: | Pushed to main --- | QA Contact: | Nick Clemens (kidclamp) <nick> |
Severity: | normal | ||
Priority: | P5 - low | CC: | gmcharlt |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
25.05.00
|
|
Circulation function: | |||
Attachments: |
Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt
Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt Bug 32949: Fix wrong input id Bug 32949: Fix wrong input id Bug 32949: Fix wrong input id |
Description
Peter Vashchuk
2023-02-13 13:51:06 UTC
What is a junk date? How do you reproduce this bug? Created attachment 146584 [details] [review] Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt When you edit the rule without initializing flatpickr plugin, if you press the save button it will overwrite the date with an empty value, making you lose the dates. This happens because flatpickr plugin's shadow value is not loaded if it's not initialized with a click on that date field. This patch fixes it. 1st Code commit text: To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" and "No automatic renewal after (hard limit)" of that rule to a certain date and save. 3. Edit that same rule again, but this time just save it without any changes. The data for hard due date and hard limit will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore. (In reply to Owen Leonard from comment #1) > What is a junk date? How do you reproduce this bug? Hey Owen, I already had a fix for it, was meant to push it asap after I created this bug, please see the patch and description of it for more info. Created attachment 146587 [details] [review] Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt When you edit the rule without initializing flatpickr plugin, if you press the save button it will overwrite the date with an empty value, making you lose the dates. This happens because flatpickr plugin's shadow value is not loaded if it's not initialized with a click on that date field. This patch fixes it. 1st Code commit text: To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" and "No automatic renewal after (hard limit)" of that rule to a certain date and save. 3. Edit that same rule again, but this time just save it without any changes. The data for hard due date and hard limit will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore. Signed-off-by: Owen Leonard <oleonard@myacpl.org> I don't have the patch applied, but I can't reproduce the issue. I also tried using another date format, but it all behaves nicely: * Set dateformat to DD.MM.YYYY * Create a circulation rule ALL-ALL-Books, with 21.2.2023 as hard due date and auto-renewal before. * Save rule. * Edit rule and save without changes. * Edit rule again - dates are still correct. Tested on master as of today. Also with the standard format MM.DD.YYYY. Can you please have a look? It doesn't seem to be working properly after the introduction of input id's, I will post a fix shortly :) Created attachment 177678 [details] [review] Bug 32949: Fix wrong input id The input id was wrong, so instead "else" was handling the flatpickr data as plain text, which prefilled junk data and therefore resetting value of "Hard due date" field to "None defined". To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" that rule to a certain date and save. 3. Edit that same rule again, but this time save it without any changes. Do not click or interact with flatpickr field. Date for hard due date will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore. Created attachment 177724 [details] [review] Bug 32949: Fix wrong input id The input id was wrong, so instead "else" was handling the flatpickr data as plain text, which prefilled junk data and therefore resetting value of "Hard due date" field to "None defined". To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" that rule to a certain date and save. 3. Edit that same rule again, but this time save it without any changes. Do not click or interact with flatpickr field. Date for hard due date will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore. Signed-off-by: Magnus Enger <magnus@libriotech.no> Followed test plan, works as advertised. Created attachment 177925 [details] [review] Bug 32949: Fix wrong input id The input id was wrong, so instead "else" was handling the flatpickr data as plain text, which prefilled junk data and therefore resetting value of "Hard due date" field to "None defined". To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" that rule to a certain date and save. 3. Edit that same rule again, but this time save it without any changes. Do not click or interact with flatpickr field. Date for hard due date will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore. Signed-off-by: Magnus Enger <magnus@libriotech.no> Followed test plan, works as advertised. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Pushed for 25.05! Well done everyone, thank you! |