[Bug 29268] New: Query used in Koha::Biblio->get_marc_host is incorrect
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Bug ID: 29268 Summary: Query used in Koha::Biblio->get_marc_host is incorrect Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@ptfs-europe.com QA Contact: testopia@bugs.koha-community.org After digging through this some more in relation to bug 27507 and bug 11175 I have come to the conclusion that I think the searches performed by get_marc_host are too simplistic/incorrect. First of all, both the 773 field and $w subfield are repeatable.. so we need to iterate for subfields as well as the field. Secondly, I don't think the search for (RCI)CN is correct.. this is what would appear in the 773 of the child, not how the 001 would be constructed in the host. What I believe we really need to do is as follows: 1. Iterate through 773 fields. 2. Iterate through subfield w's and looks for one of the following: 1a. (RCI)Controlnumber where the RCI matches the OrgCode syspref 1b. Fully numeric Controlnumber 3. Once we've found the form we're expecting from above iterations (1a in preference to 1b if both exist) jump out of the loops. 3. Produce the search string 'control-number=Controlnumber' for 1b. or `control-number=Controlnumber AND rci=RCI` if 1a is found. It may also be helpful to add the `OR control-number=Controlnumber` search to 1a to account for cases where OrgCode was added to new children but was is missing from the host? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@helsinki.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |27507 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27507 [Bug 27507] Search host record using control number identifier / organization code -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=11175 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|27507 |20277 See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=25707 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20277 [Bug 20277] Link to host item doesn't work in analytical records if 773$a is present https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27507 [Bug 27507] Search host record using control number identifier / organization code -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|20277 |20310 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20277 [Bug 20277] Link to host item doesn't work in analytical records if 773$a is present https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20310 [Bug 20310] Article requests: Use details from the host record when submitting an article request on an analytic record without attached items -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also|https://bugs.koha-community |https://bugs.koha-community |.org/bugzilla3/show_bug.cgi |.org/bugzilla3/show_bug.cgi |?id=25707 |?id=27507 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Martin Renvoize from comment #0) Thx for digging :)
First of all, both the 773 field and $w subfield are repeatable.. so we need to iterate for subfields as well as the field.
That would not be too hard. Rearrange in a loop: my $w = $f->subfield('w') or next; if( $w =~ /^\($orgcode\)\s*(\d+)/i or $w =~ /^\d+/ ) {
Secondly, I don't think the search for (RCI)CN is correct.. this is what would appear in the 773 of the child, not how the 001 would be constructed in the host.
Not sure if you are right here. There are two tries in the code: $engine->simple_search_compat( 'Control-number='.$rcn, 0,1 ); We try with $rcn being a number only and $rcn including the orgcode too.
It may also be helpful to add the `OR control-number=Controlnumber` search to 1a to account for cases where OrgCode was added to new children but was is missing from the host?
What you mean, is what the code already does? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 --- Comment #2 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 127590 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127590&action=edit Bug 29268: Correct cni handling for get_marc_host This patch adds a new method for fetching an ordered list of search queries that can then be used to fetch a records host biblio. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127590|0 |1 is obsolete| | --- Comment #3 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 127591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127591&action=edit Bug 29268: Correct cni handling for get_marc_host This patch adds a new method for fetching an ordered list of search queries that can then be used to fetch a records host biblio. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@ptfs-europe |ity.org |.com -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- It took some leaps to work through this one... the host_record.t tests is failing for one case, but I'm not sure I understand the logic of what it's testing. In this change, we iterate through all 773 fields and their corresponding `w` subfields. We build an array of search options from this in order of most specific to least specific (our cni followed by any cni followed by just cn) searches.. we then execute these searches in order until we find one that has just a singular search match at which point we jump out of the loop and continue as we did before. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 koha-US bug tracker <bugzilla@koha-us.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@koha-us.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=16522 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |magnus@libriotech.no --- Comment #5 from Magnus Enger <magnus@libriotech.no> --- Is there a test plan for this, or is it just a question of running the affected tests? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27507 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27507 [Bug 27507] Search host record using control number identifier / organization code -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply --- Comment #6 from Magnus Enger <magnus@libriotech.no> --- $ git bz apply 29268 Bug 29268 - Query used in Koha::Biblio->get_marc_host is incorrect 127591 - Bug 29268: Correct cni handling for get_marc_host Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 29268: Correct cni handling for get_marc_host Using index info to reconstruct a base tree... M Koha/Biblio.pm M t/db_dependent/Koha/Biblio.t M t/db_dependent/Koha/Biblio/host_record.t Falling back to patching base and 3-way merge... Auto-merging t/db_dependent/Koha/Biblio/host_record.t Auto-merging t/db_dependent/Koha/Biblio.t CONFLICT (content): Merge conflict in t/db_dependent/Koha/Biblio.t Auto-merging Koha/Biblio.pm CONFLICT (content): Merge conflict in Koha/Biblio.pm error: Failed to merge in the changes. Patch failed at 0001 Bug 29268: Correct cni handling for get_marc_host hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-29268-Correct-cni-handling-for-getmarchost-k4WekE.patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29268 Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|martin.renvoize@ptfs-europe |koha-bugs@lists.koha-commun |.com |ity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org