Bug 19315 - Routing preview may use wrong biblionumber
Summary: Routing preview may use wrong biblionumber
Status: Pushed to Master
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Marcel de Rooy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-14 12:22 UTC by Nick Clemens
Modified: 2017-10-29 18:20 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 19315 - Use bibnum instead of biblionumber in routing-preview.pl and add item check (1.71 KB, patch)
2017-09-14 12:26 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19315 - Use bibnum instead of biblionumber in routing-preview.pl and add item check (1.79 KB, patch)
2017-09-15 20:14 UTC, Caroline Cyr La Rose
Details | Diff | Splinter Review
Bug 19315 - Use bibnum instead of biblionumber in routing-preview.pl and add item check (1.88 KB, patch)
2017-10-06 06:25 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19315: [QA Follow-up] Trivial edits (1.26 KB, patch)
2017-10-06 06:25 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2017-09-14 12:22:46 UTC
When generating the routing preview from the serials collection screen:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=##

the subscription information is obtained via a mysql call in C4::Serials::GetSubscription, however, the statement pulls subscription.* and subscriptionhistory.*

Both of these have a biblionumber field, so when routing-preview.pl pulls the biblionumber it may get bad information
Comment 1 Nick Clemens 2017-09-14 12:26:50 UTC
Created attachment 67134 [details] [review]
Bug 19315 - Use bibnum instead of biblionumber in routing-preview.pl and add item check

To test:
 1 - Create a serial subscription attached to a record
 2 - Receive some issues
 3 - Edit the subscription
 4 - Go to serails collection
 5 - Try to print a routing list
 6 - You may or may not get the right serial
 7 - Additionally create a subscription attached to a bib with no items
 8 - Try to print a routing list for this serial
 9 - You will get 'Internal server error'
10 - Apply patch
11 - Print routing list for first serial
12 - You will always get the correct bib
13 - Print routing list for second serial
14 - You should no longer get an error
Comment 2 Caroline Cyr La Rose 2017-09-15 19:43:13 UTC
At step 5, I'm getting the error message : "Can't call method "branchname" on an undefined value at /inlibro/git/koha-master-dev-inlibro/serials/routing-preview.pl line 72." Is it something I'm doing wrong?

I didn't apply the patch yet.
Comment 3 Caroline Cyr La Rose 2017-09-15 19:57:15 UTC
At step 9, I get a software error :"Can't call method "store" on an undefined value at /inlibro/git/koha-master-dev-inlibro/C4/Reserves.pm line 907."

After applying the patch, everything/both routing lists works! yay! 

It's hard to know if I would've gotten the right info on the first routing list (steps 1-6)
Comment 4 Caroline Cyr La Rose 2017-09-15 20:14:30 UTC
Created attachment 67164 [details] [review]
Bug 19315 - Use bibnum instead of biblionumber in routing-preview.pl and add item check

To test:
 1 - Create a serial subscription attached to a record
 2 - Receive some issues
 3 - Edit the subscription
 4 - Go to serails collection
 5 - Try to print a routing list
 6 - You may or may not get the right serial
 7 - Additionally create a subscription attached to a bib with no items
 8 - Try to print a routing list for this serial
 9 - You will get 'Internal server error'
10 - Apply patch
11 - Print routing list for first serial
12 - You will always get the correct bib
13 - Print routing list for second serial
14 - You should no longer get an error

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 5 Marcel de Rooy 2017-10-06 06:25:45 UTC
Created attachment 67668 [details] [review]
Bug 19315 - Use bibnum instead of biblionumber in routing-preview.pl and add item check

To test:
 1 - Create a serial subscription attached to a record
 2 - Receive some issues
 3 - Edit the subscription
 4 - Go to serails collection
 5 - Try to print a routing list
 6 - You may or may not get the right serial
 7 - Additionally create a subscription attached to a bib with no items
 8 - Try to print a routing list for this serial
 9 - You will get 'Internal server error'
10 - Apply patch
11 - Print routing list for first serial
12 - You will always get the correct bib
13 - Print routing list for second serial
14 - You should no longer get an error

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2017-10-06 06:25:49 UTC
Created attachment 67669 [details] [review]
Bug 19315: [QA Follow-up] Trivial edits

Replace $subs->{bibnum} by $biblionumber on a following line.
The scalar in the boolean expression is not needed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2017-10-06 06:27:18 UTC
Nick: Isnt there anything to be done on the GetSubscription output? Whats the use of the 'wrong' biblionumber ?
Comment 8 Nick Clemens 2017-10-06 09:48:48 UTC
(In reply to Marcel de Rooy from comment #7)
> Nick: Isnt there anything to be done on the GetSubscription output? Whats
> the use of the 'wrong' biblionumber ?

Technically yes, the 'wrong' biblionumber can't reliably be used for anything, it's more convenience as you can't get 'all columns but one'

Right now we have:
SELECT  subscription.*,
        subscriptionhistory.*,

And to fix we would have to list every field individually:
SELECT  subscription.subscriptionid,subscription.biblionumber AS sbiblionumber,librarian, startdate...
        subscriptionhistory.biblionumber AS shbiblionumber,histstartdatem histenddate,missinglist...
Comment 9 Jonathan Druart 2017-10-06 15:18:47 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 10 Fridolin SOMERS 2017-10-27 10:58:25 UTC
I test for 17.05.x :

With patches applied.
I have create a subscription without branch nor items.
Printing a routing list for this serial returns an error :
    Can't call method "branchname" on an undefined value at /home/koha/src/serials/routing-preview.pl line 71.

Maybe $branch should be tested : 
  - my $branchname = Koha::Libraries->find($branch)->branchname;
  + my $branchname = Koha::Libraries->find($branch)->branchname if $branch;
Comment 11 Katrin Fischer 2017-10-29 18:20:46 UTC
Patches don't apply cleanly on 16.11.x, please rebase if you want this to be included.