From a440619d397039e24b607ba067bd8cd909ee634f Mon Sep 17 00:00:00 2001 From: Mathieu Saby Date: Tue, 14 Jan 2025 18:02:54 +0000 Subject: [PATCH] Bug 38336: Fix confusion between 099 and 942 UNIMARC fields (updated) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes 099 and 942 fields (and incidentally 200$b) in the default and the FA UNIMARC frameworks and provides the changes that follow logically : - Zebra and Elasticsearch indexing - removal of the unused TYPEDOC authorized values category - UNIMARC facets in Koha.pm These changes are minimal and are intended to correct only the most serious problems. Subsequent work may bring improvements. Detail of changes : - The 099 field is renamed "ADDED ENTRY ELEMENTS (KOHA)" like 942 in MARC21, and should be used in the same way. It is mandatory, because the 099$t (item type) is mandatory - The 942 field is renamed "OTHER ADDED ENTRY ELEMENTS (KOHA)". It is not mandatory, and may removed by subsequent Bugzilla bugs. - Subfields $c and $s are removed from 942 because they are already defined in 099 - The 200$b field is no more indexed (it is now obsolete in cataloguing standards, and its MARC21 counterpart is not indexed). - Like in MARC21, ccode is now defined only at item level and itemtype/itype is now defined at item and biblio level. - The default values for itemtype at biblio and item level are the same, controlled by itype values (document type). - The TYPEDOC authorized values category, which was used for controlling the value if itemtype at record level, is removed. - In Koha.pm UNIMARC facets are fixed to be a mirror of MARC21 facets: a facet for itemtypes is created, and the facet for ccode is now based only on items. Test plan: Note that sample data in ktd and sandbox may need to be fixed once this patch is pushed. It may cause warnings if you edit existing record but it is not a bug. A. Check AV and framework changes 1/ In a UNIMARC k-t-d or sandbox, with Zebra search engine 2/ Apply the patch 3/ Check that there is no "TYPEDOC" authorized value category 4/ Check default and FA framework - 099 should be labelled "ADDED ENTRY ELEMENTS (KOHA)" and contain subfields c, d, t (item type), s (serial flag), x (totalissues) - 942 should be labelled "OTHER ADDED ENTRY ELEMENTS (KOHA)" and contain subfields 2 and 6 5/ Create a new record with default framework -- add a 200$a field, a 100$a field (with the cataloging plugin) -- in 099$t field, check that the values in dropdown list are the one defines for 'item types' in administration (Books, Computer Files, Continuing Resource, etc). -- Choose the value "Computer field" and Save the record -- Koha displays the item creation form. Check that the preselected value in 995$r (item type) is "Computer field" 6/ Do the same operation for a new record with FA framework B. Check Zebra indexing changes 7 / Search "livre" in the catalog. 419 results should be shown 8 / Check that an "Item type" facet is visible and functional 9 / Edit the first record of the result list, change its 099t value and save 10 / Edit an item of that record and change the 995$r value (with a value different from the 099$t) and the 995$h value (3 possible values: Non-fiction, Fiction, Reference) 11 / Refresh the search for "livre" 12 / Check that the facet "Item types" has been updated and that a facet "Collections" is shown (from the 995$h) and functional C. Check Elasticsearch indexing changes 13 / You cannot currently test Elasticsearch in a sandbox, so, open a new k-t-d with Elasticsearch search engine (ktd --es7 up) 14 / Repeat operations 7 to 12 in that new instance (277 results should be shown after the search in step 7, instead of 419 for Zebra, this is normal) Sponsored-by: Université Côte d'Azur --- C4/Koha.pm | 8 +- .../searchengine/elasticsearch/mappings.yaml | 14 ++- .../unimarc/biblios/biblio-koha-indexdefs.xml | 38 ++++---- .../biblios/biblio-zebra-indexdefs.xsl | 88 +++++++++---------- .../mandatory/unimarc_framework_DEFAULT.yml | 86 ++++-------------- .../data/mysql/mandatory/auth_val_cat.sql | 1 - 6 files changed, 93 insertions(+), 142 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index bee096db9f..7eae63cf6e 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -367,6 +367,12 @@ sub getFacets { tags => [qw/ 225a /], sep => ', ', }, + { + idx => 'itype', + label => 'Item types', + tags => [qw/ 995r 099t /], + sep => ', ', + }, { idx => 'location', label => 'Location', @@ -375,7 +381,7 @@ sub getFacets { { idx => 'ccode', label => 'Collections', - tags => [qw / 099t 955h /], + tags => [qw / 995h /], } ]; diff --git a/admin/searchengine/elasticsearch/mappings.yaml b/admin/searchengine/elasticsearch/mappings.yaml index 139d66ffc4..af14ac7991 100644 --- a/admin/searchengine/elasticsearch/mappings.yaml +++ b/admin/searchengine/elasticsearch/mappings.yaml @@ -1351,7 +1351,7 @@ biblios: sort: 1 suggestible: '' - facet: 1 - marc_field: '9958' + marc_field: '995h' marc_type: unimarc sort: 1 suggestible: '' @@ -2255,6 +2255,11 @@ biblios: marc_type: marc21 sort: 1 suggestible: '' + - facet: '' + marc_field: 099t + marc_type: unimarc + sort: 1 + suggestible: '' opac: 1 staff_client: 1 type: '' @@ -2274,7 +2279,7 @@ biblios: sort: 1 suggestible: '' - facet: 1 - marc_field: 200b + marc_field: 099t marc_type: unimarc sort: 1 suggestible: '' @@ -4403,6 +4408,11 @@ biblios: marc_type: marc21 sort: 1 suggestible: '' + - facet: '' + marc_field: '099x' + marc_type: unimarc + sort: 1 + suggestible: '' opac: 1 staff_client: 1 type: '' diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml index 5425bc2ba6..fe21d0d5bd 100644 --- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml @@ -39,9 +39,17 @@ Date/time-last-modified:n Date/time-last-modified:y - + + + totalissues:n + totalissues:s + + - ccode:w + itemtype:w + itemtype:p + itype:w + itype:p @@ -103,15 +111,6 @@ EAN:w Identifier-standard:w - - - itemtype:w - itemtype:p - itype:w - itype:p - Material-type:w - Material-type:p - itemtype:w @@ -1441,17 +1440,9 @@ item:w - - - totalissues:n - totalissues:s - not-onloan-count:n - - ccode:0 - se:0 @@ -1488,6 +1479,9 @@ au:0 + + itype:0 + homebranch:0 @@ -1500,5 +1494,7 @@ ccode:0 - - + + itype:0 + + diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl index 22d902c461..6dabbfa9af 100644 --- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl @@ -87,9 +87,16 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + - + @@ -217,36 +224,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -643,6 +620,29 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + + + + + + + + + + + + + + + + + @@ -1874,15 +1874,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - - - - - - - - - @@ -2542,13 +2533,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - - - - - - - @@ -2661,6 +2645,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + @@ -2675,6 +2666,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml index afc80b8425..f34c07b0ca 100644 --- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml +++ b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml @@ -423,10 +423,10 @@ tables: multiline: [] rows: - tagfield: "099" - liblibrarian: "local dates" - libopac: "" + liblibrarian: "ADDED ENTRY ELEMENTS (KOHA)" + libopac: "ADDED ENTRY ELEMENTS (KOHA)" repeatable: 0 - mandatory: 0 + mandatory: 1 authorised_value: frameworkcode: "" @@ -472,8 +472,8 @@ tables: - tagfield: "099" tagsubfield: "s" - liblibrarian: "Serial" - libopac: "Serial" + liblibrarian: "Serial record flag" + libopac: "Serial record flag" repeatable: 0 mandatory: 0 kohafield: biblio.serial @@ -481,8 +481,8 @@ tables: authorised_value: authtypecode: "" value_builder: "" - isurl: 0 - hidden: 7 + isurl: + hidden: -5 frameworkcode: "" seealso: "" link: "" @@ -496,10 +496,10 @@ tables: mandatory: 1 kohafield: biblioitems.itemtype tab: 0 - authorised_value: TYPEDOC + authorised_value: itemtypes authtypecode: "" value_builder: "" - isurl: 0 + isurl: hidden: 0 frameworkcode: "" seealso: "" @@ -508,8 +508,8 @@ tables: - tagfield: "099" tagsubfield: "x" - liblibrarian: "Number of issues" - libopac: "Number of issues" + liblibrarian: "Koha issues (borrowed), all copies" + libopac: "Koha issues (borrowed), all copies" repeatable: 0 mandatory: 0 kohafield: biblioitems.totalissues @@ -517,20 +517,20 @@ tables: authorised_value: authtypecode: "" value_builder: "" - isurl: 0 - hidden: 6 + isurl: + hidden: -5 frameworkcode: "" seealso: "" link: "" - defaultvalue: "" + defaultvalue: - marc_tag_structure: translatable: [ liblibrarian, libopac ] multiline: [] rows: - tagfield: "942" - liblibrarian: "ADDED ENTRY ELEMENTS (KOHA)" - libopac: "ADDED ENTRY ELEMENTS (KOHA)" + liblibrarian: "OTHER ADDED ENTRY ELEMENTS (KOHA)" + libopac: "OTHER ADDED ENTRY ELEMENTS (KOHA)" repeatable: 0 mandatory: 0 authorised_value: @@ -540,24 +540,6 @@ tables: translatable: [ liblibrarian, libopac ] multiline: [] rows: - - tagfield: "942" - tagsubfield: "0" - liblibrarian: "Koha issues (borrowed), all copies" - libopac: "Koha issues (borrowed), all copies" - repeatable: 0 - mandatory: 0 - kohafield: biblioitems.totalissues - tab: 9 - authorised_value: - authtypecode: "" - value_builder: "" - isurl: - hidden: -5 - frameworkcode: "" - seealso: "" - link: "" - defaultvalue: - - tagfield: "942" tagsubfield: "2" liblibrarian: "Source of classification or shelving scheme" @@ -594,42 +576,6 @@ tables: link: "" defaultvalue: - - tagfield: "942" - tagsubfield: "c" - liblibrarian: "Koha item type" - libopac: "Koha item type" - repeatable: 0 - mandatory: 1 - kohafield: biblioitems.itemtype - tab: 9 - authorised_value: itemtypes - authtypecode: "" - value_builder: "" - isurl: - hidden: 0 - frameworkcode: "" - seealso: "" - link: "" - defaultvalue: - - - tagfield: "942" - tagsubfield: "s" - liblibrarian: "Serial record" - libopac: "Serial record" - repeatable: 0 - mandatory: 0 - kohafield: biblio.serial - tab: 9 - authorised_value: - authtypecode: "" - value_builder: "" - isurl: - hidden: -5 - frameworkcode: "" - seealso: "" - link: "" - defaultvalue: - - marc_tag_structure: translatable: [ liblibrarian, libopac ] multiline: [] diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index c1428e4a3c..e15875ca9d 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -57,7 +57,6 @@ INSERT IGNORE INTO authorised_value_categories( category_name ) VALUES ('ETAT'), ('CAND'), ('COUNTRY'), - ('TYPEDOC'), ('qualif'); -- For Housebound -- 2.39.5