use C4::Context;
use Koha::Authority::Types;
+use Koha::AuthorisedValueCategories;
use List::MoreUtils qw( uniq );
debug => 1,
}
);
-my $cache = Koha::Cache->get_instance();
+my $cache = Koha::Caches->get_instance();
my $op = $input->param('op') || "";
$tagfield =~ s/\,//g;
$sth2->finish;
$sth2 = $dbh->prepare("select distinct category from authorised_values");
$sth2->execute;
- my @authorised_values;
- push @authorised_values, "";
- while ( ( my $category ) = $sth2->fetchrow_array ) {
- push @authorised_values, $category;
- }
- push( @authorised_values, "branches" );
- push( @authorised_values, "itemtypes" );
- push( @authorised_values, "cn_source" );
+ my @av_cat = Koha::AuthorisedValueCategories->search;
+ my @authorised_values = map { $_->category_name } @av_cat;
# build thesaurus categories list
my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
my $maxlength = $maxlength[$i] ? $maxlength[$i] : 9999;
if (defined($liblibrarian) && $liblibrarian ne "") {
- unless ( C4::Context->config('demo') or C4::Context->config('demo') eq 1 ) {
+ my $is_demo = C4::Context->config('demo') || '';
+ if ( $is_demo ne '1' ) {
if (marc_subfield_structure_exists($tagfield, $tagsubfield, $frameworkcode)) {
$sth_update->execute(
$tagfield,
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode");
+ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode");
exit;
}
elsif ( $op eq 'delete_confirmed' ) {
my $dbh = C4::Context->dbh;
- unless ( C4::Context->config('demo') or C4::Context->config('demo') eq 1 ) {
+ my $is_demo = C4::Context->config('demo') || '';
+ if ( $is_demo ne '1' ) {
my $sth =
$dbh->prepare(
"delete from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?"
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode");
+ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode");
exit;