Lines 726-746
$PATRON, 0 otherwise.
Link Here
|
726 |
sub do_check_for_previous_checkout { |
726 |
sub do_check_for_previous_checkout { |
727 |
my ( $self, $item ) = @_; |
727 |
my ( $self, $item ) = @_; |
728 |
|
728 |
|
|
|
729 |
my $criteria = { borrowernumber => $self->borrowernumber }; |
730 |
my $attrs = {}; |
731 |
|
729 |
my @item_nos; |
732 |
my @item_nos; |
730 |
my $biblio = Koha::Biblios->find( $item->{biblionumber} ); |
733 |
my $biblio = Koha::Biblios->find( $item->{biblionumber} ); |
|
|
734 |
# Create (old)issues search criteria |
731 |
if ( $biblio->is_serial ) { |
735 |
if ( $biblio->is_serial ) { |
732 |
push @item_nos, $item->{itemnumber}; |
736 |
$criteria->{itemnumber} = $item->{itemnumber}; |
733 |
} else { |
737 |
} else { |
734 |
# Get all itemnumbers for given bibliographic record. |
738 |
# Get all itemnumbers for given bibliographic record. |
735 |
@item_nos = $biblio->items->get_column( 'itemnumber' ); |
739 |
@item_nos = $biblio->items->get_column( 'itemnumber' ); |
|
|
740 |
$criteria->{'biblio.biblionumber'} = $item->{biblionumber}; |
741 |
$attrs->{join} = { 'item' => 'biblio' }; |
736 |
} |
742 |
} |
737 |
|
743 |
|
738 |
# Create (old)issues search criteria |
|
|
739 |
my $criteria = { |
740 |
borrowernumber => $self->borrowernumber, |
741 |
itemnumber => \@item_nos, |
742 |
}; |
743 |
|
744 |
my $delay = C4::Context->preference('CheckPrevCheckoutDelay') || 0; |
744 |
my $delay = C4::Context->preference('CheckPrevCheckoutDelay') || 0; |
745 |
if ($delay) { |
745 |
if ($delay) { |
746 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
746 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
Lines 749-760
sub do_check_for_previous_checkout {
Link Here
|
749 |
} |
749 |
} |
750 |
|
750 |
|
751 |
# Check current issues table |
751 |
# Check current issues table |
752 |
my $issues = Koha::Checkouts->search($criteria); |
752 |
return 1 |
753 |
return 1 if $issues->count; # 0 || N |
753 |
if Koha::Checkouts->search( $criteria, $attrs )->count; |
754 |
|
754 |
|
755 |
# Check old issues table |
755 |
# Check old issues table |
756 |
my $old_issues = Koha::Old::Checkouts->search($criteria); |
756 |
return Koha::Old::Checkouts->search( $criteria, $attrs )->count; |
757 |
return $old_issues->count; # 0 || N |
|
|
758 |
} |
757 |
} |
759 |
|
758 |
|
760 |
=head3 is_debarred |
759 |
=head3 is_debarred |
761 |
- |
|
|