Bug 11529: Remove field mapping table and admin page
authorEre Maijala <ere.maijala@helsinki.fi>
Tue, 20 Nov 2018 11:23:29 +0000 (13:23 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 5 Aug 2019 14:03:18 +0000 (15:03 +0100)
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
14 files changed:
Koha/FieldMapping.pm [deleted file]
Koha/FieldMappings.pm [deleted file]
Koha/Manual.pm
admin/fieldmapping.pl [deleted file]
installer/data/mysql/atomicupdate/bug_11529.perl
installer/data/mysql/kohastructure.sql
installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.sql [deleted file]
installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.txt [deleted file]
installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.sql [deleted file]
installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.txt [deleted file]
koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt [deleted file]
t/db_dependent/Koha/BiblioUtils.t

diff --git a/Koha/FieldMapping.pm b/Koha/FieldMapping.pm
deleted file mode 100644 (file)
index bf0a1d6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-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;
diff --git a/Koha/FieldMappings.pm b/Koha/FieldMappings.pm
deleted file mode 100644 (file)
index 8145dd7..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-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;
index 99be4e4..42ad9aa 100644 (file)
@@ -79,7 +79,6 @@ our $mapping = {
     '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',
diff --git a/admin/fieldmapping.pl b/admin/fieldmapping.pl
deleted file mode 100755 (executable)
index ac13cc2..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/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;
index 43ef42f..c67d85f 100644 (file)
@@ -28,6 +28,8 @@ if( CheckVersion( $DBversion ) ) {
         $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";
index 5fe40dd..5016b68 100644 (file)
@@ -3198,19 +3198,6 @@ CREATE TABLE aqorders_transfers (
   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`
diff --git a/installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.sql b/installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.sql
deleted file mode 100644 (file)
index 19c4058..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-INSERT INTO `fieldmapping` (`field`, `frameworkcode`, `fieldcode`, `subfieldcode`) VALUES
-('subtitle', 'CF',  '245', 'p'),
-('subtitle', 'SER', '490', 'v');
diff --git a/installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.txt b/installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.txt
deleted file mode 100644 (file)
index 94d57bd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Отображение ключевого слова в МАРК-поле (пока 490^v (SER) и 245^p (CF) в кл.сл. «subtitle»).
diff --git a/installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.sql b/installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.sql
deleted file mode 100644 (file)
index 71f2f1a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
--- 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');
diff --git a/installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.txt b/installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.txt
deleted file mode 100644 (file)
index 6382493..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Відображення ключового слова у МАРК-поле (наразі 490^v (SER) та 245^p (CF) у кл.сл. „subtitle“).
index 5096024..6f426ce 100644 (file)
@@ -58,9 +58,6 @@
                 <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>
index fdc7cfd..15200ad 100644 (file)
                         <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>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt
deleted file mode 100644 (file)
index b4a75a9..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-[% USE raw %]
-[% USE Asset %]
-[% SET footerjs = 1 %]
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Administration &rsaquo; 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> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; 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>&nbsp;</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&amp;id=[% field.id | html %]&amp;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' %]
index 85bf921..fb5776d 100755 (executable)
@@ -46,10 +46,6 @@ $biblio->append_fields(
 );
 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' );