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

(-)a/C4/ILSDI/Services.pm (-19 / +5 lines)
Lines 758-777 sub HoldTitle { Link Here
758
758
759
    my $title = $biblio ? $biblio->title : '';
759
    my $title = $biblio ? $biblio->title : '';
760
760
761
    my $branch = $cgi->param('pickup_location') // $patron->branchcode;
762
761
    # Check if the biblio can be reserved
763
    # Check if the biblio can be reserved
762
    my $code = CanBookBeReserved( $borrowernumber, $biblionumber )->{status};
764
    my $code = CanBookBeReserved( $borrowernumber, $biblionumber, $branch )->{status};
763
    return { code => $code } unless ( $code eq 'OK' );
765
    return { code => $code } unless ( $code eq 'OK' );
764
766
765
    my $branch;
766
767
    # Pickup branch management
768
    if ( $cgi->param('pickup_location') ) {
769
        $branch = $cgi->param('pickup_location');
770
        return { code => 'LocationNotFound' } unless Koha::Libraries->find($branch);
771
    } else { # if the request provide no branch, use the borrower's branch
772
        $branch = $patron->branchcode;
773
    }
774
775
    my $destination = Koha::Libraries->find($branch);
767
    my $destination = Koha::Libraries->find($branch);
776
    return { code => 'libraryNotPickupLocation' } unless $destination->pickup_location;
768
    return { code => 'libraryNotPickupLocation' } unless $destination->pickup_location;
777
    return { code => 'cannotBeTransferred' } unless $biblio->can_be_transferred({ to => $destination });
769
    return { code => 'cannotBeTransferred' } unless $biblio->can_be_transferred({ to => $destination });
Lines 858-871 sub HoldItem { Link Here
858
    # If the biblio does not match the item, return an error code
850
    # If the biblio does not match the item, return an error code
859
    return { code => 'RecordNotFound' } if $item->biblionumber ne $biblio->biblionumber;
851
    return { code => 'RecordNotFound' } if $item->biblionumber ne $biblio->biblionumber;
860
852
861
    # Pickup branch management
853
    # Pickup branch management}
862
    my $branch;
854
    my $branch = $cgi->param('pickup_location') // $patron->branchcode;
863
    if ( $cgi->param('pickup_location') ) {
864
        $branch = $cgi->param('pickup_location');
865
        return { code => 'LocationNotFound' } unless Koha::Libraries->find($branch);
866
    } else { # if the request provide no branch, use the borrower's branch
867
        $branch = $patron->branchcode;
868
    }
869
855
870
    # Check for item disponibility
856
    # Check for item disponibility
871
    my $canitembereserved = C4::Reserves::CanItemBeReserved( $patron, $item, $branch )->{status};
857
    my $canitembereserved = C4::Reserves::CanItemBeReserved( $patron, $item, $branch )->{status};
(-)a/C4/Reserves.pm (-1 / +6 lines)
Lines 633-638 sub CanItemBeReserved { Link Here
633
        unless ($item->can_be_transferred({ to => $destination })) {
633
        unless ($item->can_be_transferred({ to => $destination })) {
634
            return { status => 'cannotBeTransferred' };
634
            return { status => 'cannotBeTransferred' };
635
        }
635
        }
636
        if ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch' && $pickup_branchcode ne $item->homebranch) {
637
            return { status => 'cannotBeTransferred' };
638
        }
639
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch' && $pickup_branchcode ne $item->holdingbranch) {
640
            return { status => 'cannotBeTransferred' };
641
        }
636
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
642
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
637
            return { status => 'pickupNotInHoldGroup' };
643
            return { status => 'pickupNotInHoldGroup' };
638
        }
644
        }
639
- 

Return to bug 37172