+++ /dev/null
-package Koha::FieldMapping;
-
-# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-use Modern::Perl;
-
-use Carp;
-
-use Koha::Database;
-
-use base qw(Koha::Object);
-
-=head1 NAME
-
-Koha::FieldMapping - Koha Field Mapping Object class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 type
-
-=cut
-
-sub _type {
- return 'Fieldmapping';
-}
-
-1;
+++ /dev/null
-package Koha::FieldMappings;
-
-# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-use Modern::Perl;
-
-use Carp;
-
-use Koha::Database;
-
-use Koha::FieldMapping;
-
-use base qw(Koha::Objects);
-
-=head1 NAME
-
-Koha::FieldMappings - Koha Field Mapping Object set class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 type
-
-=cut
-
-sub _type {
- return 'Fieldmapping';
-}
-
-sub object_class {
- return 'Koha::FieldMapping';
-}
-
-1;
'admin/didyoumean' => '/administration.html#did-you-mean?',
'admin/edi_accounts' => '/administration.html#edi-accounts',
'admin/edi_ean_accounts' => '/administration.html#library-eans',
- 'admin/fieldmapping' => '/administration.html#keywords-to-marc-mapping',
'admin/item_circulation_alerts' => '/administration.html#item-circulation-alerts',
'admin/items_search_fields' => '/administration.html#item-search-fields',
'admin/itemtypes' => '/administration.html#item-types',
+++ /dev/null
-#!/usr/bin/perl
-# Copyright 2009 SARL BibLibre
-# Copyright 2017 Koha Development Team
-#
-# 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 qw ( -utf8 );
-use C4::Auth;
-use C4::Biblio;
-use C4::Output;
-
-use Koha::BiblioFrameworks;
-use Koha::FieldMappings;
-
-my $query = new CGI;
-
-my $frameworkcode = $query->param('framework') || "";
-my $field = $query->param('fieldname');
-my $fieldcode = $query->param('marcfield');
-my $subfieldcode = $query->param('marcsubfield');
-my $op = $query->param('op') || q{};
-my $id = $query->param('id');
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
- {
- template_name => "admin/fieldmapping.tt",
- query => $query,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => { parameters => 'manage_keywords2marc_mappings' },
- debug => 1,
- }
-);
-
-# FIXME Add exceptions
-if ( $op eq "delete" and $id ) {
- Koha::FieldMappings->find($id)->delete;
-} elsif ( $field and $fieldcode ) {
- my $params = { frameworkcode => $frameworkcode, field => $field, fieldcode => $fieldcode, subfieldcode => $subfieldcode };
- my $exists = Koha::FieldMappings->search( $params )->count;;
- unless ( $exists ) {
- Koha::FieldMapping->new( $params )->store;
- }
-}
-
-my $fields = Koha::FieldMappings->search({ frameworkcode => $frameworkcode });
-
-my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
-my $framework = $frameworks->search( { frameworkcode => $frameworkcode } )->next;
-$template->param(
- frameworks => $frameworks,
- framework => $framework,
- fields => $fields,
-);
-
-output_html_with_http_headers $query, $cookie, $template->output;
$dbh->do( "UPDATE marc_subfield_structure SET kohafield='biblio.part_name' WHERE frameworkcode='' AND tagfield='245' AND tagsubfield='p'" );
}
+ $dbh->do( "DROP TABLE IF EXISTS fieldmapping" );
+
# Always end with this (adjust the bug info)
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 11529 - Add medium, subtitle and part information to biblio table)\n";
CONSTRAINT aqorders_transfers_ordernumber_to FOREIGN KEY (ordernumber_to) REFERENCES aqorders (ordernumber) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
---
--- Table structure for table `fieldmapping`
---
-
-DROP TABLE IF EXISTS `fieldmapping`;
-CREATE TABLE `fieldmapping` ( -- koha to keyword mapping
- `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
- `field` varchar(255) NOT NULL, -- keyword to be mapped to (ex. subtitle)
- `frameworkcode` char(4) NOT NULL default '', -- foreign key from the biblio_framework table to link this mapping to a specific framework
- `fieldcode` char(3) NOT NULL, -- marc field number to map to this keyword
- `subfieldcode` char(1) NOT NULL, -- marc subfield associated with the fieldcode to map to this keyword
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `transport_cost`
+++ /dev/null
-INSERT INTO `fieldmapping` (`field`, `frameworkcode`, `fieldcode`, `subfieldcode`) VALUES
-('subtitle', 'CF', '245', 'p'),
-('subtitle', 'SER', '490', 'v');
+++ /dev/null
-Отображение ключевого слова в МАРК-поле (пока 490^v (SER) и 245^p (CF) в кл.сл. «subtitle»).
+++ /dev/null
--- koha to keyword mapping
--- id -- unique identifier assigned by Koha (auto_increment)
--- field -- keyword to be mapped to (ex. subtitle)
--- frameworkcode -- foreign key from the biblio_framework table to link this mapping to a specific framework (default '')
--- fieldcode -- marc field number to map to this keyword
--- subfieldcode -- marc subfield associated with the fieldcode to map to this keyword
-INSERT INTO fieldmapping
- ( field, frameworkcode, fieldcode, subfieldcode) VALUES
- ('subtitle', 'CF', '245', 'p'),
- ('subtitle', 'SER', '490', 'v');
+++ /dev/null
-Відображення ключового слова у МАРК-поле (наразі 490^v (SER) та 245^p (CF) у кл.сл. „subtitle“).
<li><a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC bibliographic framework</a></li>
<li><a href="/cgi-bin/koha/admin/koha2marclinks.pl">Koha to MARC mapping</a></li>
[% END %]
- [% IF ( CAN_user_parameters_manage_keywords2koha_mappings ) %]
- <li><a href="/cgi-bin/koha/admin/fieldmapping.pl">Keywords to MARC mapping</a></li>
- [% END %]
[% IF ( CAN_user_parameters_manage_marc_frameworks ) %]
<li><a href="/cgi-bin/koha/admin/checkmarc.pl">MARC bibliographic framework test</a></li>
<li><a href="/cgi-bin/koha/admin/authtypes.pl">Authority types</a></li>
<dt><a href="/cgi-bin/koha/admin/koha2marclinks.pl">Koha to MARC mapping</a></dt>
<dd>Define the mapping between the Koha transactional database (SQL) and the MARC Bibliographic records.</dd>
[% END %]
- [% IF ( CAN_user_parameters_manage_keywords2koha_mappings ) %]
- <dt><a href="/cgi-bin/koha/admin/fieldmapping.pl">Keywords to MARC mapping</a></dt>
- <dd>Define the mapping between keywords and MARC fields. The keywords are used to find some data independently of the framework.</dd>
- [% END %]
[% IF ( CAN_user_parameters_manage_marc_frameworks ) %]
<dt><a href="/cgi-bin/koha/admin/checkmarc.pl">MARC Bibliographic framework test</a></dt>
<dd>Checks the MARC structure. If you change your MARC Bibliographic framework it's recommended that you run this tool to test for errors in your definition.</dd>
+++ /dev/null
-[% USE raw %]
-[% USE Asset %]
-[% SET footerjs = 1 %]
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Administration › Keyword to MARC mapping</title>
-[% INCLUDE 'doc-head-close.inc' %]
-</head>
-
-<body id="admin_fieldmapping" class="admin">
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'prefs-admin-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Keyword to MARC mapping</div>
-
-<div class="main container-fluid">
- <div class="row">
- <div class="col-sm-10 col-sm-push-2">
- <main>
-
- <h2>Keyword to MARC mapping</h2>
- [% UNLESS ( fields.count ) %]
- <div class="dialog message"><p>There are no mappings for the [% IF framework.frameworktext %]<em>[% framework.frameworktext | html %]</em>[% ELSE %]default[% END %] framework. </p></div>
- [% END %]
- <form method="get" action="/cgi-bin/koha/admin/fieldmapping.pl" id="selectframework">
- <label for="framework">Framework:</label>
- <select name="framework" id="framework" style="width:20em;">
- <option value="">Default</option>
- [% FOREACH f IN frameworks %]
- [% IF f.frameworkcode == framework.frameworkcode %]
- <option selected="selected" value="[% f.frameworkcode | html %]">[% f.frameworktext | html %]</option>
- [% ELSE %]
- <option value="[% f.frameworkcode | html %]">[% f.frameworktext | html %]</option>
- [% END %]
- [% END %]
- </select>
- <input type="submit" value="Go" />
- </form>
-
-
- <form method="post" action="" id="addfield">
- <input type="hidden" name="framework" value="[% framework.frameworkcode | html %]" />
- <fieldset class="rows">
- <legend>Add a mapping</legend>
- <ol>
- <li><label for="fieldname">Field name: </label><input type="text" id="fieldname" name="fieldname" /></li>
- <li><label for="marcfield">MARC field: </label><input type="text" id="marcfield" name="marcfield" size="3" /></li>
- <li><label for="marcsubfield">MARC subfield: </label><input type="text" id="marcsubfield" name="marcsubfield" size="1" /></li>
- </ol>
- <fieldset class="action">
- <input type="submit" value="Submit" />
- </fieldset>
- </fieldset>
- </form>
-
- [% IF ( fields.count ) %]
- <table>
- <caption>Mappings for the [% IF framework.frameworktext %]<em>[% framework.frameworktext | html %]</em>[% ELSE %]default[% END %] framework</caption>
- <tr>
- <th>Field</th>
- <th>MARC field</th>
- <th>MARC subfield</th>
- <th> </th>
- </tr>
- [% FOREACH field IN fields %]
- <tr>
- <td>[% field.field | html %]</td>
- <td>[% field.fieldcode | html %]</td>
- <td>[% field.subfieldcode | html %]</td>
- <td><a class="btn btn-default btn-xs" href="?op=delete&id=[% field.id | html %]&framework=[% field.frameworkcode | html %]"><i class="fa fa-trash"></i> Delete</a></td>
- </tr>
- [% END %]
- </table>[% END %]
-
- </main>
- </div> <!-- /.col-sm-10.col-sm-push-2 -->
-
- <div class="col-sm-2 col-sm-pull-10">
- <aside>
- [% INCLUDE 'admin-menu.inc' %]
- </aside>
- </div> <!-- /.col-sm-2.col-sm-pull-10 -->
- </div> <!-- /.row -->
-[% MACRO jsinclude BLOCK %]
- [% Asset.js("js/admin-menu.js") | $raw %]
- <script type="text/javascript">
- <script>
- $(document).ready(function() {
- $('#selectframework').find("input:submit").hide();
- $('#framework').change(function() {
- $('#selectframework').submit();
- });
- });
- </script>
-[% END %]
-[% INCLUDE 'intranet-bottom.inc' %]
);
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $biblio, '' );
-my $field_mappings = Koha::Database->new()->schema()->resultset('Fieldmapping');
-$field_mappings->delete();
-$field_mappings->create( { field => 'subtitle', fieldcode => '245', subfieldcode => 'b' } );
-
$biblio = Koha::Biblios->find( $biblionumber );
my @subtitles = $biblio->subtitles();
is( $subtitles[0], 'Test Record Subtitle', 'Got first subtitle correctly' );