From c5aae0eb5196e165c3f4f46623d75b97ed26405b Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 15 Aug 2024 16:09:26 +0200 Subject: [PATCH] Bug 37651: Add ConfirmFutureHolds to biblio->current_holds Content-Type: text/plain; charset=utf-8 Test plan: Easy way is to run the unit tests in the next patch. One call of biblio->current_holds is hidden in acqui/parcel.pl. The table column "Item holds / Total holds" should now make a difference for an order referring to an item having future holds. Signed-off-by: Marcel de Rooy --- Koha/Biblio.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 8029be8e43..993f35c314 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -704,18 +704,19 @@ sub holds { =head3 current_holds -my $holds = $biblio->current_holds + my $holds = $biblio->current_holds -Return the holds placed on this bibliographic record. -It does not include future holds. + Return the holds placed on this bibliographic record. + Respects the lookahead days in ConfirmFutureHolds pref. =cut sub current_holds { my ($self) = @_; - my $dtf = Koha::Database->new->schema->storage->datetime_parser; + my $dtf = Koha::Database->new->schema->storage->datetime_parser; + my $dt = dt_from_string()->add( days => C4::Context->preference('ConfirmFutureHolds') || 0 ); return $self->holds( - { reservedate => { '<=' => $dtf->format_date(dt_from_string) } } ); + { reservedate => { '<=' => $dtf->format_date($dt) } } ); } =head3 biblioitem -- 2.30.2