From 5af98f8fab3b0d9263962bac6b5a1e453ad3e988 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Tue, 20 Nov 2018 13:23:29 +0200 Subject: [PATCH] Bug 11529: Remove field mapping table and admin page Signed-off-by: Michal Denar Signed-off-by: Michal Denar Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- Koha/FieldMapping.pm | 44 --------- Koha/FieldMappings.pm | 50 ---------- Koha/Manual.pm | 1 - admin/fieldmapping.pl | 70 -------------- .../data/mysql/atomicupdate/bug_11529.perl | 2 + installer/data/mysql/kohastructure.sql | 13 --- .../marc21/optional/fieldmapping.sql | 3 - .../marc21/optional/fieldmapping.txt | 1 - .../marc21/optional/fieldmapping.sql | 10 -- .../marc21/optional/fieldmapping.txt | 1 - .../prog/en/includes/admin-menu.inc | 3 - .../prog/en/modules/admin/admin-home.tt | 4 - .../prog/en/modules/admin/fieldmapping.tt | 94 ------------------- t/db_dependent/Koha/BiblioUtils.t | 4 - 14 files changed, 2 insertions(+), 298 deletions(-) delete mode 100644 Koha/FieldMapping.pm delete mode 100644 Koha/FieldMappings.pm delete mode 100755 admin/fieldmapping.pl delete mode 100644 installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.sql delete mode 100644 installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.txt delete mode 100644 installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.sql delete mode 100644 installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.txt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt diff --git a/Koha/FieldMapping.pm b/Koha/FieldMapping.pm deleted file mode 100644 index bf0a1d62ab..0000000000 --- a/Koha/FieldMapping.pm +++ /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 index 8145dd7ecc..0000000000 --- a/Koha/FieldMappings.pm +++ /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; diff --git a/Koha/Manual.pm b/Koha/Manual.pm index 99be4e4476..42ad9aa9e9 100644 --- a/Koha/Manual.pm +++ b/Koha/Manual.pm @@ -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 index ac13cc201c..0000000000 --- a/admin/fieldmapping.pl +++ /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 . - -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; diff --git a/installer/data/mysql/atomicupdate/bug_11529.perl b/installer/data/mysql/atomicupdate/bug_11529.perl index 43ef42f0ec..c67d85f2b7 100644 --- a/installer/data/mysql/atomicupdate/bug_11529.perl +++ b/installer/data/mysql/atomicupdate/bug_11529.perl @@ -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"; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 5fe40dd733..5016b68c51 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -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 index 19c4058f94..0000000000 --- a/installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.sql +++ /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 index 94d57bd7fd..0000000000 --- a/installer/data/mysql/ru-RU/marcflavour/marc21/optional/fieldmapping.txt +++ /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 index 71f2f1a6a9..0000000000 --- a/installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.sql +++ /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 index 6382493eea..0000000000 --- a/installer/data/mysql/uk-UA/marcflavour/marc21/optional/fieldmapping.txt +++ /dev/null @@ -1 +0,0 @@ -Відображення ключового слова у МАРК-поле (наразі 490^v (SER) та 245^p (CF) у кл.сл. „subtitle“). diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc index 50960244af..6f426ce792 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc @@ -58,9 +58,6 @@
  • MARC bibliographic framework
  • Koha to MARC mapping
  • [% END %] - [% IF ( CAN_user_parameters_manage_keywords2koha_mappings ) %] -
  • Keywords to MARC mapping
  • - [% END %] [% IF ( CAN_user_parameters_manage_marc_frameworks ) %]
  • MARC bibliographic framework test
  • Authority types
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index fdc7cfd027..15200ad8fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -117,10 +117,6 @@
    Koha to MARC mapping
    Define the mapping between the Koha transactional database (SQL) and the MARC Bibliographic records.
    [% END %] - [% IF ( CAN_user_parameters_manage_keywords2koha_mappings ) %] -
    Keywords to MARC mapping
    -
    Define the mapping between keywords and MARC fields. The keywords are used to find some data independently of the framework.
    - [% END %] [% IF ( CAN_user_parameters_manage_marc_frameworks ) %]
    MARC Bibliographic framework test
    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.
    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 index b4a75a91d9..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/fieldmapping.tt +++ /dev/null @@ -1,94 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -Koha › Administration › Keyword to MARC mapping -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'prefs-admin-search.inc' %] - - -
    -
    -
    -
    - -

    Keyword to MARC mapping

    - [% UNLESS ( fields.count ) %] -

    There are no mappings for the [% IF framework.frameworktext %][% framework.frameworktext | html %][% ELSE %]default[% END %] framework.

    - [% END %] -
    - - - -
    - - -
    - -
    - Add a mapping -
      -
    1. -
    2. -
    3. -
    -
    - -
    -
    -
    - - [% IF ( fields.count ) %] - - - - - - - - - [% FOREACH field IN fields %] - - - - - - - [% END %] -
    Mappings for the [% IF framework.frameworktext %][% framework.frameworktext | html %][% ELSE %]default[% END %] framework
    FieldMARC fieldMARC subfield 
    [% field.field | html %][% field.fieldcode | html %][% field.subfieldcode | html %] Delete
    [% END %] - -
    -
    - -
    - -
    -
    -[% MACRO jsinclude BLOCK %] - [% Asset.js("js/admin-menu.js") | $raw %] - -[% END %] -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/t/db_dependent/Koha/BiblioUtils.t b/t/db_dependent/Koha/BiblioUtils.t index 85bf9217b9..fb5776d800 100755 --- a/t/db_dependent/Koha/BiblioUtils.t +++ b/t/db_dependent/Koha/BiblioUtils.t @@ -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' ); -- 2.39.5