From a779b989ccbb4400634e7e3f3524a794257eae27 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 23 Oct 2024 14:26:39 +0100 Subject: [PATCH] Bug 30955: (QA follow-up) Reduce database hits and clarify notice This patch updates the library selection from using the new owners home library to using the current sessions library in keeping with the direction of travel in other bugs of this type in Koha currently. We also update the default notice text to clarify who sent the notice vs who previously owned the list. Signed-off-by: Martin Renvoize --- Koha/Virtualshelf.pm | 15 +++++++-------- .../data/mysql/en/mandatory/sample_notices.yml | 5 +++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm index 1cb82a1c5cb..2cea7e61e88 100644 --- a/Koha/Virtualshelf.pm +++ b/Koha/Virtualshelf.pm @@ -361,9 +361,10 @@ sub transfer_ownership { unless $patron_id; ## before we change the owner, collect some details - my $old_owner = Koha::Patrons->find( $self->owner ); - my $new_owner = Koha::Patrons->find($patron_id); - my $library = $new_owner->library->unblessed; + my $old_owner = Koha::Patrons->find( $self->owner ); + my $new_owner = Koha::Patrons->find($patron_id); + my $userenv = C4::Context->userenv; + my $branchcode = $userenv->{branch}; ## first we change the owner $self->remove_share($patron_id) if $self->is_private; @@ -373,16 +374,14 @@ sub transfer_ownership { my $letter = C4::Letters::GetPreparedLetter( module => 'lists', letter_code => 'TRANSFER_OWNERSHIP', - branchcode => $library->{branchcode}, + branchcode => $branchcode, lang => $new_owner->lang || 'default', objects => { old_owner => $old_owner, - new_owner => $new_owner, + owner => $new_owner, shelf => $self, }, - tables => { - 'branches' => $library->{branchcode}, - }, + want_librarian => 1, message_transport_type => 'email', ); diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml index 3354e24b30e..c049eefb5a3 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1314,10 +1314,11 @@ tables: message_transport_type: email lang: default content: - - "Dear [%- INCLUDE 'patron-title.inc' patron => new_owner -%],
" + - "Dear [%- INCLUDE 'patron-title.inc' patron => owner -%],
" - "
" - - "A public list, titled [% shelf.shelfname | html %], has been transferred to you[% IF ( old_owner ) %] by [%- INCLUDE 'patron-title.inc' patron => old_owner%][% IF ( old_owner.email ) %] ([% old_owner.email | html %])[% END %][% END %].
" + - "A public list, titled [% shelf.shelfname | html %], has been transferred to you[% IF ( librarian ) %] by [%- INCLUDE 'patron-title.inc' patron => librarian %][% END %].
" - "
" + - "[% IF old_owner %]The list was previously owned by [%- INCLUDE 'patron-title.inc' patron => old_owner -%].

[% END %]" - "Thank you
" - "
" -- 2.47.0