From 2c8f894b96dd2e340d3aa8562ba9914ccbfb1d4f Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Wed, 5 Feb 2020 10:11:16 -0300 Subject: [PATCH] Bug 24593: Rewrite marc21_default_matching_rules to YAML YAML version of marc21 optional marc21_default_matching_rules. To test: 1) Do a clean install with optional data, dump table marc_matchers, reserve. 2) Apply this patch and it's dependencies 3) Do a clean install, dump again and compare No major differences expected 4) Try translation a) Go to misc/translator b) create files for a new language ./translate create xx-YY c) Check new file po/xx-YY-instaler-MARC21.po Verify strings from this file. d) Install new language ./translate install xx-YY e) Try clean install with new files NOTE: This patch fails with qa tools! Reason is that qa tools use YAML.pm module to check files, but Installer.pm or LangInstaller.pm are using YAML::Syck, using that module gives no error, check for example: perl -e 'use YAML::Syck qw( LoadFile ); $y = LoadFile("marc21_default_matching_rules.yml");' No error! perl -e 'use YAML qw( LoadFile ); $y = LoadFile("marc21_default_matching_rules.yml");' Error! Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- .../marc21_default_matching_rules.sql | 46 ------------- .../marc21_default_matching_rules.txt | 5 -- .../marc21_default_matching_rules.yml | 69 +++++++++++++++++++ 3 files changed, 69 insertions(+), 51 deletions(-) delete mode 100644 installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql delete mode 100644 installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt create mode 100644 installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql deleted file mode 100644 index 1344704317..0000000000 --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql +++ /dev/null @@ -1,46 +0,0 @@ --- --- Default MARC matching rules for Koha --- --- Copyright (C) 2007 LiblimeA --- --- 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 . - -INSERT INTO marc_matchers (code, description, record_type, threshold) - VALUES ('ISBN', '020$a', 'biblio', 1000); -INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'isbn', 1000 FROM marc_matchers; -INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; -INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) - SELECT MAX(matchpoint_id), 1, '020', 'a' FROM matchpoints; -INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) - SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components; - -INSERT INTO marc_matchers (code, description, record_type, threshold) - VALUES ('ISSN', '022$a', 'biblio', 1000); -INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'issn', 1000 FROM marc_matchers; -INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; -INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) - SELECT MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints; -INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) - SELECT MAX(matchpoint_component_id), 1, 'ISSN' FROM matchpoint_components; - -INSERT INTO marc_matchers (code, description, record_type, threshold) - VALUES ('KohaBiblio', '999$c', 'biblio', 1000); -INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'local-number', 1000 FROM marc_matchers; -INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; -INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) - SELECT MAX(matchpoint_id), 1, '999', 'c' FROM matchpoints; -INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) - SELECT MAX(matchpoint_component_id), 1, 'Biblionumber' FROM matchpoint_components; diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt deleted file mode 100644 index 471db24b3e..0000000000 --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt +++ /dev/null @@ -1,5 +0,0 @@ -Selected matching rules for MARC 21 bibliographic -records, including: - -ISBN -ISSN diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml new file mode 100644 index 0000000000..7dd48f20a6 --- /dev/null +++ b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml @@ -0,0 +1,69 @@ +--- +# +# Copyright 2020 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 2 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. +# +# ************************************************************* +# Default MARC matching rules for Koha +# ************************************************************* + +description: + - "Selected matching rules for MARC 21 bibliographic records, including:" + - "" + - "ISBN" + - "ISSN" + +tables: + - marc_matchers: + translatable: [] + multiline: [] + rows: + - code: "ISBN" + description: "020$a" + record_type: biblio + threshold: 1000 + + - code: "ISSN" + description: "022$a" + record_type: biblio + threshold: 1000 + + - code: "KohaBiblio" + description: "999$c" + record_type: biblio + threshold: 1000 + +sql_statements: + - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'isbn', 1000 FROM marc_matchers;" + - "INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;" + - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) SELECT MAX(matchpoint_id), 1, '020', 'a' FROM matchpoints;" + - "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) + SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components;" + + - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'issn', 1000 FROM marc_matchers;" + - "INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;" + - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) + SELECT MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints;" + - "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) + SELECT MAX(matchpoint_component_id), 1, 'ISSN' FROM matchpoint_components;" + + - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'local-number', 1000 FROM marc_matchers;" + - "INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;" + - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) + SELECT MAX(matchpoint_id), 1, '999', 'c' FROM matchpoints;" + - "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) + SELECT MAX(matchpoint_component_id), 1, 'Biblionumber' FROM matchpoint_components;" -- 2.39.5