Browse Source

Bug 26999: (follow-up) Simplify code

Doing
$ git grep pickup_locations_code

shows there's some calculated data that is not actually used anywhere.
We can get rid of it.

This patch also reuses $item_object (which is in the same loop scope) to
avoid an extra DB call.

To test:
1. Run:
   $ git grep pickup_locations_code
=> FAIL: It is only used/set as a comma separated string, inside
request.pl
2. Apply this patch
3. Repeat 1
=> SUCCESS: The unused stuff is not there anymore
4. Open the page for placing some holds
=> SUCCESS: It doesn't explode
5. Sign off :-D

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>
master
Tomas Cohen Arazi 3 weeks ago
parent
commit
0fd2be61e8
1 changed files with 7 additions and 8 deletions
  1. +7
    -8
      reserve/request.pl

+ 7
- 8
reserve/request.pl View File

@@ -568,16 +568,15 @@ foreach my $biblionumber (@biblionumbers) {
{
$item->{available} = 1;
$num_available++;
if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) {

if ( $branchitemrule->{'hold_fulfillment_policy'} eq 'any' )
{
$item->{any_pickup_location} = 1;
} else {
my $arr_locations = Koha::Items->find($itemnumber)
->pickup_locations( { patron => $patron } )->as_list();
}
else {
my @pickup_locations = $item_object->pickup_locations({ patron => $patron });

$item->{pickup_locations} = join( ', ',
map { $_->unblessed->{branchname} } @$arr_locations);
$item->{pickup_locations_code} = join( ',',
map { $_->unblessed->{branchcode} } @$arr_locations);
$item->{pickup_locations} = join( ', ', map { $_->branchname } @pickup_locations );
}

push( @available_itemtypes, $item->{itype} );


Loading…
Cancel
Save