From dbcbf48ace7593b6a6f2f593d7a8387ec1588f6a 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 b66490062f0..e5f3e77d248 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -1014,15 +1014,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 ed8ae9594c7..0d8fa7f1edf 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; @@ -1905,6 +1905,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