The "Place hold" button doesn't show up if there are only Ordered items, but it should since it is possible to place a hold for Ordered item. To reproduce go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX and add first 1 item with notforloan = 0 and notice the "Place hold" button shows, then change the notforloan value to -1 / Ordered and notice the hold button disappears. The bug happens because in koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc we decide whether to show the button based on if there are loanable items and not holdable items: > [% IF Context.Scalar(Context.Scalar(items, "filter_by_for_loan"), "count") %] The call here should be changed to "filter_by_for_hold" in order to fix the issue.
Created attachment 120521 [details] [review] Bug 28286: show "Place hold" button if item is holdable This patch adds "filter_by_for_hold" method in "Items.pm" and uses it in "cat-toolbar.inc" instead of "filter_by_for_load". To reproduce the bug: 1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has item with notforloan value set as "Ordered" (-1) 2) see that button "Place hold" is not present 3) apply the patch 4) refresh the page and ensure that "Place hold" button appears even if item is "Ordered"
Created attachment 120618 [details] [review] Bug 28286: show "Place hold" button if item is holdable This patch adds "filter_by_for_hold" method in "Items.pm" and uses it in "cat-toolbar.inc" instead of "filter_by_for_load". To reproduce the bug: 1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has item with notforloan value set as "Ordered" (-1) 2) see that button "Place hold" is not present 3) apply the patch 4) refresh the page and ensure that "Place hold" button appears even if item is "Ordered"
Created attachment 120619 [details] [review] Bug 28286: tests for "filter_by_for_hold" method
Please remove the old filter_by_for_loan() function completely because it becomes unused after your change.
The comment just above your changes: > [%# biblio.items.filter_by_for_loan.count %] should also be removed.
Created attachment 120668 [details] [review] Bug 28286: show "Place hold" button if item is holdable This patch adds "filter_by_for_hold" method in "Items.pm" and uses it in "cat-toolbar.inc" instead of "filter_by_for_load". Also this patch removes "filter_by_for_loan" method. To reproduce the bug: 1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has item with notforloan value set as "Ordered" (-1) 2) see that button "Place hold" is not present 3) apply the patch 4) refresh the page and ensure that "Place hold" button appears even if item is "Ordered"
Created attachment 120672 [details] [review] Bug 28286: show "Place hold" button if item is holdable This patch adds "filter_by_for_hold" method in "Items.pm" and uses it in "cat-toolbar.inc" instead of "filter_by_for_load". Also this patch removes "filter_by_for_loan" method. To reproduce the bug: 1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has item with notforloan value set as "Ordered" (-1) 2) see that button "Place hold" is not present 3) apply the patch 4) refresh the page and ensure that "Place hold" button appears even if item is "Ordered" Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 120674 [details] [review] Bug 28286: show "Place hold" button if item is holdable This patch adds "filter_by_for_hold" method in "Items.pm" and uses it in "cat-toolbar.inc" instead of "filter_by_for_load". Also this patch removes "filter_by_for_loan" method. To reproduce the bug: 1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has item with notforloan value set as "Ordered" (-1) 2) see that button "Place hold" is not present 3) apply the patch 4) refresh the page and ensure that "Place hold" button appears even if item is "Ordered" Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Works as expected - important catch, this one. :)
Created attachment 120701 [details] [review] Bug 28286: show "Place hold" button if item is holdable This patch adds "filter_by_for_hold" method in "Items.pm" and uses it in "cat-toolbar.inc" instead of "filter_by_for_load". Also this patch removes "filter_by_for_loan" method. To reproduce the bug: 1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has item with notforloan value set as "Ordered" (-1) 2) see that button "Place hold" is not present 3) apply the patch 4) refresh the page and ensure that "Place hold" button appears even if item is "Ordered" Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Passing QA, but wondering if this method is really necessary? The 'Place hold' button is the same link as the 'Holds' tab on the left hand side It checks one indicator of whether the items may be holdable or not, but we don't really know holdability until we select a patron. If the items are all not for loan, but AllowHoldPolicyOverride is set, we can place holds but don't see the button. Can we just show the button all the time and remove this single use method?
Created attachment 120768 [details] [review] Bug 28286: Replace < 1 with <= 0 It's the same but read more natural
Pushed to master for 21.05, thanks to everybody involved!
Pushed to 20.11.x for 20.11.06
missing dependencies for 20.05.x, no backport