From 64afc40ef2ac9e29da80ade7671bcc25de9d655e Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 3 Mar 2025 15:32:08 -0100 Subject: [PATCH] Bug 37901: UpdateStats when new ILL request is created --- Koha/ILL/Request.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm index 48bfd6ba2d8..1167bfd7993 100644 --- a/Koha/ILL/Request.pm +++ b/Koha/ILL/Request.pm @@ -2009,6 +2009,7 @@ possibly records the fact that something happened sub store { my ( $self, $attrs ) = @_; + my $is_new_request = !$self->in_storage; my %updated_columns = $self->_result->get_dirty_columns; my @holds; @@ -2049,6 +2050,22 @@ sub store { ); } + return $ret unless $is_new_request; + + C4::Stats::UpdateStats( + { + borrowernumber => $self->borrowernumber // undef, + branch => $self->branchcode, + categorycode => $self->patron ? $self->patron->categorycode : undef, + ccode => undef, + illrequest_id => $self->illrequest_id, + itemnumber => undef, + itemtype => undef, + location => undef, + type => 'ill_request', + } + ); + return $ret; } -- 2.39.5