From 9b69e8962a46c5f37ab28774a477f7f7e073987f Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 3 Mar 2025 15:32:08 -0100 Subject: [PATCH] Bug 37901: UpdateStats after new ILL request is created --- Koha/ILL/Backend/Standard.pm | 2 ++ Koha/ILL/Request.pm | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm index 4f8f3a5adef..b3b1d52d63c 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -1000,6 +1000,8 @@ sub add_request { } keys %{$request_details}; $request->extended_attributes( \@request_details_array ); + $request->after_created; + return $request; } diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm index 48bfd6ba2d8..67de1368a4c 100644 --- a/Koha/ILL/Request.pm +++ b/Koha/ILL/Request.pm @@ -2052,6 +2052,32 @@ sub store { return $ret; } +=head3 after_created + + $request->after_created; + +Actions to be done after the request has been fully created + +=cut + +sub after_created { + my ($self) = @_; + + 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', + } + ); +} + =head3 requested_partners my $partners_string = $request->requested_partners; -- 2.39.5