[Bug 21559] New: Rules for automatic framework codes
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Bug ID: 21559 Summary: Rules for automatic framework codes Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: new feature Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: pasi.kallinen@joensuu.fi QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Allow setting rules in a system preference, what framework code should be automatically set for biblio, based on the MARC record fields. Does not affect anything if the MarcToFrameworkcodeAutoconvert system preference rules aren't used. The "Default" framework is always overridden, if the rules match, but some other framework chosen by you is always used. Explanation of the rule format: ------------------------------- The syspref is YAML, with a specific format: - <field> <value>: <frameworkcode> If the <field> in the record contains <value>, the <frameworkcode> is used for the record. <field> is one of: "xxx" (field xxx in the MARC record) "xxx/yy" (field xxx, character location yy) "xxx/yy-zz" (field xxx, character locations yy-zz) "xxx$v" (field xxx, subfield v) Fields can be combined with plus-sign, then the field values have plus-sign between them. The field-rules are checked in order from top to bottom, and the first rule with a matching value is used. If the (sub)field has been repeated in the MARC record, only the first matching (sub)field is checked. If none of the rules match, the framework code is not changed. Example: - 008/35-37 + 000/06: fin+a: BKSFIN - 000/06: a: BKS c: MU e: MP This would make record with 000/06 = "a" AND 008/35-37 = "fin" use the BKSFIN framework, and any other record with 000/06 = "a" use BKS, 000/06 = "c" would be MU, and 000/06 = "e" would give MP -- 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=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |pasi.kallinen@joensuu.fi |ity.org | -- 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=21559 --- Comment #1 from paxed <pasi.kallinen@joensuu.fi> --- Created attachment 80462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80462&action=edit Bug 21559: Rules for automatic framework codes Allow setting rules in a system preference, what framework code should be automatically set for biblio, based on the MARC record fields. Does not affect anything if the MarcToFrameworkcodeAutoconvert system preference rules aren't used. The "Default" framework is always overridden, if the rules match, but some other framework chosen by you is always used. Test plan: ---------- 0) Apply patch, apply the atomicupdate, etc. 1) Go to cataloguing, and import a record without choosing a framework. note how the framework is set to "Default". 2) Bulkmarcimport some records. Check the framework codes for the imported records - they're all "default". 3) Set the following rules in MarcToFrameworkcodeAutoconvert syspref: - 000/06: a: BKS c: SR m: CF This rule sets framework code to 'BKS' if 000/06 is 'a', etc. 4) Repeat 1 and 2, the frameworkcodes should be something else than default, if the record 000/06 was one of 'a', 'c', or 'm'. 5) Go to cataloguing, and import a record, but choose some specific framework - note how the framework you chose is kept, even if the record would match the syspref rules. 6) Repeat 5, but create a new record from scratch. Framework you chose should override the syspref rules. 7) Bulkmarcimport some record, but give the framework-parameter. The framework you chose should override the syspref rules. 8) prove t/Biblio/AutoFrameworkcode.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |ASSIGNED --- Comment #2 from paxed <pasi.kallinen@joensuu.fi> --- Whoops, a thinko in the patch, will fix on Monday... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80462|0 |1 is obsolete| | --- Comment #3 from paxed <pasi.kallinen@joensuu.fi> --- Created attachment 80586 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80586&action=edit Bug 21559: Rules for automatic framework codes Allow setting rules in a system preference, what framework code should be automatically set for biblio, based on the MARC record fields. Does not affect anything if the MarcToFrameworkcodeAutoconvert system preference rules aren't used. The "Default" framework is always overridden, if the rules match, but some other framework chosen by you is always used. Test plan: ---------- 0) Apply patch, apply the atomicupdate, etc. 1) Go to cataloguing, and import a record without choosing a framework. note how the framework is set to "Default". 2) Bulkmarcimport some records. Check the framework codes for the imported records - they're all "default". 3) Set the following rules in MarcToFrameworkcodeAutoconvert syspref: - 000/06: a: BKS c: SR m: CF This rule sets framework code to 'BKS' if 000/06 is 'a', etc. 4) Repeat 1 and 2, the frameworkcodes should be something else than default, if the record 000/06 was one of 'a', 'c', or 'm'. 5) Go to cataloguing, and import a record, but choose some specific framework - note how the framework you chose is kept, even if the record would match the syspref rules. 6) Repeat 5, but create a new record from scratch. Framework you chose should override the syspref rules. 7) Bulkmarcimport some record, but give the framework-parameter. The framework you chose should override the syspref rules. 8) prove t/Biblio/AutoFrameworkcode.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80586|0 |1 is obsolete| | --- Comment #4 from paxed <pasi.kallinen@joensuu.fi> --- Created attachment 80587 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80587&action=edit Bug 21559: Rules for automatic framework codes Allow setting rules in a system preference, what framework code should be automatically set for biblio, based on the MARC record fields. Does not affect anything if the MarcToFrameworkcodeAutoconvert system preference rules aren't used. The "Default" framework is always overridden, if the rules match, but some other framework chosen by you is always used. Test plan: ---------- 0) Apply patch, apply the atomicupdate, etc. 1) Go to cataloguing, and import a record without choosing a framework. note how the framework is set to "Default". 2) Bulkmarcimport some records. Check the framework codes for the imported records - they're all "default". 3) Set the following rules in MarcToFrameworkcodeAutoconvert syspref: - 000/06: a: BKS c: SR m: CF This rule sets framework code to 'BKS' if 000/06 is 'a', etc. 4) Repeat 1 and 2, the frameworkcodes should be something else than default, if the record 000/06 was one of 'a', 'c', or 'm'. 5) Go to cataloguing, and import a record, but choose some specific framework - note how the framework you chose is kept, even if the record would match the syspref rules. 6) Repeat 5, but create a new record from scratch. Framework you chose should override the syspref rules. 7) Bulkmarcimport some record, but give the framework-parameter. The framework you chose should override the syspref rules. 8) prove t/Biblio/AutoFrameworkcode.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Cori Lynn Arnold <carnold@dgiinc.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |carnold@dgiinc.com Status|Needs Signoff |Failed QA --- Comment #5 from Cori Lynn Arnold <carnold@dgiinc.com> --- Failed to apply :( Bug 21559 - Rules for automatic framework codes 80587 - Bug 21559: Rules for automatic framework codes Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 21559: Rules for automatic frameworkcodes Using index info to reconstruct a base tree... M C4/Biblio.pm M cataloguing/addbiblio.pl Falling back to patching base and 3-way merge... Auto-merging cataloguing/addbiblio.pl Auto-merging C4/Biblio.pm CONFLICT (content): Merge conflict in C4/Biblio.pm error: Failed to merge in the changes. Patch failed at 0001 Bug 21559: Rules for automatic frameworkcodes The copy of the patch that failed is found in: .git/rebase-apply/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-21559-Rules-for-automatic-framework-codes-L_HoL6.patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80587|0 |1 is obsolete| | --- Comment #6 from paxed <pasi.kallinen@joensuu.fi> --- Created attachment 80798 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80798&action=edit Bug 21559: Rules for automatic framework codes Allow setting rules in a system preference, what framework code should be automatically set for biblio, based on the MARC record fields. Does not affect anything if the MarcToFrameworkcodeAutoconvert system preference rules aren't used. The "Default" framework is always overridden, if the rules match, but some other framework chosen by you is always used. Test plan: ---------- 0) Apply patch, apply the atomicupdate, etc. 1) Go to cataloguing, and import a record without choosing a framework. note how the framework is set to "Default". 2) Bulkmarcimport some records. Check the framework codes for the imported records - they're all "default". 3) Set the following rules in MarcToFrameworkcodeAutoconvert syspref: - 000/06: a: BKS c: SR m: CF This rule sets framework code to 'BKS' if 000/06 is 'a', etc. 4) Repeat 1 and 2, the frameworkcodes should be something else than default, if the record 000/06 was one of 'a', 'c', or 'm'. 5) Go to cataloguing, and import a record, but choose some specific framework - note how the framework you chose is kept, even if the record would match the syspref rules. 6) Repeat 5, but create a new record from scratch. Framework you chose should override the syspref rules. 7) Bulkmarcimport some record, but give the framework-parameter. The framework you chose should override the syspref rules. 8) prove t/Biblio/AutoFrameworkcode.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Cori Lynn Arnold <carnold@dgiinc.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 --- Comment #7 from Cori Lynn Arnold <carnold@dgiinc.com> --- Created attachment 80939 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80939&action=edit Bug 21559: Rules for automatic frameworkcodes Allow setting rules in a system preference, what framework code should be automatically set for biblio, based on the MARC record fields. Does not affect anything if the MarcToFrameworkcodeAutoconvert system preference rules aren't used. The "Default" framework is always overridden, if the rules match, but some other framework chosen by you is always used. Test plan: ---------- 0) Apply patch, apply the atomicupdate, etc. 1) Go to cataloguing, and import a record without choosing a framework. note how the framework is set to "Default". 2) Bulkmarcimport some records. Check the framework codes for the imported records - they're all "default". 3) Set the following rules in MarcToFrameworkcodeAutoconvert syspref: - 000/06: a: BKS c: SR m: CF This rule sets framework code to 'BKS' if 000/06 is 'a', etc. 4) Repeat 1 and 2, the frameworkcodes should be something else than default, if the record 000/06 was one of 'a', 'c', or 'm'. 5) Go to cataloguing, and import a record, but choose some specific framework - note how the framework you chose is kept, even if the record would match the syspref rules. 6) Repeat 5, but create a new record from scratch. Framework you chose should override the syspref rules. 7) Bulkmarcimport some record, but give the framework-parameter. The framework you chose should override the syspref rules. 8) prove t/Biblio/AutoFrameworkcode.t Explanation of the rule format: ------------------------------- The syspref is YAML, with a specific format: - <field> <value>: <frameworkcode> If the <field> in the record contains <value>, the <frameworkcode> is used for the record. <field> is one of: "xxx" (field xxx in the MARC record) "xxx/yy" (field xxx, character location yy) "xxx/yy-zz" (field xxx, character locations yy-zz) "xxx$v" (field xxx, subfield v) Fields can be combined with plus-sign, then the field values have plus-sign between them. The field-rules are checked in order from top to bottom, and the first rule with a matching value is used. If the (sub)field has been repeated in the MARC record, only the first matching (sub)field is checked. If none of the rules match, the framework code is not changed. Example: - 008/35-37 + 000/06: fin+a: BKSFIN - 000/06: a: BKS c: MU e: MP This would make record with 000/06 = "a" AND 008/35-37 = "fin" use the BKSFIN framework, and any other record with 000/06 = "a" use BKS, 000/06 = "c" would be MU, and 000/06 = "e" would give MP. Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi> Signed-off-by: Cori Lynn Arnold <carnold@dgiinc.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Cori Lynn Arnold <carnold@dgiinc.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80798|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de, | |tomascohen@gmail.com --- Comment #8 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Paxed, some first QA notes: 1) There is a fail from the QA tools: FAIL t/Biblio/AutoFrameworkcode.t FAIL critic "return" statement with explicit "undef" at line 47, column 9. See page 199 of PBP. 2) I think the system preference description would be more helpful with some a hint at documentation. I was wondering if a link to the manual would work, but maintaining the link to always link to the current manual would not be so nice. Maybe adding some more hints to the preference description for now? I am a bit concerned that this adds a lot of code in the "old style" to C4::Biblio. Specifically: GetAutoFrameworkCode,_matchRecordFieldspec. Not sure how much we have in place yet in Koha for dealing with records. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Status|Signed Off |Failed QA --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> ---
I am a bit concerned that this adds a lot of code in the "old style" to C4::Biblio. Specifically: GetAutoFrameworkCode,_matchRecordFieldspec. Not sure how much we have in place yet in Koha for dealing with records.
Agreed. Those new subroutines can and should be moved to Koha::Biblio with minimal effort. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 --- Comment #10 from paxed <pasi.kallinen@koha-suomi.fi> --- Moving the _matchRecordFieldSpec and GetAutoFrameworkCode to Koha/Biblio.pm is the easy part. But then AddBiblio has to be rewritten. Unless there's a way to get a Koha::Biblio object without having the record in the database? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to paxed from comment #10)
Moving the _matchRecordFieldSpec and GetAutoFrameworkCode to Koha/Biblio.pm is the easy part. But then AddBiblio has to be rewritten. Unless there's a way to get a Koha::Biblio object without having the record in the database?
Koha::Biblio->new({ attr1 => val1, ... }); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Marjorie Barry-Vila <marjorie.barry-vila@collecto.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marjorie.barry-vila@collect | |o.ca -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 --- Comment #12 from paxed <pasi.kallinen@koha-suomi.fi> --- (In reply to Tomás Cohen Arazi from comment #11)
(In reply to paxed from comment #10)
Moving the _matchRecordFieldSpec and GetAutoFrameworkCode to Koha/Biblio.pm is the easy part. But then AddBiblio has to be rewritten. Unless there's a way to get a Koha::Biblio object without having the record in the database?
Koha::Biblio->new({ attr1 => val1, ... });
How do I set the metadata->record using this way? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Kati Sillgren <kati.sillgren@porvoo.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kati.sillgren@porvoo.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Kati Sillgren <kati.sillgren@porvoo.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|Main |unspecified -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559 Kati Sillgren <kati.sillgren@porvoo.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |Main -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org