Bug 38100: Items with damaged status are shown in OPAC results as "Not available" even with AllowHoldsOnDamagedItems

Items with damaged status are shown on the OPAC results page as "Not
available" even with AllowHoldsOnDamagedItems set to 'Allow', which is
misleading for the users.  'other/Damaged' status should be assigned
only if AllowHoldsOnDamagedItems is set to 'Don't allow'.

Test plan:
==========

1. Check that AllowHoldsOnDamagedItems system preference is set to
   'Allow'.
2. In librarian interface, change the damaged status of an item by
   setting it to 'Damaged'.
3. In OPAC, make a search for the record with this item attached.  Use
   common words from title to get a list and not a single record.
4. Note that the item in question is labelled as 'Not available'
   (Damaged).
5. Apply the patch; restart_all.
6. Repeat p. 3.  Note that the item is now labelled as 'available for
   loan'.
7. Set AllowHoldsOnDamagedItems system preference is set to 'Don't
   allow'.
8. Repeat p. 3.  Note that the item is now labelled as 'Not available'.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c3dc86286c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit de82706184)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Janusz Kaczmarek 2024-10-04 19:07:12 +00:00 committed by Fridolin Somers
parent b191d95d44
commit dca8dc8e8b
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ sub buildKohaItemsNamespace {
$status = 'other';
$substatus = 'In transit';
}
elsif ($item->damaged) {
elsif ($item->damaged && ! C4::Context->preference('AllowHoldsOnDamagedItems')) {
$status = 'other';
$substatus = "Damaged";
}