Koha/cataloguing/editor.pl
Nick Clemens 297529c251 Bug 18904: Advanced editor - Rancor - Add authority support
This patchset adds the ability to use the authorities search to select
or clear fields in the advanced editor

To test:
 1 - Open a record in the advanced cataloging editor
 2 - Press 'Ctrl+L' while in a field that shuold not be linked to
authorities (300 for instance)
 3 - Nothing should happen
 4 - Try it in a field that should be linked
 5 - You should get the authorities pop-up
 6 - Values in pop-up should be populated from values in record (as
        appropriate for authority type)
 7 - Correct authority type should be selected ( PERSO_NAME for 100,
        TOPIC_TERM for 650, etc.)
 8 - Press 'Clear', field should be blanked
 9 - Search again and select an authority
10 - Field should be correctly populated

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-12 10:50:36 -03:00

71 lines
2.1 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;
my $input = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => 'cataloguing/editor.tt',
query => $input,
type => 'intranet',
authnotrequired => 0,
flagsrequired => { editcatalogue => 'edit_catalogue' },
}
);
my $schema = Koha::Database->new->schema;
# 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' );
my $authtags = Koha::MarcSubfieldStructures->search({ authtypecode => { '!=' => '' }, 'frameworkcode' => '' });
$template->{VARS}->{authtags} = $authtags;
# 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 servername
}, { Slice => {} } );
output_html_with_http_headers $input, $cookie, $template->output;