Bug 25516: Fix for "Can't call method unblessed on unblessed reference"
Software error:
Can't call method "unblessed" on unblessed reference at ../reserve/request.pl line 581.
was caused by recent commit with `wantarray` removal in sub pickup_locations in ‘Item.pm’
and visible on fresher Perls (where experimental feature "autoderef" removed https://www.effectiveperlprogramming.com/2010/11/use-array-references-with-the-array-operators/ )
To test:
1) Get a clean dev environment after "reset_all"
2) Add an empty record for “Default checkout, hold and return policy” on /cgi-bin/koha/admin/smart-rules.pl.
3) Open item record, like /cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1
4) Observe the error (Can't call method "unblessed" on unblessed reference at ../reserve/request.pl line 581.)
5) Apply patch.
6) Repeat steps 2 and 3.
7) Observe that the error is gone.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
048a6cfc02
commit
8efa607ae5
|
|
@ -577,14 +577,13 @@ foreach my $biblionumber (@biblionumbers) {
|
|||
$item->{pickup_locations} = 'Any library';
|
||||
$item->{pickup_locations_code} = 'all';
|
||||
} else {
|
||||
my $arr_locations = Koha::Items->find($itemnumber)
|
||||
->pickup_locations( { patron => $patron } );
|
||||
|
||||
$item->{pickup_locations} = join( ', ',
|
||||
map { $_->unblessed->{branchname} }
|
||||
Koha::Items->find($itemnumber)
|
||||
->pickup_locations( { patron => $patron } ) );
|
||||
map { $_->unblessed->{branchname} } @$arr_locations);
|
||||
$item->{pickup_locations_code} = join( ',',
|
||||
map { $_->unblessed->{branchcode} }
|
||||
Koha::Items->find($itemnumber)
|
||||
->pickup_locations( { patron => $patron } ) );
|
||||
map { $_->unblessed->{branchcode} } @$arr_locations);
|
||||
}
|
||||
|
||||
push( @available_itemtypes, $item->{itype} );
|
||||
|
|
|
|||
Loading…
Reference in New Issue