@@ -, +, @@ --- C4/Letters.pm | 13 +++++++------ koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) --- a/C4/Letters.pm +++ a/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 }; } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ a/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 ( op == "delete_confirm" ) %] +
+

You are not allowed to delete this letter

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