[Koha-bugs] [Bug 21559] Rules for automatic framework codes

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Oct 19 16:56:28 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21559

--- Comment #7 from Cori Lynn Arnold <carnold at 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 at joensuu.fi>
Signed-off-by: Cori Lynn Arnold <carnold at dgiinc.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list