Bug 21469 - Account for 'MarcOrgCode' preference in 'Enhanced Analytics Workflow'
Summary: Account for 'MarcOrgCode' preference in 'Enhanced Analytics Workflow'
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL: https://wiki.koha-community.org/wiki/...
Keywords:
Depends on: 28830
Blocks: 34482
  Show dependency treegraph
 
Reported: 2018-10-02 09:22 UTC by Martin Renvoize (ashimema)
Modified: 2025-05-12 18:15 UTC (History)
8 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
Bug 21469: Add 003 into 773$w when required (1.42 KB, patch)
2021-09-02 11:12 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 21469: Add 003 into 773$w when required (1.86 KB, patch)
2021-09-02 11:20 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 21469: Add 003 into 773$w when required (1.83 KB, patch)
2024-06-28 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2018-10-02 09:22:13 UTC
Whilst working through bug 11175 I was reminded of our inconsistent use of useControlNumber and it's lack of accounting for 003 fields.
Comment 1 Martin Renvoize (ashimema) 2021-08-06 06:44:27 UTC
With the introduction of the ability to search using 003 as part of the query for analytics, we should account for this in the cataloguing workflow.

We should check for the presence of 'MarcOrgCode' being defined (at library or system level) and if it is being used we should copy the value of the 003 of the parent record into the constructed 773.
Comment 2 Katrin Fischer 2021-08-07 14:01:33 UTC
This makes sense, but I think we need a depends on for the bug adding the 003 index?
Comment 3 Martin Renvoize (ashimema) 2021-09-02 11:12:00 UTC
Created attachment 124426 [details] [review]
Bug 21469: Add 003 into 773$w when required

This patch looks at the MarcOrgCode preference and if present it will
prepend the host 003 data in brackets to the 773$w link field in the
child record.
Comment 4 Martin Renvoize (ashimema) 2021-09-02 11:20:41 UTC
Created attachment 124427 [details] [review]
Bug 21469: Add 003 into 773$w when required

This patch looks at the MarcOrgCode preference and if present it will
prepend the host 003 data in brackets to the 773$w link field in the
child record.
Comment 5 Martin Renvoize (ashimema) 2021-09-02 11:23:16 UTC
I'd love your help with writing a test plan for this Katrin..

I think it should work as expected, but I'm not even actually sure if we need to bind it on the presence of MARCOrgCodes being defined.. we might actually be OK just always prepending 003 if/when it's present in the host record.
Comment 6 Martin Renvoize (ashimema) 2024-06-28 16:00:12 UTC
Created attachment 168272 [details] [review]
Bug 21469: Add 003 into 773$w when required

This patch looks at the MarcOrgCode preference and if present it will
prepend the host 003 data in brackets to the 773$w link field in the
child record.
Comment 7 Katrin Fischer 2024-06-28 17:07:42 UTC
Is this to add the MARCOrgCode to 773 when using the "Add analytics" button in the cataloguing editor? Sorry, slightly confused right now again by our analytics :)

Not related to this, but wondering from looking at the patch: Shouldn't the 11 here not be 111?
if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) {
Comment 8 Martin Renvoize (ashimema) 2024-07-01 08:08:11 UTC
Haha, that 11 instead of 111 may well have been you in bug 6831. I didn't change it here.
Comment 9 Martin Renvoize (ashimema) 2024-07-01 08:11:47 UTC
This is around the 'UseControlNumber' and 'Enhanced workflow' stuff.

It's all related to the work we were doing around the time in 2018 and 2021 to try and clarify and improve the 003 + 001 MARC linking stuff.
Comment 10 Katrin Fischer 2024-07-01 11:38:43 UTC
I just couldn't wrap my mind around it first time, I will try again a little later. Thanks for the patch!
Comment 11 Martin Renvoize (ashimema) 2025-01-07 14:02:11 UTC
Another 5 months on...
Comment 12 Heather Hernandez 2025-01-07 16:28:27 UTC
I just found out about this bug thanks to ashimema on Mattermost!!  It's great!

I think this bug should refer to https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34482 , " Improve MARC21 7xx linking fields in bibliographic records [Omnibus]."

And the formatting could be corrected, c.f. the correctly formatted examples in the  MARC21 format for the 773 field, https://www.loc.gov/marc/bibliographic/bd773.html  So rather than prepending the data from the 003 in brackets, it should be in parentheses.  And depending on the source code in the 003, there are differences, e.g.:

OCLC records (yes, tons of libraries don't use OCLC, but as the largest source of bibliographic records in the world, there are a lot of OCLC records out there!):
A child record such as this one:
https://keys.bywatersolutions.com/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=36264
Generated from a parent record such as this one:
https://keys.bywatersolutions.com/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=41131
Needs the alphabetic characters preceeding the OCLC number in from the 001 field stripped if they are present.  More information on OCLC number formatting in 001 fields over time is here: https://help.oclc.org/Metadata_Services/WorldShare_Collection_Manager/Data_sync_collections/Prepare_your_data/30035_field_and_OCLC_control_numbers

DLC records would need spacing respected (corrected?), c.f. the examples in the MARC21 format.

I would like to be able to sign off on this bug when it's ready, but I'm not really seeing a test plan yet--are y'all still working on it, ashimema & Katrin?

Tx!
h2
Comment 13 Laura Escamilla 2025-04-29 15:34:37 UTC
Please add a test plan! Moving this one over to Failed QA for now.
Comment 14 Martin Renvoize (ashimema) 2025-05-06 13:35:52 UTC
The test plan is really just about reading the code and agreeing to the construction of the 773$w subfield from the parent record based on the preferences passed.
Comment 15 Martin Renvoize (ashimema) 2025-05-06 13:41:04 UTC
Test plan
1) Set UseControlNumber system preference
2) Ensure you have set both 001 and 003 on a host record
3) Attempt to add a child record via 'New > New Child Record'
4) Navigate to the 7xx tab on the resulting catalog editor and confirm the 773$w looks as you would expect given the host records 001 and 003 content.
Comment 16 Martin Renvoize (ashimema) 2025-05-06 13:46:32 UTC
Worth noting, bug 39545 also adds 003 handling in it's mix of additions (without explicitly mentioning it as part of the scope there).  It does not however, take account of the MarcOrgCode preference and instead opts to always add 003 content if present in the parent record.. The approach here will NOT add prepend 003 to the 001 if the MarcOrgCode preference is not set (at either global or library level)
Comment 17 Lin Wei 2025-05-12 18:07:40 UTC
# Test Execution

1. Apply patch.
2. Apache server crashes with error 500.
Comment 18 Lin Wei 2025-05-12 18:15:05 UTC
# Test Results

I could not get this to work.

# Test Execution

1. Apply patch.
2. Apache crashes for both OPAC and Intranet: 500 Internal Server Error. See [Logs] below.

# Additional Notes

- I am keeping the status as "Needs Signoff."
- This patch might be a duplicate of Bug 37061.

# Logs

[...]
Fri May 09 15:15:45.927753 2025] [cgid:error] [pid 53913] [client 127.0.0.1:55214] End of script output before headers: opac-search.pl, referer: http://master/cgi-bin/koha/opac-readingrecord.pl
[Fri May 09 15:15:46.752727 2025] [cgid:error] [pid 53913] [client 127.0.0.1:55214] End of script output before headers: 500.pl, referer: http://master/cgi-bin/koha/opac-readingrecord.pl
[Mon May 12 13:55:23.963501 2025] [cgid:error] [pid 43434] [client 127.0.0.1:54222] End of script output before headers: opac-main.pl, referer: http://master/cgi-bin/koha/opac-user.pl
[Mon May 12 13:55:24.608587 2025] [cgid:error] [pid 43434] [client 127.0.0.1:54222] End of script output before headers: 500.pl, referer: http://master/cgi-bin/koha/opac-user.pl
[Mon May 12 13:55:25.269379 2025] [cgid:error] [pid 43437] [client 127.0.0.1:54232] End of script output before headers: 404.pl, referer: http://master/cgi-bin/koha/opac-main.pl