Bug 31608 - ShowComponentRecords doesn't display components if UseControlNumber is turned on
Summary: ShowComponentRecords doesn't display components if UseControlNumber is turned on
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 11175
Blocks:
  Show dependency treegraph
 
Reported: 2022-09-22 19:54 UTC by Caroline Cyr La Rose
Modified: 2025-05-21 14:23 UTC (History)
5 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2022-09-22 19:54:06 UTC
I apologize if this is a duplicate. 

I'm trying to document the new Components feature, but I'm running into problems when using UseControlNumber. In Bug 30327, the test plan mentions that UseControlNumber can be used or not, but from what I can see, ShowComponentRecords does not work with UseControlNumber.

To test:
1. Enable ShowComponentRecords
1.1. Go to Administration > Global system preferences
1.2. Search for ShowComponentRecords
1.3. Choose either staff interface or both
1.4. Save

2. Enable UseControlNumber
2.1. Go to Administration > Global system preferences
2.2. Search for UseControlNumber
2.3. Choose 'Use'
2.4. Save

3. Add 773 $t and $w in the default MARC bibliographic framework
3.1. Go to Administration > MARC bibliographic framework  
3.2. Click Actions > MARC structure next to Default framework
3.3. Search for 773
3.4. Click Actions > Edit subfields
3.5. Click on tab 't'
3.6. Check 'Editor' in the 'Advanced constraints' section
3.7. Click on tab 'w'
3.8. Check 'Editor' in the 'Advanced constraints' section

4. Catalog a host record
4.1. Go to Cataloging 
4.2. Click on 'New record'
4.3. Fill in the mandatory fields (000, 003, 005, 008, 040$c, 245$a (note this one down), 942$c)
4.4. Enter a number in 001 (and note it down)
4.5. Save
(no need to create an item)

5. Catalog a child record
5.1. Go to Cataloging 
5.2. Click on 'New record'
5.3. Fill in the mandatory fields (000, 003, 005, 008, 040$c, 245$a, 942$c)
5.4. Fill in 773$a with the title (245$a) of the host record
5.5. Fill in 773$w with the control number (001) of the host record
5.6. Save
(no need to create an item)

6. If necessary, reindex
7. Go to the host record
   --> The child record doesn't appear
8. Change UseControlNumber back to Don't use (steps 2)
   --> The child record appears
Comment 1 Katrin Fischer 2022-09-23 14:04:15 UTC
Hi Caroline, same issue with Elasticsearch/Zebra?
Comment 2 Caroline Cyr La Rose 2022-09-23 14:46:16 UTC
(In reply to Katrin Fischer from comment #1)
> Hi Caroline, same issue with Elasticsearch/Zebra?

I did this with ES on my local installation and with Zebra on a BW sandbox.
Comment 3 Katrin Fischer 2022-11-16 23:10:35 UTC
Hi Caroline, do you still happen to know were you were testing? If it was an updated installation, the cnr index might have been missing as it's not added on update for Elasticsearch.
Comment 4 Magnus Enger 2023-11-20 12:45:10 UTC
So the question then is perhaps if this was never implemented with UseControlNumber, or if it was implemented and some bug snuck in and made it not work any more? 

In t/db_dependent/Koha/Biblio.t there is a set of subtests labeled "get_components_query", which seems to be testing with UseControlNumber both off and on. And the tests pass. 

The original bug 11175 has this patch: 
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=126882
"Taking the code in bug 15851 as inspiration this patch also adds proper
handling for UseControlNumber vs EasyAnalytics style 773 linking and
ensures we only return analytic component parts and no other records
containing 773's."

Sounds to me like it should work. I'm changing this from "enh" to "normal bug".
Comment 5 Katrin Fischer 2024-04-01 14:13:22 UTC
It should work if a library is using control-numbers for linking, I am pretty sure I tested this.
Needs some more testing I think to see where the problem is.

@Caroline: did you check on the existence of the cnr index in your installation?
Comment 6 Esther Melander 2024-06-10 17:35:26 UTC
ShowComponentRecords appeared to be working in 23.05 but does not seem to be working in 23.11. 

To replicate:

1. Ensure the 773 tag is available in the framework.
2. Ensure the system preference EasyAnalyticalRecords is set to don't show
3. Ensure UseControlNumber is set to use.
4. Configure ShowComponentRecords for staff interface
4. Add a serial record, ensure the Leader space 7 is a serial.
5. From the new serial record, Edit - Add new child record.
6. Add the child record and ensure the 773 $w has the 001 control number from the host/parent record. Also ensure the Leader space 7 is a serial component part.
7. Add another child record.

The child record should have an "In: Serial Title" link in the bibliographic record detail view. Click on this link to return to the parent record.

See that the Component tab is missing from the holdings table of the parent record.
Comment 7 Magnus Enger 2024-09-18 06:32:16 UTC
Just confirmed this on 23.05.12. Turning off UseControlNumber makes the "Components" tab show in staff detail view.
Comment 8 Lari Taskula 2024-09-19 19:49:14 UTC
It works in 24.05 and Elasticsearch.

First off, when UseControlNumber is enabled and host record has both 001 and 003 filled in, the component records are loaded into the host record by the following search query:

(((rcn:"Host001" AND cni:"Host003") OR rcn:"Host003 Host001") AND (bib-level:a OR bib-level:b))

For example:
(((rcn:"011193623" AND cni:"FI-MELINDA") OR rcn:"FI-MELINDA 011193623") AND (bib-level:a OR bib-level:b))

If you are having problems displaying the component records with UseControlNumber and ShowComponentRecords on, try narrowing down the problem by first searching:
((rcn:"Host001" AND cni:"Host003") OR rcn:"Host003 Host001")

(fill in Host001 and Host003 values)

If you get no results, then it could be that the child 773$w != host 001 or child 003 != host 003. If they are correct and you still get no results with the narrowed down query, check your Elastic mappings for rcn and cni.

On the other hand if you do get the component records as results, then your child's leader character position 7 is not really "a" or "b".

Leader's pop-up editor can be misleading when viewing the values.

To reproduce:
1. Click "New child record" from the host
2. Fill in other mandatory fields but do not touch the leader
3. Save the child record
4. Edit the child record
5. Edit the leader
6. Observe 7- Bibliographic level shown as "a"
7. Close leader (do not save) editor pop-up
8. Count leader characters manually until position 7 (starting from 0)
9. Observe it being empty!

This can be very misleading and is caused by "a" being the default select option.

So you always have to edit the leader manually for it to work, or use a different MARC framework with default values for component records.

Enhancement: Could "New child record" button automatically populate char position 7 of the child to avoid this problem? In fact I assumed this was already the case but it seems it is not.

Checklist:
- UseControlNumber ON
- ShowComponentRecords ON
- Make sure rcn (record-control-number => 773w) and cni (control-number-identifier 003) are mapped in Elastic mappings (bibliographic records tab)
- Host 001 and child 773$w are equal
- Host 003 and child 003 are equal
- Child's leader character position 7 is truly "a" or "b" (count character positions manually - do not trust the editor's drop-down value).

Keeping these things in mind it should work in 24.05.