|
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}; |