Bugzilla – Attachment 186392 Details for
Bug 38336
Confusion between 099 and 942 field in UNIMARC framework
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38336: Fix confusion between 099 and 942 UNIMARC fields (updated)
Bug-38336-Fix-confusion-between-099-and-942-UNIMAR.patch (text/plain), 19.80 KB, created by
Mathieu Saby
on 2025-09-13 15:08:19 UTC
(
hide
)
Description:
Bug 38336: Fix confusion between 099 and 942 UNIMARC fields (updated)
Filename:
MIME Type:
Creator:
Mathieu Saby
Created:
2025-09-13 15:08:19 UTC
Size:
19.80 KB
patch
obsolete
>From a440619d397039e24b607ba067bd8cd909ee634f Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathsabypro@gmail.com> >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 @@ > <target_index>Date/time-last-modified:n</target_index> > <target_index>Date/time-last-modified:y</target_index> > </index_subfields> >- <!--record.abs line 30: melm 099$t ccode:w--> >+ <!--099$x : totalissues--> >+ <index_subfields tag="099" subfields="x"> >+ <target_index>totalissues:n</target_index> >+ <target_index>totalissues:s</target_index> >+ </index_subfields> >+ <!--099$t : itemtype--> > <index_subfields tag="099" subfields="t"> >- <target_index>ccode:w</target_index> >+ <target_index>itemtype:w</target_index> >+ <target_index>itemtype:p</target_index> >+ <target_index>itype:w</target_index> >+ <target_index>itype:p</target_index> > </index_subfields> > <!--010 : ISBN--> > <index_subfields tag="010" subfields="az"> >@@ -103,15 +111,6 @@ > <target_index>EAN:w</target_index> > <target_index>Identifier-standard:w</target_index> > </index_subfields> >- <!--record.abs melm 200$b itemtype:w,itemtype:p,itype:w,itype:p,Material-type:w,Material-type:p--> >- <index_subfields tag="200" subfields="b"> >- <target_index>itemtype:w</target_index> >- <target_index>itemtype:p</target_index> >- <target_index>itype:w</target_index> >- <target_index>itype:p</target_index> >- <target_index>Material-type:w</target_index> >- <target_index>Material-type:p</target_index> >- </index_subfields> > <!--record.abs line 87: melm 995$r itemtype:w,itemtype:p,itype:w,itype:p--> > <index_subfields tag="995" subfields="r"> > <target_index>itemtype:w</target_index> >@@ -1441,17 +1440,9 @@ > <index_data_field tag="995"> > <target_index>item:w</target_index> > </index_data_field> >- <!--942$0 totalissues:n,totalissues:s--> >- <index_subfields tag="942" subfields="0"> >- <target_index>totalissues:n</target_index> >- <target_index>totalissues:s</target_index> >- </index_subfields> > <index_subfields tag="999" subfields="x"> > <target_index>not-onloan-count:n</target_index> > </index_subfields> >- <facet tag="099" subfields="t"> >- <target_index>ccode:0</target_index> >- </facet> > <facet tag="225" subfields="a"> > <target_index>se:0</target_index> > </facet> >@@ -1488,6 +1479,9 @@ > <facet tag="702" subfields="ab"> > <target_index>au:0</target_index> > </facet> >+ <facet tag="099" subfields="t"> >+ <target_index>itype:0</target_index> >+ </facet> > <facet tag="995" subfields="b"> > <target_index>homebranch:0</target_index> > </facet> >@@ -1500,5 +1494,7 @@ > <facet tag="995" subfields="h"> > <target_index>ccode:0</target_index> > </facet> >- >-</kohaidx:index_defs> >+ <facet tag="995" subfields="r"> >+ <target_index>itype:0</target_index> >+ </facet> >+ </kohaidx:index_defs> >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) > </z:index> > </xslo:if> > </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('x', @code)"> >+ <z:index name="totalissues:n totalissues:s"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('t', @code)"> >- <z:index name="ccode:w"> >+ <z:index name="itemtype:w itemtype:p itype:w itype:p"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >@@ -217,36 +224,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:if> > </xslo:for-each> > </xslo:template> >- <xslo:template mode="index_subfields" match="marc:datafield[@tag='200']"> >- <xslo:for-each select="marc:subfield"> >- <xslo:if test="contains('b', @code)"> >- <z:index name="itemtype:w itemtype:p itype:w itype:p Material-type:w Material-type:p"> >- <xslo:value-of select="."/> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- <xslo:for-each select="marc:subfield"> >- <xslo:if test="contains('fg', @code)"> >- <z:index name="Author:w Author:p"> >- <xslo:value-of select="."/> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- <xslo:for-each select="marc:subfield"> >- <xslo:if test="contains('aei', @code)"> >- <z:index name="Title:w Title:p Title:s Title-cover:w Title-cover:p Title-cover:s"> >- <xslo:value-of select="."/> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- <xslo:for-each select="marc:subfield"> >- <xslo:if test="contains('cd', @code)"> >- <z:index name="Title:w Title:p"> >- <xslo:value-of select="."/> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- </xslo:template> > <xslo:template mode="index_subfields" match="marc:datafield[@tag='995']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('r', @code)"> >@@ -643,6 +620,29 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:if> > </xslo:for-each> > </xslo:template> >+ <xslo:template mode="index_subfields" match="marc:datafield[@tag='200']"> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('fg', @code)"> >+ <z:index name="Author:w Author:p"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('aei', @code)"> >+ <z:index name="Title:w Title:p Title:s Title-cover:w Title-cover:p Title-cover:s"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('cd', @code)"> >+ <z:index name="Title:w Title:p"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> >+ </xslo:template> > <xslo:template mode="index_subfields" match="marc:datafield[@tag='700']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('3', @code)"> >@@ -1874,15 +1874,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:if> > </xslo:for-each> > </xslo:template> >- <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']"> >- <xslo:for-each select="marc:subfield"> >- <xslo:if test="contains('0', @code)"> >- <z:index name="totalissues:n totalissues:s"> >- <xslo:value-of select="."/> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- </xslo:template> > <xslo:template mode="index_subfields" match="marc:datafield[@tag='999']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('x', @code)"> >@@ -2542,13 +2533,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:value-of select="normalize-space($raw_heading)"/> > </z:index> > </xslo:template> >- <xslo:template mode="index_facets" match="marc:datafield[@tag='099']"> >- <xslo:if test="not(@ind1='z')"> >- <z:index name="ccode:0"> >- <xslo:value-of select="marc:subfield[@code='t']"/> >- </z:index> >- </xslo:if> >- </xslo:template> > <xslo:template mode="index_facets" match="marc:datafield[@tag='225']"> > <xslo:if test="not(@ind1='z')"> > <z:index name="se:0"> >@@ -2661,6 +2645,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </z:index> > </xslo:if> > </xslo:template> >+ <xslo:template mode="index_facets" match="marc:datafield[@tag='099']"> >+ <xslo:if test="not(@ind1='z')"> >+ <z:index name="itype:0"> >+ <xslo:value-of select="marc:subfield[@code='t']"/> >+ </z:index> >+ </xslo:if> >+ </xslo:template> > <xslo:template mode="index_facets" match="marc:datafield[@tag='995']"> > <xslo:if test="not(@ind1='z')"> > <z:index name="homebranch:0"> >@@ -2675,6 +2666,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <z:index name="ccode:0"> > <xslo:value-of select="marc:subfield[@code='h']"/> > </z:index> >+ <z:index name="itype:0"> >+ <xslo:value-of select="marc:subfield[@code='r']"/> >+ </z:index> > </xslo:if> > </xslo:template> > <xslo:template mode="index_all" match="text()"> >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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38336
:
178126
|
179007
|
182471
| 186392