Summary: | Improve handling dates in C4::Items | ||
---|---|---|---|
Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
Component: | Cataloging | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | julian.maurice, kyle, m.de.rooy, mikasmith, mtj |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17519 | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 17512: Improve handling dates in C4::Items
[SIGNED-OFF] Bug 17512: Improve handling dates in C4::Items Bug 17512: Improve handling dates in C4::Items |
Description
Marcel de Rooy
2016-10-27 12:55:39 UTC
Created attachment 56920 [details] [review] Bug 17512: Improve handling dates in C4::Items This is a follow-up on the internal server error on 0000-00-00 in the items column onloan. This patch deals with preventing to have such dates at all in the date fields of items. It is accomplished by: [1] Adding a (private) subroutine _mod_item_dates. It takes an item hash and replaces date values if needed. [2] AddItem and ModItem call _koha_new_item resp. koha_modify_item. In these routines a call to the new _mod_item_dates is inserted. [3] Although the routine is actually private, I have added some unit tests to Items.t. Test plan: [1] Add a new item. Fill a correct date in dateaccessioned and an invalid date in Price effective from (=replacementpricedate). [2] Verify that dateaccessioned is saved correctly and replacementpricedate is still null (does not contain 0000-00-00). [3] Edit the item again. Fill some text in dateaccessioned and put a correct date in replacementpricedate. Verify the results. [4] Run t/db_dependent/Items.t Passed step 4 of test plan, however invalid dates still show as 0000-00-00 rather than null when saved for both dateaccessioned and replacementpricedate. (In reply to Mika from comment #2) > Passed step 4 of test plan, however invalid dates still show as 0000-00-00 > rather than null when saved for both dateaccessioned and > replacementpricedate. Thanks for testing ! I cannot reproduce your test results. If am entering e.g. some text "aa" in replacementpricedate, the date will become null in the record, and shows blank on the form. If you test under Plack, please make sure to restart Plack after applying the patches. Could that be a cause ? Created attachment 59759 [details] [review] [SIGNED-OFF] Bug 17512: Improve handling dates in C4::Items This is a follow-up on the internal server error on 0000-00-00 in the items column onloan. This patch deals with preventing to have such dates at all in the date fields of items. It is accomplished by: [1] Adding a (private) subroutine _mod_item_dates. It takes an item hash and replaces date values if needed. [2] AddItem and ModItem call _koha_new_item resp. koha_modify_item. In these routines a call to the new _mod_item_dates is inserted. [3] Although the routine is actually private, I have added some unit tests to Items.t. Test plan: [1] Add a new item. Fill a correct date in dateaccessioned and an invalid date in Price effective from (=replacementpricedate). [2] Verify that dateaccessioned is saved correctly and replacementpricedate is still null (does not contain 0000-00-00). [3] Edit the item again. Fill some text in dateaccessioned and put a correct date in replacementpricedate. Verify the results. [4] Run t/db_dependent/Items.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Thanks Josef. Created attachment 59789 [details] [review] Bug 17512: Improve handling dates in C4::Items This is a follow-up on the internal server error on 0000-00-00 in the items column onloan. This patch deals with preventing to have such dates at all in the date fields of items. It is accomplished by: [1] Adding a (private) subroutine _mod_item_dates. It takes an item hash and replaces date values if needed. [2] AddItem and ModItem call _koha_new_item resp. koha_modify_item. In these routines a call to the new _mod_item_dates is inserted. [3] Although the routine is actually private, I have added some unit tests to Items.t. Test plan: [1] Add a new item. Fill a correct date in dateaccessioned and an invalid date in Price effective from (=replacementpricedate). [2] Verify that dateaccessioned is saved correctly and replacementpricedate is still null (does not contain 0000-00-00). [3] Edit the item again. Fill some text in dateaccessioned and put a correct date in replacementpricedate. Verify the results. [4] Run t/db_dependent/Items.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed to master for 17.05, thanks Marcel! This patch has been pushed to 16.11.x and will be in 16.11.04. Pushed to 3.22.x for 3.22.17 Pushed to 16.05.x, for 16.05.10 release |