Bug 40034: Only check notforloan on itemtype if it exists
This patch makes the code in `CheckReserves` survive the non-existence of the referenced item type in the `items` table for the passed item. To test: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/Reserves.t => FAIL: Tests explode like this: ``` Can't call method "notforloan" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 870. ``` 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
6c26ce01d3
commit
854783c836
|
|
@ -865,10 +865,11 @@ sub CheckReserves {
|
|||
|
||||
my $dont_trap = C4::Context->preference('TrapHoldsOnOrder') ? $item->notforloan > 0 : $item->notforloan;
|
||||
if ( !$dont_trap ) {
|
||||
my $item_type = $item->effective_itemtype;
|
||||
if ($item_type) {
|
||||
return if Koha::ItemTypes->find($item_type)->notforloan;
|
||||
}
|
||||
my $effective_item_type = $item->effective_itemtype;
|
||||
|
||||
my $item_type = Koha::ItemTypes->find($effective_item_type);
|
||||
return
|
||||
if $item_type && $item_type->notforloan;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue