Koha/cataloguing/editor.pl
Phil Ringnalda 53e1002e11 Bug 27739: Advanced editor should use DefaultCountryField008 preference
Uses the system preference DefaultCountryField008, falling back to ||| (no
attempt to code) if it is not set, for 008/15-17 place of publication in
the advanced cataloging editor..

Test plan:
1) Apply patch and restart all the things, something's over-cached here
2) Administration - Toggle the preference  EnableAdvancedCatalogingEditor
   to "Enable", verify the preference DefaultCountryField008 is empty
3) Cataloging - Advanced editor
4) In field 008, verify that the three characters after the two sets of
   four blank spaces are |||
5) Administration - Set DefaultCountryField008 to fr
6) Cataloging - Advanced editor
7) In field 008, verify that the three characters after the two sets of
   four blank spaces are "fr " (including the space, so following
   characters haven't shifted left, and the last character is still d)

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 12:28:17 +02:00

88 lines
2.7 KiB
Perl
Executable file

#!/usr/bin/perl
#
# Copyright 2013 ByWater
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
#
use Modern::Perl;
use CGI;
use MARC::Record;
use C4::Auth;
use C4::Biblio;
use C4::Context;
use C4::Output;
use DBIx::Class::ResultClass::HashRefInflator;
use Koha::Database;
use Koha::MarcSubfieldStructures;
use Koha::BiblioFrameworks;
use Koha::KeyboardShortcuts;
my $input = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => 'cataloguing/editor.tt',
query => $input,
type => 'intranet',
flagsrequired => {
editcatalogue => {
'edit_catalogue' => 1,
'advanced_editor' => 1
},
}
}
);
my $schema = Koha::Database->new->schema;
my @keyboard_shortcuts = Koha::KeyboardShortcuts->search();
# Keyboard shortcuts
$template->param(
shortcuts => \@keyboard_shortcuts,
);
# Available import batches
$template->{VARS}->{editable_batches} = [ $schema->resultset('ImportBatch')->search(
{
batch_type => [ 'batch', 'webservice' ],
import_status => 'staged',
},
{ result_class => 'DBIx::Class::ResultClass::HashRefInflator' },
) ];
# Needed information for cataloging plugins
$template->{VARS}->{DefaultLanguageField008} = pack( 'A3', C4::Context->preference('DefaultLanguageField008') || 'eng' );
$template->{VARS}->{DefaultCountryField008} = pack( 'A3', C4::Context->preference('DefaultCountryField008') || '|||' );
my $authtags = Koha::MarcSubfieldStructures->search({ authtypecode => { '!=' => '' }, 'frameworkcode' => '' });
$template->{VARS}->{authtags} = $authtags;
my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
$template->{VARS}->{frameworks} = $frameworks;
# Z39.50 servers
my $dbh = C4::Context->dbh;
$template->{VARS}->{z3950_servers} = $dbh->selectall_arrayref( q{
SELECT * FROM z3950servers
WHERE recordtype != 'authority' AND servertype = 'zed'
ORDER BY rank,servername
}, { Slice => {} } );
output_html_with_http_headers $input, $cookie, $template->output;