use HTML::Template;
sub StringSearch {
- my ($env,$searchstring,$itemtype)=@_;
+ my ($env,$searchstring,$frameworkcode)=@_;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
- my $sth=$dbh->prepare("Select * from marc_subfield_structure where (tagfield like ? and itemtype=?) order by tagfield");
- $sth->execute("$searchstring%",$itemtype);
+ my $sth=$dbh->prepare("Select * from marc_subfield_structure where (tagfield like ? and frameworkcode=?) order by tagfield");
+ $sth->execute("$searchstring%",$frameworkcode);
my @results;
my $cnt=0;
while (my $data=$sth->fetchrow_hashref){
my $input = new CGI;
my $tagfield=$input->param('tagfield');
my $tagsubfield=$input->param('tagsubfield');
-my $itemtype=$input->param('itemtype');
+my $frameworkcode=$input->param('frameworkcode');
my $pkfield="tagfield";
my $offset=$input->param('offset');
my $script_name="/cgi-bin/koha/admin/marc_subfields_structure.pl";
if ($op) {
$template->param(script_name => $script_name,
tagfield =>$tagfield,
- itemtype => $itemtype,
+ frameworkcode => $frameworkcode,
$op => 1); # we show only the TMPL_VAR names $op
} else {
$template->param(script_name => $script_name,
tagfield =>$tagfield,
- itemtype => $itemtype,
+ frameworkcode => $frameworkcode,
else => 1); # we show only the TMPL_VAR names $op
}
closedir DIR;
# build values list
- my $sth=$dbh->prepare("select * from marc_subfield_structure where tagfield=? and itemtype=?"); # and tagsubfield='$tagsubfield'");
- $sth->execute($tagfield,$itemtype);
+ my $sth=$dbh->prepare("select * from marc_subfield_structure where tagfield=? and frameworkcode=?"); # and tagsubfield='$tagsubfield'");
+ $sth->execute($tagfield,$frameworkcode);
my @loop_data = ();
my $toggle="white";
my $i=0;
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
$template->param(tagfield => "$input->param('tagfield')");
- my $sth=$dbh->prepare("replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,hidden,isurl,itemtype)
+ my $sth=$dbh->prepare("replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,hidden,isurl,frameworkcode)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my @tagsubfield = $input->param('tagsubfield');
my @liblibrarian = $input->param('liblibrarian');
$value_builder,
$hidden,
$isurl,
- $itemtype,
+ $frameworkcode,
);
}
}
}
$sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marc_subfields_structure.pl?tagfield=$tagfield&itemtype=$itemtype\"></html>";
+ print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
exit;
# END $OP eq ADD_VALIDATE
# 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("select * from marc_subfield_structure where tagfield=? and tagsubfield=? and itemtype=?");
+ my $sth=$dbh->prepare("select * from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?");
$sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
$sth->finish;
delete_link => $script_name,
tagfield =>$tagfield,
tagsubfield => $tagsubfield,
- itemtype => $itemtype,
+ frameworkcode => $frameworkcode,
);
# END $OP eq DELETE_CONFIRM
################## DELETE_CONFIRMED ##################################
} elsif ($op eq 'delete_confirmed') {
my $dbh = C4::Context->dbh;
unless (C4::Context->config('demo') eq 1) {
- my $sth=$dbh->prepare("delete from marc_subfield_structure where tagfield=? and tagsubfield=? and itemtype=?");
- $sth->execute($tagfield,$tagsubfield,$itemtype);
+ my $sth=$dbh->prepare("delete from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?");
+ $sth->execute($tagfield,$tagsubfield,$frameworkcode);
$sth->finish;
}
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marc_subfields_structure.pl?tagfield=$tagfield&itemtype=$itemtype\"></html>";
+ print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
exit;
$template->param(tagfield => $tagfield);
# END $OP eq DELETE_CONFIRMED
################## DEFAULT ##################################
} else { # DEFAULT
my $env;
- my ($count,$results)=StringSearch($env,$tagfield,$itemtype);
+ my ($count,$results)=StringSearch($env,$tagfield,$frameworkcode);
my $toggle="white";
my @loop_data = ();
for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
$row_data{value_builder} = $results->[$i]{'value_builder'};
$row_data{hidden} = $results->[$i]{'hidden'};
$row_data{isurl} = $results->[$i]{'isurl'};
- $row_data{delete} = "$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&itemtype=$itemtype";
+ $row_data{delete} = "$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&frameworkcode=$frameworkcode";
$row_data{bgcolor} = $toggle;
if ($row_data{tab} eq -1) {
$row_data{subfield_ignored} = 1;
push(@loop_data, \%row_data);
}
$template->param(loop => \@loop_data);
- $template->param(edit => "<a href=\"$script_name?op=add_form&tagfield=$tagfield&itemtype=$itemtype\">");
+ $template->param(edit => "<a href=\"$script_name?op=add_form&tagfield=$tagfield&frameworkcode=$frameworkcode\">");
if ($offset>0) {
my $prevpage = $offset-$pagesize;
$template->param(prev =>"<a href=\"$script_name?offset=$prevpage\">");