[Bug 26139] New: 'Place Hold' button isn't hidden in all biblio views if there's no items available for loan.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Bug ID: 26139 Summary: 'Place Hold' button isn't hidden in all biblio views if there's no items available for loan. Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: didier.gautheron@biblibre.com QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl At cgi-bin/koha/catalogue/detail.pl 'Place Hold' button is not hidden in : ISBD an Items view -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 107949 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107949&action=edit Bug 26139: Centralize code for "Place hold" button (detail) There is a "norequest" boolean passed to the include cat-toolbar.inc, to display or not the "Pace hold" button. This flag was not calculated in some place (ISBDdetail and moredetail for instance) Here we centralize the code to make it more robust and less regression prone. Note that the same problem appears at the OPAC (opac-MARCdetail is always display the button). That will have to be fixed separately Test plan: Create biblio A with 0 item, B and C with 1 item and D with 2 items item for B is not for loan, C is for loan and D has 1 of each Go to the bibliographic detail page of each record and confirm that the "Place hold" button appears appropriately. Test the different tabs of the catalogue module -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23166 CC| |jonathan.druart@bugs.koha-c | |ommunity.org Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org Severity|trivial |normal --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Depending on bug 23166 for Context.Scalar Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23166 [Bug 23166] Simplify code related to orders in catalogue/*detail.pl -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 didier <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #3 from didier <didier.gautheron@biblibre.com> --- A with 0 item, button is there ! BAD B with 1 item not for loan , no button GOOD C with 1 item for loan, button is there GOOD D with 2 items, only one for loan, button is there GOOD -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107949|0 |1 is obsolete| | --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 108159 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108159&action=edit Bug 26139: Centralize code for "Place hold" button (detail) There is a "norequest" boolean passed to the include cat-toolbar.inc, to display or not the "Pace hold" button. This flag was not calculated in some place (ISBDdetail and moredetail for instance) Here we centralize the code to make it more robust and less regression prone. Note that the same problem appears at the OPAC (opac-MARCdetail is always display the button). That will have to be fixed separately Test plan: Create biblio A with 0 item, B and C with 1 item and D with 2 items item for B is not for loan, C is for loan and D has 1 of each Go to the bibliographic detail page of each record and confirm that the "Place hold" button appears appropriately. Test the different tabs of the catalogue module QA note: This patch is only centralizing the existing code, but it is still too naive. To manage the visibility of this button we certainly want to copy what is done in C4::Search::searchResults: # can place a hold on a item if # not lost nor withdrawn # not damaged unless AllowHoldsOnDamagedItems is true # item is either for loan or on order (notforloan < 0) $can_place_holds = 1 if ( !$item->{itemlost} && !$item->{withdrawn} && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') ) && ( !$item->{notforloan} || $item->{notforloan} < 0 ) ); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 didier <didier.gautheron@biblibre.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=26139 didier <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108159|0 |1 is obsolete| | --- Comment #5 from didier <didier.gautheron@biblibre.com> --- Created attachment 108379 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108379&action=edit Bug 26139: Centralize code for "Place hold" button (detail) There is a "norequest" boolean passed to the include cat-toolbar.inc, to display or not the "Pace hold" button. This flag was not calculated in some place (ISBDdetail and moredetail for instance) Here we centralize the code to make it more robust and less regression prone. Note that the same problem appears at the OPAC (opac-MARCdetail is always display the button). That will have to be fixed separately Test plan: Create biblio A with 0 item, B and C with 1 item and D with 2 items item for B is not for loan, C is for loan and D has 1 of each Go to the bibliographic detail page of each record and confirm that the "Place hold" button appears appropriately. Test the different tabs of the catalogue module QA note: This patch is only centralizing the existing code, but it is still too naive. To manage the visibility of this button we certainly want to copy what is done in C4::Search::searchResults: # can place a hold on a item if # not lost nor withdrawn # not damaged unless AllowHoldsOnDamagedItems is true # item is either for loan or on order (notforloan < 0) $can_place_holds = 1 if ( !$item->{itemlost} && !$item->{withdrawn} && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') ) && ( !$item->{notforloan} || $item->{notforloan} < 0 ) ); Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|'Place Hold' button isn't |'Place Hold' button isn't |hidden in all biblio views |hidden in all detail views |if there's no items |if there are no items |available for loan. |available for loan -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|'Place Hold' button isn't |'Place hold' button isn't |hidden in all detail views |hidden in all detail views |if there are no items |if there are no items |available for loan |available for loan -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |BLOCKED --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This depends on bug 23166 that hasn't been signed off yet - moving to BLOCKED. Please bring it back into the QA queue once the dependency is resolved. This patch also does no longer apply. Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 26139: Centralize code for "Place hold" button (detail) Using index info to reconstruct a base tree... M t/db_dependent/Koha/Items.t Falling back to patching base and 3-way merge... Auto-merging t/db_dependent/Koha/Items.t CONFLICT (content): Merge conflict in t/db_dependent/Koha/Items.t error: Failed to merge in the changes. Patch failed at 0001 Bug 26139: Centralize code for "Place hold" button (detail) The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-26139-Centralize-code-for-Place-hold-button-de-zcySqH.patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 108965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108965&action=edit Bug 26139: Koha::Template::Plugin::Context There is something wrong with our ->search method and TT behaviours, it is hard to retrieve object list in a scalar context. If [% objects.method.count %] is called, objects.method will get the first object of the list and count will explode (Koha::Object->count does not exist) We need to force the call in a scalar context to retrieve an iterator and prevent to fetch all the objects (we could have called all then size, but it's not efficient) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Signed Off See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=23166 Depends on|23166 | --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- This patch removes the dependency on bug 23166. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23166 [Bug 23166] Simplify code related to orders in catalogue/*detail.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108379|0 |1 is obsolete| | --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 108966 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108966&action=edit Bug 26139: Centralize code for "Place hold" button (detail) There is a "norequest" boolean passed to the include cat-toolbar.inc, to display or not the "Pace hold" button. This flag was not calculated in some place (ISBDdetail and moredetail for instance) Here we centralize the code to make it more robust and less regression prone. Note that the same problem appears at the OPAC (opac-MARCdetail is always display the button). That will have to be fixed separately Test plan: Create biblio A with 0 item, B and C with 1 item and D with 2 items item for B is not for loan, C is for loan and D has 1 of each Go to the bibliographic detail page of each record and confirm that the "Place hold" button appears appropriately. Test the different tabs of the catalogue module QA note: This patch is only centralizing the existing code, but it is still too naive. To manage the visibility of this button we certainly want to copy what is done in C4::Search::searchResults: # can place a hold on a item if # not lost nor withdrawn # not damaged unless AllowHoldsOnDamagedItems is true # item is either for loan or on order (notforloan < 0) $can_place_holds = 1 if ( !$item->{itemlost} && !$item->{withdrawn} && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') ) && ( !$item->{notforloan} || $item->{notforloan} < 0 ) ); Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@helsinki.fi Status|Signed Off |Needs Signoff --- Comment #10 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- Moving back to "Needs Signoff" since the patch "Bug 26139: Koha::Template::Plugin::Context" is not reviewed yet by anybody. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Joonas Kylmälä from comment #10)
Moving back to "Needs Signoff" since the patch "Bug 26139: Koha::Template::Plugin::Context" is not reviewed yet by anybody.
It has been tested by Didier when he first tested this patch. Koha::Template::Plugin::Context is coming from another bug report, I isolated it to note depend on another bug report. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #12 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- I get the following error with biblio without items when I click the ISBD view in biblio page in staff interface:
Template process failed: undef error - Can't call method "filter_by_for_loan" on unblessed reference at /kohadevbox/koha/Koha/Template/Plugin/Context.pm line 43. at /kohadevbox/koha/C4/Templates.pm line 122 C4::Templates::output('C4::Templates=HASH(0x56350c1d2188)') called at /kohadevbox/koha/catalogue/moredetail.pl line 301 eval {...} at /kohadevbox/koha/catalogue/moredetail.pl line 2 CGI::Compile::ROOT::kohadevbox_koha_catalogue_moredetail_2epl::__ANON__('CGI::Compile=HASH(0x56350a3aafa0)', '', '/kohadevbox/koha/catalogue/moredetail.pl', '/kohadevbox/koha/catalogue', 'ARRAY(0x56350b321fb0)') called at /usr/share/perl5/CGI/Compile.pm line 139
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23166 --- Comment #13 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Re-adding the dependency, we need it for some minor refactoring, not only the TT plugin. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23166 [Bug 23166] Simplify code related to orders in catalogue/*detail.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108966|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |BLOCKED --- Comment #14 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Blocked by bug 23166. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108966|1 |0 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108965|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108966|0 |1 is obsolete| | --- Comment #15 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- Created attachment 109057 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=109057&action=edit Bug 26139: Centralize code for "Place hold" button (detail) There is a "norequest" boolean passed to the include cat-toolbar.inc, to display or not the "Pace hold" button. This flag was not calculated in some place (ISBDdetail and moredetail for instance) Here we centralize the code to make it more robust and less regression prone. Note that the same problem appears at the OPAC (opac-MARCdetail is always display the button). That will have to be fixed separately Test plan: Create biblio A with 0 item, B and C with 1 item and D with 2 items item for B is not for loan, C is for loan and D has 1 of each Go to the bibliographic detail page of each record and confirm that the "Place hold" button appears appropriately. Test the different tabs of the catalogue module QA note: This patch is only centralizing the existing code, but it is still too naive. To manage the visibility of this button we certainly want to copy what is done in C4::Search::searchResults: # can place a hold on a item if # not lost nor withdrawn # not damaged unless AllowHoldsOnDamagedItems is true # item is either for loan or on order (notforloan < 0) $can_place_holds = 1 if ( !$item->{itemlost} && !$item->{withdrawn} && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') ) && ( !$item->{notforloan} || $item->{notforloan} < 0 ) ); Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, 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=26139 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #17 from Lucas Gass <lucas@bywatersolutions.com> --- missing dependencies for 20.05.x, no backport -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26139 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |28286 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28286 [Bug 28286] Place hold button not displayed when biblio has only Ordered items -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org