projects
/
koha.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug 19260: [QA Follow-up] Remove obsolete $dbh
[koha.git]
/
C4
/
Reserves.pm
diff --git
a/C4/Reserves.pm
b/C4/Reserves.pm
index
079fb39
..
78f5ca3
100644
(file)
--- a/
C4/Reserves.pm
+++ b/
C4/Reserves.pm
@@
-732,7
+732,11
@@
sub CheckReserves {
my $priority = 10000000;
foreach my $res (@reserves) {
if ( $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
my $priority = 10000000;
foreach my $res (@reserves) {
if ( $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
- return ( "Waiting", $res, \@reserves ); # Found it
+ if ($res->{'found'} eq 'W') {
+ return ( "Waiting", $res, \@reserves ); # Found it, it is waiting
+ } else {
+ return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
+ }
} else {
my $patron;
my $iteminfo;
} else {
my $patron;
my $iteminfo;
@@
-792,20
+796,16
@@
Cancels all reserves with an expiration date from before today.
=cut
sub CancelExpiredReserves {
=cut
sub CancelExpiredReserves {
-
my $today = dt_from_string();
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
my $today = dt_from_string();
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
-
- my $dbh = C4::Context->dbh;
+ my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
my $dtf = Koha::Database->new->schema->storage->datetime_parser;
my $dtf = Koha::Database->new->schema->storage->datetime_parser;
- my $today = dt_from_string;
+ my $params = { expirationdate => { '<', $dtf->format_date($today) } };
+ $params->{found} = undef unless $expireWaiting;
+
# FIXME To move to Koha::Holds->search_expired (?)
# FIXME To move to Koha::Holds->search_expired (?)
- my $holds = Koha::Holds->search(
- {
- expirationdate => { '<', $dtf->format_date($today) }
- }
- );
+ my $holds = Koha::Holds->search( $params );
while ( my $hold = $holds->next ) {
my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode );
while ( my $hold = $holds->next ) {
my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode );
@@
-813,11
+813,10
@@
sub CancelExpiredReserves {
next if !$cancel_on_holidays && $calendar->is_holiday( $today );
my $cancel_params = {};
next if !$cancel_on_holidays && $calendar->is_holiday( $today );
my $cancel_params = {};
- if ( $hold
s
->found eq 'W' ) {
+ if ( $hold->found eq 'W' ) {
$cancel_params->{charge_cancel_fee} = 1;
}
$hold->cancel( $cancel_params );
$cancel_params->{charge_cancel_fee} = 1;
}
$hold->cancel( $cancel_params );
-
}
}
}
}