Lines 951-957
Return all active recalls attached to this biblio, sorted by oldest first
Link Here
|
951 |
=cut |
951 |
=cut |
952 |
|
952 |
|
953 |
sub recalls { |
953 |
sub recalls { |
954 |
my ( $self ) = @_; |
954 |
my ( $self, $params ) = @_; |
|
|
955 |
if ( $params->{borrowernumber} ) { |
956 |
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef, borrowernumber => $params->{borrowernumber} }, { order_by => { -asc => 'recalldate' } }); |
957 |
return @recalls_rs; |
958 |
} |
955 |
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } }); |
959 |
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } }); |
956 |
return @recalls_rs; |
960 |
return @recalls_rs; |
957 |
} |
961 |
} |
Lines 984-990
sub can_be_recalled {
Link Here
|
984 |
my @itemtypes; |
988 |
my @itemtypes; |
985 |
my @itemnumbers; |
989 |
my @itemnumbers; |
986 |
my @items; |
990 |
my @items; |
|
|
991 |
my @all_itemnumbers; |
987 |
foreach my $item ( @all_items ) { |
992 |
foreach my $item ( @all_items ) { |
|
|
993 |
push( @all_itemnumbers, $item->itemnumber ); |
988 |
if ( $item->can_be_recalled({ patron => $patron }) ) { |
994 |
if ( $item->can_be_recalled({ patron => $patron }) ) { |
989 |
push( @itemtypes, $item->effective_itemtype ); |
995 |
push( @itemtypes, $item->effective_itemtype ); |
990 |
push( @itemnumbers, $item->itemnumber ); |
996 |
push( @itemnumbers, $item->itemnumber ); |
Lines 1031-1037
sub can_be_recalled {
Link Here
|
1031 |
return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record ); |
1037 |
return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record ); |
1032 |
|
1038 |
|
1033 |
# check if any of the items under this biblio are already checked out by this borrower |
1039 |
# check if any of the items under this biblio are already checked out by this borrower |
1034 |
return 0 if ( Koha::Checkouts->search({ itemnumber => [ @itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 ); |
1040 |
return 0 if ( Koha::Checkouts->search({ itemnumber => [ @all_itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 ); |
1035 |
} |
1041 |
} |
1036 |
|
1042 |
|
1037 |
# check item availability |
1043 |
# check item availability |