$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
- my $query="Select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where (tagfield like \"$searchstring%\") order by tagfield";
- my $sth=$dbh->prepare($query);
- $sth->execute;
+ my $sth=$dbh->prepare("Select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where (tagfield like ?) order by tagfield");
+ $sth->execute("$searchstring%");
my @results;
my $cnt=0;
while (my $data=$sth->fetchrow_hashref){
my $tagfield=$input->param('tagfield');
my $tagsubfield=$input->param('tagsubfield');
my $pkfield="tagfield";
-my $reqsel="select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield='$tagfield' and tagsubfield='$tagsubfield'";
-my $reqdel="delete from marc_subfield_structure where tagfield='$tagfield' and tagsubfield='$tagsubfield'";
my $offset=$input->param('offset');
my $script_name="/cgi-bin/koha/admin/marc_subfields_structure.pl";
closedir DIR;
# build values list
- my $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield='$tagfield'"); # and tagsubfield='$tagsubfield'");
- $sth->execute;
+ my $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=?"); # and tagsubfield='$tagsubfield'");
+ $sth->execute($tagfield);
my @loop_data = ();
my $toggle="white";
my $i=0;
-size=>1,
-multiple=>0,
);
- $row_data{tagsubfield} =$data->{'tagsubfield'}."<input type=\"hidden\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" />";
+ $row_data{tagsubfield} =$data->{'tagsubfield'}."<input type='hidden' name='tagsubfield' value='".$data->{'tagsubfield'}."'>";
$row_data{liblibrarian} = CGI::escapeHTML($data->{'liblibrarian'});
$row_data{libopac} = CGI::escapeHTML($data->{'libopac'});
$row_data{kohafield}= CGI::scrolling_list( -name=>"kohafield",
-size=>1,
-multiple=>0,
);
- $row_data{tagsubfield} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"3\" maxlength=\"1\" />";
+ $row_data{tagsubfield} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"3\" maxlength=\"1\">";
$row_data{liblibrarian} = "";
$row_data{libopac} = "";
$row_data{repeatable} = CGI::checkbox('repeatable','',1,'');
push(@loop_data, \%row_data);
}
$template->param(action => "Edit subfields",
- tagfield => "<input type=\"hidden\" name=\"tagfield\" value=\"$tagfield\" />$tagfield",
+ tagfield => "<input type=\"hidden\" name=\"tagfield\" value=\"$tagfield\">$tagfield",
loop => \@loop_data,
more_subfields => $more_subfields,
more_tag => $tagfield);
# called by default form, used to confirm deletion of data in DB
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare($reqsel);
- $sth->execute;
+ my $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=? and tagsubfield=?");
+ $sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
$sth->finish;
$template->param(liblibrarian => $data->{'liblibrarian'},
} elsif ($op eq 'delete_confirmed') {
my $dbh = C4::Context->dbh;
unless (C4::Context->config('demo') eq 1) {
- my $sth=$dbh->prepare($reqdel);
- $sth->execute;
+ my $sth=$dbh->prepare("delete from marc_subfield_structure where tagfield=? and tagsubfield=?");
+ $sth->execute($tagfield,$tagsubfield);
$sth->finish;
}
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marc_subfields_structure.pl?tagfield=$tagfield\"></html>";
push(@loop_data, \%row_data);
}
$template->param(loop => \@loop_data);
- $template->param(edit => "<a href='$script_name?op=add_form&tagfield=$tagfield'>");
+ $template->param(edit => "<a href=\"$script_name?op=add_form&tagfield=$tagfield\">");
if ($offset>0) {
my $prevpage = $offset-$pagesize;
$template->param(prev =>"<a href=\"$script_name?offset=$prevpage\">");