[Bug 27131] New: Move code from circ/pendingreserves.pl to modules
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Bug ID: 27131 Summary: Move code from circ/pendingreserves.pl to modules Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org We need the code covered by tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24488 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24488 [Bug 24488] Holds to Pull sometimes shows the wrong 'first patron' details -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 114085 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=114085&action=edit Bug 27131: Add get_items_that_can_fill -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@helsinki.fi --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Joonas, is that what you had in mind? Or where you talking about more code? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- This bug report has been opened after the discussion on bug 24488 starting at bug 24488 comment 127 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #4 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- (In reply to Jonathan Druart from comment #2)
Joonas, is that what you had in mind? Or where you talking about more code?
Thanks! Something like this but I hope we could add more checks here for this to be useful for many other places in Koha, at least similar stuff is needed in <https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26659#c6>. So ideally this would be the same check as when you check-in a book in staff interface and Koha check's whether the item can satisfy any of the holds in that biblio using this item. This includes checking also circulation rules. Currently the pendingreserves.pl has more bugs than just the incorrect patron information, it lists at least also wrong amount of items to pull and wrongs items / callnumbers to pull. To achieve a reusable solution across the whole Koha codebase we probably need to go on more granular level: Koha::Item::can_fill_hold Koha::Hold::get_items_that_can_fill Koha::Holds::get_items_that_can_fill -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #5 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- To further elaborate on the idea when we have Koha::Holds::get_items_that_can_fill then we could have in pendingreserves.pl something like this for biblio in biblios_with_holds: holds = biblio->holds items = holds->get_items_that_can_fill callnums = _get_callnumbers(items) itemtypes = _get_itypes(items) first_hold = biblio->first_hold_to_fill push @reservedata, { biblio->biblionumber, first_hold->hold_id, callnums, itemtypes .. } -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |black23@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 114851 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=114851&action=edit Bug 27131: Add tests for get_items_that_can_fill -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Joonas Kylmälä from comment #5)
To further elaborate on the idea when we have
Koha::Holds::get_items_that_can_fill
then we could have in pendingreserves.pl something like this
for biblio in biblios_with_holds: holds = biblio->holds items = holds->get_items_that_can_fill callnums = _get_callnumbers(items) itemtypes = _get_itypes(items) first_hold = biblio->first_hold_to_fill
push @reservedata, { biblio->biblionumber, first_hold->hold_id, callnums, itemtypes .. }
We need to limit the number of queries. Doing that will be linear and will depend on the number of biblios, I am not sure it's a good idea. I've attached some tests, I don't think we can do more here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #114851|0 |1 is obsolete| | --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 114852 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=114852&action=edit Bug 27131: Add tests for get_items_that_can_fill -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #9 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- (In reply to Jonathan Druart from comment #7)
We need to limit the number of queries. Doing that will be linear and will depend on the number of biblios, I am not sure it's a good idea.
I've attached some tests, I don't think we can do more here.
We show 10 biblios on the pendingreserves.pl page so I don't see any major performance issues coming in this case. I think the current patches sent here are however an improvement already and can be further refined later so we could take them in the current form. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Joonas Kylmälä from comment #9)
We show 10 biblios on the pendingreserves.pl page so I don't see any major performance issues coming in this case.
Are you sure about that? IIRC only 10 are shown by DataTables, but all are loaded. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #11 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- (In reply to Jonathan Druart from comment #10)
(In reply to Joonas Kylmälä from comment #9)
We show 10 biblios on the pendingreserves.pl page so I don't see any major performance issues coming in this case.
Are you sure about that? IIRC only 10 are shown by DataTables, but all are loaded.
It probably is how you say, but it is not an issue, just have to fix the bug. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27718 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27718 [Bug 27718] Holds to Pull list doesn't respect holdallowed circulation rule anymore -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #114085|0 |1 is obsolete| | Attachment #114852|0 |1 is obsolete| | --- Comment #12 from Andrew Nugged <nugged@gmail.com> --- Created attachment 116969 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=116969&action=edit Bug 27131: Add get_items_that_can_fill Signed-off-by: Andrew Nugged <nugged@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #13 from Andrew Nugged <nugged@gmail.com> --- Created attachment 116970 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=116970&action=edit Bug 27131: Add tests for get_items_that_can_fill Signed-off-by: Andrew Nugged <nugged@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |BLOCKED QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QAing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|BLOCKED |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #116969|0 |1 is obsolete| | --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 116971 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=116971&action=edit Bug 27131: Add get_items_that_can_fill Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #116970|0 |1 is obsolete| | --- Comment #16 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 116972 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=116972&action=edit Bug 27131: Add tests for get_items_that_can_fill Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #17 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 116973 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=116973&action=edit Bug 27131: (QA follow-up) POD and comments Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #18 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- This change looks good to me, but I certainly expected to see more code moving from the pending holds script to a module when I qa'ed the previous one. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #19 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Hi Marcel, thanks for QAing. Which code from the controller do you have in mind? I had a look carefully and I cannot think of some business code we could move to a module. There are 1. lot a search calls and 2. a loop with very specific code to set variables for the template. IMO none of them will profit from being moved. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #20 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #19)
Hi Marcel, thanks for QAing.
Which code from the controller do you have in mind? I had a look carefully and I cannot think of some business code we could move to a module. There are 1. lot a search calls and 2. a loop with very specific code to set variables for the template. IMO none of them will profit from being moved.
I had this expectation in general, not took the time to give specific details. But you did. Maybe we can improve further later on. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #21 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 116977 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=116977&action=edit Bug 27131: Improve POD for the new method -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |21.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #22 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 21.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |fridolin.somers@biblibre.co | |m Status|Pushed to master |RESOLVED --- Comment #23 from Fridolin Somers <fridolin.somers@biblibre.com> --- Depends on Bug 24488 not in 20.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nugged@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #24 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Aren't we missing damaged (and AllowHoldsOnDamagedItems) here? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #25 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- (In reply to Jonathan Druart from comment #24)
Aren't we missing damaged (and AllowHoldsOnDamagedItems) here?
In get_items_that_can_fill? If so, there also a lot more things missing. As per my original suggestion we should not re-invent the reservability checking but use CanItemBeReserved, etc. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 --- Comment #26 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Joonas Kylmälä from comment #25)
(In reply to Jonathan Druart from comment #24)
Aren't we missing damaged (and AllowHoldsOnDamagedItems) here?
In get_items_that_can_fill? If so, there also a lot more things missing. As per my original suggestion we should not re-invent the reservability checking but use CanItemBeReserved, etc.
I've attached some patches on bug 3142. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27131 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |3142 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3142 [Bug 3142] standardize how OPAC and staff determine requestability -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org