If there is no subscription histenddate (NULL) in subscriptionhistory, the subscription will show as expired today in the OPAC. I think this happens becasue of this bit in GetSubscriptionsFromBiblionumber: 451 if ( $subs->{enddate} eq '0000-00-00' ) { 452 $subs->{enddate} = ''; 453 } else { 454 $subs->{enddate} = output_pref( { dt => dt_from_string( $subs->{enddate}), dateonly => 1 } ); 455 } I am not sure why this appears to return the current date, but it seems a good candidate to start the search.
Where is it displayed? On opac-detail I see "Subscription from: 01/01/2017 to: now (current)"
Ok click on "More details" and arrived on /opac-serial-issues.pl Since 3.00.00.106 we should not have 0000-00-00 anymore in subscription.enddate, so 451 if ( $subs->{enddate} eq '0000-00-00' ) { should be 451 if ( not defined $subs->{enddate} ) {
Created attachment 59049 [details] [review] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' fixed --TEST PLAN-- 1. Find a record in the OPAC with a serial subscription 2. Check more details under subscription tab 3. The expiration date should be incorrect 4. Apply patch 5. Reload and now the expiration date should now be correct
Created attachment 59050 [details] [review] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' fixed --TEST PLAN-- 1. Find a record in the OPAC with a serial subscription 2. Check more details under subscription tab 3. The expiration date should be incorrect 4. Apply patch 5. Reload and now the expiration date should now be correct
I am not sure why, but Jonathan's suggested change doesn't seem to do the trick: For the subscription without history end date, it still shows the current date in the OPAC for me. For a subscription with an end date in the past, the display is correct. For a subscription end date in the future, the note shows as well. I have restarted Plack to make sure that's not the problem.
Actually it's histenddate that is displayed, not enddate. Katrin, what's the expected behaviour?
You are right, I was not clear in my description, we are always talking about the history end date here. If it's empty, it should not display the subscription as expired - that still happened to my surprised when I applied the patch. I was wondering if we should also check for a subscription history end date in the future, but that seems outside of scope here.
Created attachment 59179 [details] [review] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' fixed --TEST PLAN-- 1) View a subscription with no history end date 2) Search for an item with a subcription in OPAC 3) Under subscription tab click more details 4) The end date will be the current date 5) Apply patch and refresh 6) The end date will be replaced with a message
This is much better, I think the date checking now works correctly. I have a bit worried that patrons won't know what "The subscription has no history end date" means. If the date is empty, it means that the subsription is possibly still active - I think it would be better not to display something in this case. What do you think?
I thought it may be a bit confusing. In the staff checkout it shows a similar field as being blank, but having the title for that field is "History end date" which is why I put the message as that.
I think for the librarians it probably makes sense - more or less. Serials is one of the more complicated modules of Koha. I think for the patrons it might be confusing, that's why I think maybe only show the expired message, but not the other message. I was also pondering to rephrase it to something like "The library still subscribes to this serial", but I am not sure if the history end date is always set if a subscription is not renewed - so that might not be right in all cases.
I'll just remove the line. There should hopefully be no confusion that way
Created attachment 59199 [details] [review] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' --TEST PLAN-- 1) View a subscription with no history end date 2) Search for an item with a subcription in OPAC 3) Under subscription tab click more details 4) The end date will be the current date 5) Apply patch and refresh 6) The end date will not be shown
Comment on attachment 59199 [details] [review] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' Review of attachment 59199 [details] [review]: ----------------------------------------------------------------- My concern with the conditions modified is the poor date handling of MySQL. Sometimes unset dates were 0000-00-00, sometimes they were null. When and how aren't the issue, but for those still using MySQL 5.5 in less than strict mode, defined might not be sufficient. In MySQL 5.7 or strict mode, defined is perfectly okay.
The installation I have seen this in was using Debian, so I think the less strict MySQL and all the dates were empty, not invalid ones. I think it should be ok.
Created attachment 60430 [details] [review] [SIGNED OFF] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' --TEST PLAN-- 1) View a subscription with no history end date 2) Search for an item with a subcription in OPAC 3) Under subscription tab click more details 4) The end date will be the current date 5) Apply patch and refresh 6) The end date will not be shown Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Created attachment 60453 [details] [review] Bug 17865 'If a subscription has no history end date, it shows as expired today in OPAC' --TEST PLAN-- 1) View a subscription with no history end date 2) Search for an item with a subcription in OPAC 3) Under subscription tab click more details 4) The end date will be the current date 5) Apply patch and refresh 6) The end date will not be shown Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Note that this patch also fixes the same problem on /serials/serial-issues.pl
Pushed to master for 17.05, thanks Luke!
This patch has been pushed to 16.11.x and will be in 16.11.04. Thx Luke!
Pushed to 16.05.x, for 16.05.10 release
Pushed to 3.22.x, will be in 3.22.18