use C4::Circulation qw( CanBookBeIssued AddIssue );
use C4::Members::Messaging qw( GetMessagingPreferences );
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
+use Koha::Calendar;
use Koha::DateUtils qw( dt_from_string );
use Koha::Patron;
use Koha::Library;
Koha::Exceptions::CurbsidePickup::NotEnabled->throw
unless $policy && $policy->enabled;
+ my $calendar = Koha::Calendar->new( branchcode => $params->{branchcode} );
+ Koha::Exceptions::CurbsidePickup::LibraryIsClosed->throw
+ if $calendar->is_holiday( $params->{scheduled_pickup_datetime} );
+
if ( $policy->enable_waiting_holds_only ) {
my $patron = Koha::Patrons->find( $params->{borrowernumber} );
- my $waiting_holds = $patron->holds->search(
- { found => 'W', branchcode => $params->{branchcode} } );
+ my $waiting_holds = $patron->holds->waiting->search( { branchcode => $params->{branchcode} } );
Koha::Exceptions::CurbsidePickup::NoWaitingHolds->throw
unless $waiting_holds->count;
my $holds = $patron->holds;
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
foreach my $hold ( $holds->as_list ) {
- if ( $hold->found eq 'W' && $branchcode && $hold->branchcode eq $branchcode ) {
+ if ( $hold->is_waiting && $branchcode && $hold->branchcode eq $branchcode ) {
my ( $issuingimpossible, $needsconfirmation ) =
C4::Circulation::CanBookBeIssued( $patron, $hold->item->barcode );