|
Lines 724-733
sub GetLastPickupDate {
Link Here
|
| 724 |
} elsif ( $controlbranch eq "PatronLibrary" ) { |
724 |
} elsif ( $controlbranch eq "PatronLibrary" ) { |
| 725 |
$branchcode = $borrower->branchcode; |
725 |
$branchcode = $borrower->branchcode; |
| 726 |
} |
726 |
} |
| 727 |
warn 'getlastpickup'; |
|
|
| 728 |
warn $branchcode; |
| 729 |
warn $borrower->{'categorycode'}; |
| 730 |
warn $item->{itype}; |
| 731 |
my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule({ |
727 |
my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule({ |
| 732 |
branchcode => $branchcode, |
728 |
branchcode => $branchcode, |
| 733 |
categorycode => $borrower->{'categorycode'}, |
729 |
categorycode => $borrower->{'categorycode'}, |
|
Lines 740-745
sub GetLastPickupDate {
Link Here
|
| 740 |
} else { |
736 |
} else { |
| 741 |
$reservebranch = $reserve->branchcode; |
737 |
$reservebranch = $reserve->branchcode; |
| 742 |
} |
738 |
} |
|
|
739 |
|
| 743 |
if ( defined($issuingrule) && defined $issuingrule->holdspickupwait && $issuingrule->holdspickupwait > 0 ) { #If holdspickupwait is <= 0, it means this feature is disabled for this type of material. |
740 |
if ( defined($issuingrule) && defined $issuingrule->holdspickupwait && $issuingrule->holdspickupwait > 0 ) { #If holdspickupwait is <= 0, it means this feature is disabled for this type of material. |
| 744 |
$date->add( days => $issuingrule->holdspickupwait ); |
741 |
$date->add( days => $issuingrule->holdspickupwait ); |
| 745 |
my $calendar = Koha::Calendar->new( branchcode => $reservebranch ); |
742 |
my $calendar = Koha::Calendar->new( branchcode => $reservebranch ); |
|
Lines 748-753
sub GetLastPickupDate {
Link Here
|
| 748 |
$date->add( days => 1 ); |
745 |
$date->add( days => 1 ); |
| 749 |
$is_holiday = $calendar->is_holiday( $date ); |
746 |
$is_holiday = $calendar->is_holiday( $date ); |
| 750 |
} |
747 |
} |
|
|
748 |
|
| 749 |
if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { |
| 750 |
$date = $calendar->days_forward( dt_from_string(), $issuingrule->holdspickupwait ); |
| 751 |
} |
| 752 |
|
| 751 |
$reserve->{lastpickupdate} = $date->ymd(); |
753 |
$reserve->{lastpickupdate} = $date->ymd(); |
| 752 |
return $date; |
754 |
return $date; |
| 753 |
} |
755 |
} |
|
Lines 920-926
sub CheckReserves {
Link Here
|
| 920 |
|
922 |
|
| 921 |
CancelExpiredReserves(); |
923 |
CancelExpiredReserves(); |
| 922 |
|
924 |
|
| 923 |
Cancels all reserves with an expiration date from before today. |
925 |
Cancels all reserves with a lastpickupdate value from before today. |
| 924 |
|
926 |
|
| 925 |
=cut |
927 |
=cut |
| 926 |
|
928 |
|
|
Lines 928-941
sub CancelExpiredReserves {
Link Here
|
| 928 |
my $today = dt_from_string(); |
930 |
my $today = dt_from_string(); |
| 929 |
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); |
931 |
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); |
| 930 |
my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); |
932 |
my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); |
| 931 |
|
|
|
| 932 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
933 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
| 933 |
my $params = { expirationdate => { '<', $dtf->format_date($today) } }; |
934 |
my $params = { lastpickupdate => { '<', $dtf->format_date($today) } }; |
| 934 |
$params->{found} = [ { '!=', 'W' }, undef ] unless $expireWaiting; |
935 |
$params->{found} = [ { '!=', 'W' }, undef ] unless $expireWaiting; |
| 935 |
|
936 |
|
| 936 |
# FIXME To move to Koha::Holds->search_expired (?) |
937 |
# FIXME To move to Koha::Holds->search_expired (?) |
| 937 |
my $holds = Koha::Holds->search( $params ); |
938 |
my $holds = Koha::Holds->search( $params ); |
| 938 |
|
|
|
| 939 |
while ( my $hold = $holds->next ) { |
939 |
while ( my $hold = $holds->next ) { |
| 940 |
my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); |
940 |
my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); |
| 941 |
|
941 |
|