Koha/catalogue
Jonathan Druart add2f752b9 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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-25 11:31:49 +02:00
..
detail.pl Bug 26139: Centralize code for "Place hold" button (detail) 2020-08-25 11:31:49 +02:00
export.pl Bug 19995: use Modern::Perl in Catalogue perl scripts 2018-02-05 09:45:47 -03:00
getitem-ajax.pl Bug 22762: Fix items.collection display on receiving 2019-04-25 09:52:31 +00:00
image.pl Bug 19995: use Modern::Perl in Catalogue perl scripts 2018-02-05 09:45:47 -03:00
imageviewer.pl Bug 26139: Centralize code for "Place hold" button (detail) 2020-08-25 11:31:49 +02:00
ISBDdetail.pl Bug 23166: Remove filtering from controllers 2020-08-25 11:31:49 +02:00
issuehistory.pl Bug 21291: (follow-up) Pass subscriptionsnumber to all tools in staff detail's sidebar 2018-10-15 13:40:47 +00:00
item-export.pl Bug 24545: Fix newly added files 2020-02-24 13:31:27 +00:00
itemsearch.pl Bug 24545: Fix license statements 2020-02-24 13:31:26 +00:00
labeledMARCdetail.pl Bug 23166: Remove filtering from controllers 2020-08-25 11:31:49 +02:00
MARCdetail.pl Bug 26139: Centralize code for "Place hold" button (detail) 2020-08-25 11:31:49 +02:00
moredetail.pl Bug 23166: Remove filtering from controllers 2020-08-25 11:31:49 +02:00
search-history.pl
search.pl Bug 5428: Jump back to the search result after deleting a record 2020-08-13 07:55:45 +02:00
showmarc.pl Bug 24545: Fix license statements 2020-02-24 13:31:26 +00:00
stockrotation.pl Bug 24545: Fix license statements 2020-02-24 13:31:26 +00:00
updateitem.pl Bug 18501: Add _set_found_trigger 2020-08-20 12:31:59 +02:00