Bug 32168

Summary: Editing date/datetime fields without the dateaccessioned.pl plugin can cause errors
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: CatalogingAssignee: Bugs List <koha-bugs>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: m.de.rooy
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31212
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 32168: Add dateaccessioned.pl to 952 (datelastseen) for new installs

Description Lucas Gass (lukeg) 2022-11-10 16:08:17 UTC
When editing items that are date or datetime formatted without the dateaccessioned cataloging plugin it is quite easy to cause an error. 

To recreate:
1. Make sure some 952 field with dates (datelastseen, dateaccessioned ) are visible in the editor but make sure the dateaccessiond plugin is turned off. 
2. Set the date format system preference to mm/dd/yyyy
3. Edit an item and attempt to edit one of the date fields to something in the correct dateformat, like 11/11/2018.
4. You get an error as Koha is expecting the SQL date type format of YYYY-MM-DD. 

I'm not sure how to best solve this. My first thought is that we should require the dateaccessioned.pl plugin on date fields. 

Or we could add a hint about format?
Comment 1 Katrin Fischer 2022-11-13 23:01:55 UTC
It looks like we already added dateaccessioned.pl to $w, so we could probably also add it to datelastseen? 

Just wondering, if that could cause problems with bug 31212

  925         - tagfield: "952"
  926           tagsubfield: "w"
  927           liblibrarian: "Price effective from"
  928           libopac: "Price effective from"
  929           repeatable: 0
  930           mandatory: 0
  931           kohafield: items.replacementpricedate
  932           tab: 10
  933           authorised_value: ""
  934           authtypecode: ""
  935           value_builder: dateaccessioned.pl
  936           isurl: 0
  937           hidden: 0
  938           frameworkcode: ""
  939           seealso: ""
  940           link: ""
  941           defaultvalue:
Comment 2 Lucas Gass (lukeg) 2023-02-07 23:43:39 UTC
Created attachment 146373 [details] [review]
Bug 32168: Add dateaccessioned.pl to 952 (datelastseen) for new installs
Comment 3 Lucas Gass (lukeg) 2023-02-07 23:48:51 UTC
> Just wondering, if that could cause problems with bug 31212

Yes, I am running into this problem while working on 31212.
Comment 4 Lucas Gass (lukeg) 2023-02-07 23:50:00 UTC
My patch enables dateaccessioned.pl by default with 952$r but should we also do the same for other date fields?
Comment 5 Lucas Gass (lukeg) 2025-01-02 15:15:29 UTC
This can be set to RESOLVED - FIXED due to Bug 37398.