Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==)

In C4/XSLT.pm :
 elsif ( exists $itemtypes->{ $item->effective_itemtype }
            && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )

itemtype.notforloan is null by default, its generated a warning in logs.

Test plan :
1) Choose a record with itemtype.notforloan = NULL
2) Perform a search in the OPAC which will return results which
   include the record using XSLT
3) See patch removed warning

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bda9b9e122)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Fridolin Somers 2021-03-04 17:27:16 +01:00
parent d35909e19e
commit fa0af2da9f
1 changed files with 1 additions and 0 deletions

View File

@ -347,6 +347,7 @@ sub buildKohaItemsNamespace {
$substatus = exists $descs{$item->notforloan} ? $descs{$item->notforloan}->{opac_description} : "Not for loan_".$item->notforloan;
}
elsif ( exists $itemtypes->{ $item->effective_itemtype }
&& $itemtypes->{ $item->effective_itemtype }->{notforloan}
&& $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )
{
$status = "reference";