From 0d63524a75f42e009f3815bbe1c1816971e83369 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 10 Apr 2025 16:16:54 +0000 Subject: [PATCH] Bug 36197: (QA follow-up): Hackfest followup WIP Moved unauth data to their respective illrequestattributes entries instead of staffnotes + opacnotes. Update confirmation message --- Koha/ILL/Backend/Standard.pm | 11 ++++--- Koha/ILL/Request.pm | 33 ++++++++++++------- .../prog/en/modules/ill/ill-requests.tt | 28 ++++++++++++++++ .../bootstrap/en/modules/opac-illrequests.tt | 14 +++++++- 4 files changed, 69 insertions(+), 17 deletions(-) diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm index 3db432f5c2c..36d4ea79408 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -146,9 +146,12 @@ that we do not consider to be metadata sub metadata { my ( $self, $request ) = @_; - my $attrs = $request->extended_attributes; - my $metadata = {}; - my @ignore = ( 'requested_partners', 'type', 'type_disclaimer_value', 'type_disclaimer_date' ); + my $attrs = $request->extended_attributes; + my $metadata = {}; + my @ignore = ( + 'requested_partners', 'type', 'type_disclaimer_value', 'type_disclaimer_date', 'unauthenticated_first_name', + 'unauthenticated_last_name', 'unauthenticated_email' + ); my $core_fields = _get_core_fields(); while ( my $attr = $attrs->next ) { my $type = $attr->type; @@ -1016,7 +1019,7 @@ sub add_request { } } keys %{$request_details}; $request->extended_attributes( \@request_details_array ); - $request->append_unauthenticated_notes( $params->{other} ) if $unauthenticated_request; + $request->add_unauthenticated_data( $params->{other} ) if $unauthenticated_request; return $request; } diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm index ddc5438a55e..70fbe9f49bf 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(__ __x); +use Koha::I18N qw(__); use Koha::ILL::Backend::Standard; use Koha::ILL::Batches; use Koha::ILL::Comments; @@ -1939,24 +1939,33 @@ sub attach_processors { } } -=head3 append_unauthenticated_notes +=head3 add_unauthenticated_data - append_unauthenticated_notes($metadata); + add_unauthenticated_data($metadata); -Append unauthenticated details to staff and opac notes +Adds unauthenticated data as I =cut -sub append_unauthenticated_notes { +sub add_unauthenticated_data { 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'} + + my $extended_attributes = $self->extended_attributes( + [ + { + type => 'unauthenticated_first_name', + value => $metadata->{'unauthenticated_first_name'}, + }, + { + type => 'unauthenticated_last_name', + value => $metadata->{'unauthenticated_last_name'}, + }, + { + type => 'unauthenticated_email', + value => $metadata->{'unauthenticated_email'}, + }, + ] ); - $self->append_to_note($unauthenticated_notes_text); - $self->notesopac($unauthenticated_notes_text)->store; } =head3 unauth_request_data_check diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index ff5d074685a..a5cfc474eb9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -663,6 +663,34 @@ [% END %] + [% IF req_status == 'UNAUTH' %] +
+

Unauthenticated request details

+
    + [% unauthenticated_first_name = request.extended_attributes.find({'type'=>'unauthenticated_first_name'}).value %] + [% IF unauthenticated_first_name %] +
  1. + First name: + [% unauthenticated_first_name | html %] +
  2. + [% END %] + [% unauthenticated_last_name = request.extended_attributes.find({'type'=>'unauthenticated_last_name'}).value %] + [% IF unauthenticated_last_name %] +
  3. + Last name: + [% unauthenticated_last_name | html %] +
  4. + [% END %] + [% unauthenticated_email = request.extended_attributes.find({'type'=>'unauthenticated_email'}).value %] + [% IF unauthenticated_email %] +
  5. + Email: + [% unauthenticated_email | html %] +
  6. + [% END %] +
+
+ [% END %]

Details from supplier ([% request.backend | html %])

    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt index 7df27a23ccf..d531a48b9d4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt @@ -253,7 +253,7 @@ [% END %] [% ELSIF op == 'unauth_view' %] - +

    View interlibrary loan request

    [% INCLUDE messages %] [% status = request.status %] @@ -295,6 +295,18 @@ [% request.updated | $KohaDates %] +
  1. + + [% request.extended_attributes.find({'type'=>'unauthenticated_first_name'}).value | html %] +
  2. +
  3. + + [% request.extended_attributes.find({'type'=>'unauthenticated_last_name'}).value | html %] +
  4. +
  5. + + [% request.extended_attributes.find({'type'=>'unauthenticated_email'}).value | html %] +
  6. [% request.notesopac | html %] -- 2.39.5