From 8a1090fc976d66aea7ee2e32b4529e59d2e0501f Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Tue, 16 May 2017 13:48:01 +0000 Subject: [PATCH] Bug 18613: Correct behaviour Remove a part of the code which automatically redirects on the library of logged-in user ( not ergonomic behaviour ). TEST PLAN: 1- Connect as superlibrarian. 2- Create a rule for all libraries in tools/letter.pl 3- Copy this letter on a precise library, different from the one you are registred on 4- Try to delete the letter => it wants to delete the one from all libraries 5- Apply Patch 6- Try again to delete the letter => it proposes you the good letter --- C4/Letters.pm | 13 +++++++------ koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index cf13bae..2256512 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -203,12 +203,6 @@ sub getletter { my ( $module, $code, $branchcode, $message_transport_type ) = @_; $message_transport_type //= '%'; - if ( C4::Context->preference('IndependentBranches') - and $branchcode - and C4::Context->userenv ) { - - $branchcode = C4::Context->userenv->{'branch'}; - } $branchcode //= ''; my $dbh = C4::Context->dbh; @@ -223,6 +217,13 @@ sub getletter { my $line = $sth->fetchrow_hashref or return; $line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html}; + + if ( C4::Context->preference('IndependentBranches') + and ( (not $line->{'branchcode'}) or ( not ($line->{'branchcode'} eq C4::Context->userenv->{'branch'}) ) ) + and not C4::Context->IsSuperLibrarian() ){ + return; + } + return { %$line }; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 129e1bf..f16e7ce 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -453,7 +453,7 @@ $(document).ready(function() { [% END %] -[% IF ( delete_confirm ) %] +[% IF ( delete_confirm and letter ) %]

Delete notice?

@@ -484,6 +484,10 @@ $(document).ready(function() { +[% ELSIF delete_confirm %] +
+

You are not allowed to delete this letter

+
[% END %] [% IF ( delete_confirmed ) %] -- 2.7.4