View | Details | Raw Unified | Return to bug 29349
Collapse All | Expand All

(-)a/reserve/request.pl (-6 / +22 lines)
Lines 586-598 foreach my $biblionumber (@biblionumbers) { Link Here
586
                  )
586
                  )
587
                {
587
                {
588
                    # Send the pickup locations count to the UI, the pickup locations will be pulled using the API
588
                    # Send the pickup locations count to the UI, the pickup locations will be pulled using the API
589
                    my $pickup_locations = $item_object->pickup_locations({ patron => $patron });
589
                    my @pickup_locations = $item_object->pickup_locations({ patron => $patron })->as_list;
590
                    $item->{pickup_locations_count} = $pickup_locations->count;
590
                    $item->{pickup_locations_count} = scalar @pickup_locations;
591
                    if ( $item->{pickup_locations_count} > 0 ) {
591
592
                    if ( @pickup_locations ) {
592
                        $num_available++;
593
                        $num_available++;
593
                        $item->{available} = 1;
594
                        $item->{available} = 1;
594
                        # pass the holding branch for use as default
595
595
                        my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next;
596
                        my $default_pickup_location;
597
598
                        # Default to logged-in, if valid
599
                        if ( C4::Context->userenv->{branch} ) {
600
                            ($default_pickup_location) = grep { $_->branchcode eq C4::Context->userenv->{branch} } @pickup_locations;
601
                        }
602
603
                        # Fallback to holding library
604
                        unless ($default_pickup_location) {
605
                            ($default_pickup_location) = grep { $_->branchcode eq $item->{holdingbranch} } @pickup_locations;
606
                        }
607
608
                        # Last resource, fallback to the first
609
                        unless ($default_pickup_location) {
610
                            ($default_pickup_location) = $pickup_locations[0];
611
                        }
612
596
                        $item->{default_pickup_location} = $default_pickup_location;
613
                        $item->{default_pickup_location} = $default_pickup_location;
597
                    }
614
                    }
598
                    else {
615
                    else {
599
- 

Return to bug 29349