use strict;
use CGI;
+use C4::Auth;
use C4::Context;
use C4::Output;
+use C4::Interface::CGI::Output;
use C4::Search;
use C4::Context;
use HTML::Template;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
- my $query="Select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where (tagfield like \"$data[0]%\") order by tagfield";
+ my $query="Select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where (tagfield >= $data[0]) order by tagfield";
my $sth=$dbh->prepare($query);
$sth->execute;
my @results;
my $input = new CGI;
my $searchfield=$input->param('searchfield');
+$searchfield=0 unless $searchfield;
my $pkfield="tagfield";
my $reqsel="select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where $pkfield='$searchfield'";
my $offset=$input->param('offset');
my $dbh = C4::Context->dbh;
-my $template = gettemplate("parameters/marctagstructure.tmpl",0);
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "parameters/marctagstructure.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ debug => 1,
+ });
my $pagesize=20;
my $op = $input->param('op');
$searchfield=~ s/\,//g;
$authorised_value
);
$sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marctagstructure.pl\"></html>";
+ print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marctagstructure.pl?tagfield=$tagfield\"></html>";
exit;
# END $OP eq ADD_VALIDATE
################## DELETE_CONFIRM ##################################
$template->param(loop => \@loop_data);
if ($offset>0) {
my $prevpage = $offset-$pagesize;
- $template->param(previous => "<a href=$script_name?offset=".$prevpage.'><< Prev</a>');
+ $template->param(previous => "<a href=\"$script_name?offset=".$prevpage.'">');
}
if ($offset+$pagesize<$count) {
my $nextpage =$offset+$pagesize;
- $template->param(next => "<a href=$script_name?offset=".$nextpage.'>Next >></a>');
+ $template->param(next => "<a href=\"$script_name?offset=".$nextpage.'">');
}
} #---- END $OP eq DEFAULT
-print "Content-Type: text/html\n\n", $template->output;
+$template->param(loggeninuser => $loggedinuser);
+output_html_with_http_headers $input, $cookie, $template->output;