X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=tools%2Fletter.pl;h=44f21abce4f011076481e3f76c7d82d8244ee2eb;hb=81f63a4d5d95ee33dc5324e1bd7271921a73dfbd;hp=ae47810f27fadcf38dd8d90b591c6f4145590f04;hpb=a7f7aeb138b8275448937102cb7a46cf49530aef;p=koha_fer diff --git a/tools/letter.pl b/tools/letter.pl index ae47810f27..44f21abce4 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -85,17 +85,17 @@ sub protected_letters { return { map { $_->[0] => 1 } @{$codes} }; } -my $input = new CGI; +our $input = new CGI; my $searchfield = $input->param('searchfield'); my $script_name = '/cgi-bin/koha/tools/letter.pl'; -my $branchcode = $input->param('branchcode'); +our $branchcode = $input->param('branchcode'); my $code = $input->param('code'); my $module = $input->param('module'); my $content = $input->param('content'); my $op = $input->param('op') || ''; my $dbh = C4::Context->dbh; -my ( $template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( +our ( $template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( { template_name => 'tools/letter.tmpl', query => $input, @@ -106,7 +106,7 @@ my ( $template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( } ); -my $my_branch = C4::Context->preference("IndependantBranches") && !$staffflags->{'superlibrarian'} +our $my_branch = C4::Context->preference("IndependantBranches") && !$staffflags->{'superlibrarian'} ? C4::Context->userenv()->{'branch'} : undef; # we show only the TMPL_VAR names $op @@ -325,7 +325,7 @@ sub default_display { my $loop_data = []; my $protected_letters = protected_letters(); foreach my $row (@{$results}) { - $row->{protected} = $protected_letters->{ $row->{code}}; + $row->{protected} = !$row->{branchcode} && $protected_letters->{ $row->{code} }; push @{$loop_data}, $row; }