Bug 31330 - Branchcode used for routing preview can be wrong
Summary: Branchcode used for routing preview can be wrong
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 31318
Blocks: 2894
  Show dependency treegraph
 
Reported: 2022-08-09 12:55 UTC by Jonathan Druart
Modified: 2024-10-11 08:06 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 31330: Routing preview - Use the library from the selected issue (10.22 KB, patch)
2022-08-09 13:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 31330: Routing preview - Use the library from the selected issue (10.85 KB, patch)
2024-05-21 09:44 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 31330: Don't pass serial_escaped (2.77 KB, patch)
2024-05-21 09:44 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-08-09 12:55:07 UTC
Noticed when working on bug 31318, and discussed on IRC http://irc.koha-community.org/koha/2022-08-09#i_2443598

It seems that we adding/modifying the hold using the holdingbranch of the serial item published first. If no item is created (or no holdingbranch), we are using the subscription.branchcode

Shouldn't we use the branchcode of the issue we previously created (if an item exist) instead of the first published one?
Comment 1 Katrin Fischer 2022-08-09 12:58:56 UTC
The fallback to subscription.branchcode makes sense.

But as you wrote, I think using the first item makes no sense - what if you moved part of the holdings into a "closed stacks" library location or just to another branch. This could easily happen in academic libraries where the newest issues might be kept somewhere else than the older less requested items.

If an item is linked to the serial via serialitems, we should use the info of this specific item.
Comment 2 Jonathan Druart 2022-08-09 13:23:28 UTC
Created attachment 138912 [details] [review]
Bug 31330: Routing preview - Use the library from the selected issue
Comment 3 Jonathan Druart 2022-08-09 13:25:35 UTC
The code looked so wrong. I have the feeling that this patch is correcting a problem, and clean the code a bit, but I need someone familiar with this page to know if it's correct.

The change is about the library used to generate the hold, should it be the one from the holding library (if an item has been created with the serial item)? The one from the first published serial item?
If no items have been created then the library from the subscription is used.
Comment 4 Jonathan Druart 2022-08-09 13:26:12 UTC
code wise more fixes are needed here, especially the creation of methods for Koha::Serial::Item, but that's not in the scope.
Comment 5 Katrin Fischer 2022-08-09 15:16:14 UTC
> The change is about the library used to generate the hold, should it be the
> one from the holding library (if an item has been created with the serial
> item)? The one from the first published serial item?
> If no items have been created then the library from the subscription is used.

Hm, the hold feature has been broken for so long, that I have never seen it working :(

Bug 2894 - Routing list holds are broken

So you are probably right about the code not being correct. 

I think it if there is no item, you can't place a hold and the hold should be an item level hold (it needs to be as serial items represent a specific issue and are not identical).

If you have created multiple items on receiving the issue (a recent feature given the age of this code) we might need to pick one, which makes it more complicate than it was in the past maybe.

I thought this was a display question for the routing slip until now... should we move the hold stuff elsewhere or does it need to be solved?
Comment 6 Jonathan Druart 2024-05-21 09:44:44 UTC
Created attachment 166955 [details] [review]
Bug 31330: Routing preview - Use the library from the selected issue
Comment 7 Jonathan Druart 2024-05-21 09:44:46 UTC
Created attachment 166956 [details] [review]
Bug 31330: Don't pass serial_escaped

What's the point of this? Am I missing something here?
Comment 8 Jonathan Druart 2024-05-21 09:45:40 UTC
Rebased and adjust. Can we get this moving again? I am a bit lost to be honest. 
What's needed? Happy to work on it if I get some guidance.
Comment 9 Fridolin Somers 2024-09-23 08:32:08 UTC
Hi

Any news ? Is this enhancement or bug ?
Comment 10 Jonathan Druart 2024-09-23 08:38:50 UTC
(In reply to Fridolin Somers from comment #9)
> Hi
> 
> Any news ? Is this enhancement or bug ?

Why are you asking? We need more eyes on this, so if someone at BibLibre could help it would be great.

Look at this and bug 2894.

What's the expected behaviour? Are the patches fixing the problem correctly?
Comment 11 Fridolin Somers 2024-10-11 07:30:24 UTC
A librarian asked about this saying it is a bug.
Comment 12 Jonathan Druart 2024-10-11 08:06:16 UTC
Can they test the patch and confirm it fixes the issue as they would expect?