-my $searchfield=$input->param('searchfield');
-$searchfield=~ s/\,//g;
-my $id = $input->param('id');
-my $offset=$input->param('offset');
-my $script_name="/cgi-bin/koha/admin/authorised_values.pl";
-my $dbh = C4::Context->dbh;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "admin/authorised_values.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-my $pagesize=20;
-my $op = $input->param('op');
-
-if ($op) {
-$template->param(script_name => $script_name,
- $op => 1); # we show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- else => 1); # we show only the TMPL_VAR names $op
-}
+my $id = $input->param('id');
+my $op = $input->param('op') || '';
+our $offset = $input->param('offset') || 0;
+our $searchfield = $input->param('searchfield');
+$searchfield = '' unless defined $searchfield;
+$searchfield =~ s/\,//g;
+our $script_name = "/cgi-bin/koha/admin/authorised_values.pl";
+our $dbh = C4::Context->dbh;
+
+our ($template, $borrowernumber, $cookie)= get_template_and_user({
+ template_name => "admin/authorised_values.tmpl",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ query => $input,
+ type => "intranet",
+ debug => 1,
+});
+
+$template->param( script_name => $script_name,
+ ($op||'else') => 1 );