Bug 36466

Summary: Incorrect date value stored when "Published on" or "Expected on" are empty
Product: Koha Reporter: Hammat wele <hammat.wele>
Component: SerialsAssignee: Hammat wele <hammat.wele>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: caroline.cyr-la-rose, emmi.takkinen, lucas, maude.boudreau, nick, philippe.blouin
Version: MainKeywords: rel_22_11_candidate, rel_23_05_candidate, rel_23_11_candidate
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36488
GIT URL: 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 33039: Incorrect date value stored when 'Published on' or 'Expected on' are empty
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table

Description Hammat wele 2024-03-29 21:14:48 UTC
When we edit a serial and we leave the date fields ("Published on" or "Expected on") empty 
incorrect date are saved in the database 0000-00-00 instade of current date and we get Error 500


to reproduce 
1. Connect to staff interface 
2. Go to Serials and create a new subscription 
3. Click on Serial collection in the left menu (and note the Subscription numnber)
4. Select a serial to edit and Click on «Edit serials»
5. In the Serial edition form, delete «Published on > and « Expected on » dates and save 
 ----> Error 500 page is displayed 
6. Check the value of «Published on > and « Expected on » dates  in the database
    select planneddate,publisheddate from serial where subscriptionid=<Subscription numnber in step 3>;
    ------> planneddate publisheddate have «0000-00-00» value
Comment 1 Hammat wele 2024-03-29 21:35:43 UTC Comment hidden (obsolete)
Comment 2 Hammat wele 2024-03-29 21:53:37 UTC
Created attachment 164155 [details] [review]
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty

When we edit a serial and we leave the date fields ('Published on' or 'Expected on') empty
incorrect date are saved in the database 0000-00-00 instade of current date and we get Error 500

to reproduce
1. Connect to staff interface
2. Go to Serials and create a new subscription
3. Click on Serial collection in the left menu (and note the Subscription numnber)
4. Select a serial to edit and Click on «Edit serials»
5. In the Serial edition form, delete «Published on > and « Expected on » dates and save
 ----> Error 500 page is displayed
6. Check the value of «Published on > and « Expected on » dates  in the database
    select planneddate,publisheddate from serial where subscriptionid=<Subscription numnber in step 3>;
    ------> planneddate publisheddate have «0000-00-00» value
7. Apply the patch
8. repeat step 2, 3, 4, 5, 6
 ----->  Error 500 page is no more displayed
 -----> «Published on » and « Expected on » field have today date
Comment 3 Hammat wele 2024-03-29 22:15:14 UTC
Created attachment 164156 [details] [review]
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table
Comment 4 Owen Leonard 2024-04-02 11:20:50 UTC
Created attachment 164254 [details] [review]
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty

When we edit a serial and we leave the date fields ('Published on' or
'Expected on') empty incorrect date are saved in the database 0000-00-00
instade of current date and we get Error 500

to reproduce
1. Connect to staff interface
2. Go to Serials and create a new subscription
3. Click on Serial collection in the left menu (and note the
   Subscription numnber)
4. Select a serial to edit and Click on «Edit serials»
5. In the Serial edition form, delete «Published on > and « Expected on
   » dates and save
    ----> Error 500 page is displayed
6. Check the value of «Published on > and « Expected on » dates  in the
   database
   select planneddate,publisheddate from serial where
   subscriptionid=<Subscription numnber in step 3>;
    ------> planneddate publisheddate have «0000-00-00» value
7. Apply the patch
8. repeat step 2, 3, 4, 5, 6
   ----->  Error 500 page is no more displayed
   -----> «Published on » and « Expected on » field have today date

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Owen Leonard 2024-04-02 11:20:53 UTC
Created attachment 164255 [details] [review]
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 6 Emmi Takkinen 2024-04-03 07:19:59 UTC
Created attachment 164306 [details] [review]
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty

When we edit a serial and we leave the date fields ('Published on' or
'Expected on') empty incorrect date are saved in the database 0000-00-00
instade of current date and we get Error 500

to reproduce
1. Connect to staff interface
2. Go to Serials and create a new subscription
3. Click on Serial collection in the left menu (and note the
   Subscription numnber)
4. Select a serial to edit and Click on «Edit serials»
5. In the Serial edition form, delete «Published on > and « Expected on
   » dates and save
    ----> Error 500 page is displayed
6. Check the value of «Published on > and « Expected on » dates  in the
   database
   select planneddate,publisheddate from serial where
   subscriptionid=<Subscription numnber in step 3>;
    ------> planneddate publisheddate have «0000-00-00» value
7. Apply the patch
8. repeat step 2, 3, 4, 5, 6
   ----->  Error 500 page is no more displayed
   -----> «Published on » and « Expected on » field have today date

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 7 Emmi Takkinen 2024-04-03 07:20:33 UTC
Created attachment 164307 [details] [review]
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 8 Nick Clemens (kidclamp) 2024-05-10 18:49:04 UTC
Created attachment 166601 [details] [review]
Bug 36466: Incorrect date value stored when 'Published on' or 'Expected on' are empty

When we edit a serial and we leave the date fields ('Published on' or
'Expected on') empty incorrect date are saved in the database 0000-00-00
instade of current date and we get Error 500

to reproduce
1. Connect to staff interface
2. Go to Serials and create a new subscription
3. Click on Serial collection in the left menu (and note the
   Subscription numnber)
4. Select a serial to edit and Click on «Edit serials»
5. In the Serial edition form, delete «Published on > and « Expected on
   » dates and save
    ----> Error 500 page is displayed
6. Check the value of «Published on > and « Expected on » dates  in the
   database
   select planneddate,publisheddate from serial where
   subscriptionid=<Subscription numnber in step 3>;
    ------> planneddate publisheddate have «0000-00-00» value
7. Apply the patch
8. repeat step 2, 3, 4, 5, 6
   ----->  Error 500 page is no more displayed
   -----> «Published on » and « Expected on » field have today date

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens (kidclamp) 2024-05-10 18:49:06 UTC
Created attachment 166602 [details] [review]
Bug 36466: (follow-up) Adding atomicupdate file to fix 0000-00-00 in serial table

WNC amended patch - tidied

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Nick Clemens (kidclamp) 2024-05-10 18:50:19 UTC
Moving from enhancement

Passing QA, but leaving a question for RM:
The atomicupdate sets the dates to NULL, which is valid
The code now sets blank dates to TODAY - is this correct? Or should it just be NULL?
Comment 11 Katrin Fischer 2024-05-14 13:23:02 UTC
I am really interested in this one since we have been seeing issues with dates in subscriptions ourselves since the last update (flatpickr), but I need a little bit longer to test here.
Comment 12 Katrin Fischer 2024-05-17 09:51:44 UTC
I can confirm that we have been seeing these issues especially with "irregular" patterns where the next issue date is empty and should be empty in 22.11. 
We have quite an issue there right now as libraries are forced to set the "next issue publication" date to work around the error 500.
 
(In reply to Nick Clemens (kidclamp) from comment #10)
> Moving from enhancement
> 
> Passing QA, but leaving a question for RM:
> The atomicupdate sets the dates to NULL, which is valid
> The code now sets blank dates to TODAY - is this correct? Or should it just
> be NULL?

I believe at least for the irregular patterns this doesn't feel correct. We want to have the published and expected dates as NULL for these.

The database update looks correct to me.

Could we get a tiny follow-up here if you agree?