Lines 1171-1177
Return all active recalls attached to this biblio, sorted by oldest first
Link Here
|
1171 |
=cut |
1171 |
=cut |
1172 |
|
1172 |
|
1173 |
sub recalls { |
1173 |
sub recalls { |
1174 |
my ( $self ) = @_; |
1174 |
my ( $self, $params ) = @_; |
|
|
1175 |
if ( $params->{borrowernumber} ) { |
1176 |
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef, borrowernumber => $params->{borrowernumber} }, { order_by => { -asc => 'recalldate' } }); |
1177 |
return @recalls_rs; |
1178 |
} |
1175 |
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } }); |
1179 |
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } }); |
1176 |
return @recalls_rs; |
1180 |
return @recalls_rs; |
1177 |
} |
1181 |
} |
Lines 1204-1210
sub can_be_recalled {
Link Here
|
1204 |
my @itemtypes; |
1208 |
my @itemtypes; |
1205 |
my @itemnumbers; |
1209 |
my @itemnumbers; |
1206 |
my @items; |
1210 |
my @items; |
|
|
1211 |
my @all_itemnumbers; |
1207 |
foreach my $item ( @all_items ) { |
1212 |
foreach my $item ( @all_items ) { |
|
|
1213 |
push( @all_itemnumbers, $item->itemnumber ); |
1208 |
if ( $item->can_be_recalled({ patron => $patron }) ) { |
1214 |
if ( $item->can_be_recalled({ patron => $patron }) ) { |
1209 |
push( @itemtypes, $item->effective_itemtype ); |
1215 |
push( @itemtypes, $item->effective_itemtype ); |
1210 |
push( @itemnumbers, $item->itemnumber ); |
1216 |
push( @itemnumbers, $item->itemnumber ); |
Lines 1251-1257
sub can_be_recalled {
Link Here
|
1251 |
return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record ); |
1257 |
return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record ); |
1252 |
|
1258 |
|
1253 |
# check if any of the items under this biblio are already checked out by this borrower |
1259 |
# check if any of the items under this biblio are already checked out by this borrower |
1254 |
return 0 if ( Koha::Checkouts->search({ itemnumber => [ @itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 ); |
1260 |
return 0 if ( Koha::Checkouts->search({ itemnumber => [ @all_itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 ); |
1255 |
} |
1261 |
} |
1256 |
|
1262 |
|
1257 |
# check item availability |
1263 |
# check item availability |