From a037663f264c3a6f5009c033c7727c5c8c9de62f Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 17 Jan 2025 13:02:21 +0000 Subject: [PATCH] Bug 36197: (QA follow-up): Move unauthenticated_notes to core Move this out of Standard specific logic. Other backends that support unauthenticated requests may want to make use of this and not duplicate code. Also make these notes translatable. --- Koha/ILL/Backend/Standard.pm | 10 +--------- Koha/ILL/Request.pm | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm index 2fdc4ff98ee..af13dcaa8be 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -1015,15 +1015,7 @@ sub add_request { } } keys %{$request_details}; $request->extended_attributes( \@request_details_array ); - - if ($unauthenticated_request) { - my $unauthenticated_notes_text = - "Unauthenticated request.\nFirst name: $params->{other}->{'unauthenticated_first_name'}" - . ".\nLast name: $params->{other}->{'unauthenticated_last_name'}." - . "\nEmail: $params->{other}->{'unauthenticated_email'}."; - $request->append_to_note($unauthenticated_notes_text); - $request->notesopac($unauthenticated_notes_text)->store; - } + $request->append_unauthenticated_notes( $params->{other} ) if $unauthenticated_request; return $request; } diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm index dc9659bca6a..f659d697bb2 100644 --- a/Koha/ILL/Request.pm +++ b/Koha/ILL/Request.pm @@ -34,7 +34,7 @@ use Koha::Cache::Memory::Lite; use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::Exceptions::Ill; -use Koha::I18N qw(__); +use Koha::I18N qw(__ __x); use Koha::ILL::Backend::Standard; use Koha::ILL::Batches; use Koha::ILL::Comments; @@ -1939,6 +1939,26 @@ sub attach_processors { } } +=head3 append_unauthenticated_notes + + append_unauthenticated_notes($metadata); + +Append unauthenticated details to staff and opac notes + +=cut + +sub append_unauthenticated_notes { + my ( $self, $metadata ) = @_; + my $unauthenticated_notes_text = __x( + "Unauthenticated request.\nFirst name: {first_name}.\nLast name: {last_name}.\nEmail: {email}.", + first_name => $metadata->{'unauthenticated_first_name'}, + last_name => $metadata->{'unauthenticated_last_name'}, + email => $metadata->{'unauthenticated_email'} + ); + $self->append_to_note($unauthenticated_notes_text); + $self->notesopac($unauthenticated_notes_text)->store; +} + =head3 append_to_note append_to_note("Some text"); -- 2.39.5