Bug 13912 - Add syspref for default place of publication (country code) for field 008, range 15-17
Summary: Add syspref for default place of publication (country code) for field 008, ra...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Josef Moravec
QA Contact: Tomás Cohen Arazi
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-26 07:37 UTC by Josef Moravec
Modified: 2017-10-27 12:34 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17 (5.88 KB, patch)
2015-03-26 07:48 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17, followup, repairs the broken link (2.72 KB, patch)
2015-03-26 08:17 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17 (5.87 KB, patch)
2015-03-26 09:36 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17, followup, repairs the broken link (2.76 KB, patch)
2015-03-26 09:37 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17 (5.91 KB, patch)
2015-03-26 13:04 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17, followup, repairs the broken link (2.80 KB, patch)
2015-03-26 13:04 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
[PASSED QA] Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17 (5.93 KB, patch)
2015-03-27 12:55 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17, followup, repairs the broken link (2.83 KB, patch)
2015-03-27 12:55 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 13912: Add DefaultCountryField008 syspref (5.23 KB, patch)
2017-09-07 19:26 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 13912: Fix LOC link (1.51 KB, patch)
2017-09-07 19:27 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 13912: (QA followup) Update database (1.34 KB, patch)
2017-09-07 19:27 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 13912: (QA followup) Make it explicit that syspref applies to MARC21 (4.55 KB, patch)
2017-09-20 13:53 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Josef Moravec 2015-03-26 07:37:25 UTC
The country code of place of publication is hardcoded to xxu (United States) in field 008 value builder. We should offer an option to change it.
Comment 1 Josef Moravec 2015-03-26 07:48:06 UTC Comment hidden (obsolete)
Comment 2 Josef Moravec 2015-03-26 07:54:13 UTC
Test plan:
1. Apply the patch
2. Go to Administration -> System preferences -> Cataloguing and check the section Record Structure has new preference DefaultCountryField008 and this preference is blank
3. Insert into DefaultCountryField008 some country code (e.g. xr for Czech Republic) and save
4. Go to Cataloguing module, make a new record in any framework, which has marc_field:008.pl value builder set for field 008 (it should be default)
5. Prove that your country code is preset in field 008, range 15-17
Comment 3 Josef Moravec 2015-03-26 08:17:29 UTC Comment hidden (obsolete)
Comment 4 Josef Moravec 2015-03-26 09:36:46 UTC Comment hidden (obsolete)
Comment 5 Josef Moravec 2015-03-26 09:37:04 UTC Comment hidden (obsolete)
Comment 6 sandboxes@biblibre.com 2015-03-26 13:04:13 UTC
Patch tested with a sandbox, by m23 <black23@gmail.com>
Comment 7 sandboxes@biblibre.com 2015-03-26 13:04:37 UTC Comment hidden (obsolete)
Comment 8 sandboxes@biblibre.com 2015-03-26 13:04:40 UTC Comment hidden (obsolete)
Comment 9 Kyle M Hall 2015-03-27 12:55:03 UTC
Created attachment 37313 [details] [review]
[PASSED QA] Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17

Signed-off-by: m23 <black23@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Kyle M Hall 2015-03-27 12:55:10 UTC
Created attachment 37314 [details] [review]
[PASSED QA] Bug 13912 - System preference for default place of publication (country code) for field 008, range 15-17, followup, repairs the broken link

Signed-off-by: m23 <black23@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Thomas Dukleth 2015-04-15 14:49:08 UTC
Tomás Cohen Arazi brought this bug to my attention with the concern that the currently proposed fix is MARC 21 specific and thus ignores implications for UNIMARC.  The more important issue is that the proposed fix sets a default value as the code for United States when left blank which would be the wrong value for far too many users.

1.  DEFAULT VALUE WHEN BLANK.

Given the international nature of the Koha project, it should always be considered unwise to set a default value for country code in a system wide preference even for those using English when the default value for country code is blank.  Even, a least effort patch should either have the value blank when the system preference is blank with a warning about the unset default value when checking system preferences and when invoking the related plugin for the record editor.

A greater effort patch would have the default system wide country of production for cataloguing set from a value list.  However, a default should be blank.  Requiring the user to set a default as part of a guided installation or upgrade would ameliorate the problem.   


2.  MARC DIFFERENCES.

Code for country of production (using a somewhat generic description) is a more complex problem for MARC 21 Bibliographic than for UNIMARC Bibliographic.


2.1.  BRIEF CONCLUSION.

Given the difference in the treatment for country of production between MARC 21 and UNIMARC, it seems reasonable to specify the system preference label more generically with the additional lablel note that the system preference only applies currently to MARC 21 with direction to UNIMARC users to adjust the default value for 102 $a, $b, or $c if they would choose to have a default value. 


2.2.  MARC 21.

In the case of MARC 21, the value needs to be set as a small part, positions 15 to 17 of fixed field 008 for which a Koha record editor plugin, such as marc21_field_008.pl http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=cataloguing/value_builder/marc21_field_008.pl;hb=HEAD , could be used to set the value as specified by a MARC 21 Koha MARC framework in `marc_subfield_structure`.`value_builder`.

Documentation for values is linked from http://www.loc.gov/marc/countries/ .  An HTML page with a simple list is at http://www.loc.gov/marc/countries/countries_code.html .  An XML file for automated processing is available at http://www.loc.gov/standards/codelists/countries.xml .


2.3.  UNIMARC.

In the case of UNIMARC, the value occupies a complete subfield for subfields of field 102.  As a consequence of using a complete subfield, a default value could be set for a UNIMARC Koha MARC framework in `marc_subfield_structure`.`defaultvalue`.  Similarly, as a consequence of using the complete subfield, a value list could be specified by a UNIMARC  Koha MARC framework in `marc_subfield_structure`.`authorised_value`. The French framework_DEFAULT.sql, http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=installer/data/mysql/fr-FR/marcflavour/unimarc_complet/Obligatoire/framework_DEFAULT.sql;hb=HEAD does not specify any default values for 102 $a, $b, or $c.

Despite the machine readable utility, the UNIMARC standard gives less importance to field 102 and does not specify it as a requirement in contrast to the requirement for full MARC 21 records to at least use 008 overall.

Documentation for values is linked from http://www.iso.org/iso/country_codes/country_codes .  Values could be parsed from the text contained in https://www.iso.org/obp/ui/#search/code/ .  Sadly, ISO charges fees for access to a proper machine readable version.  [Their general fee structure discourages the use of standards which should be opposite to the goal of any standards organisation.] 


2.4.  MARC NEUTRAL FIX.

A proper MARC neutral fix with some effort would set a default country of cataloguing for as a system wide preference.  Appropriate value lists would be included for MARC 21 or UNIMARC as needed.  The system preference would check the value of marcflavour setting for determining the value list used.  An appropriate plugin for MARC 21 or UNIMARC would use the appropriate value list.
Comment 12 Thomas Dukleth 2015-04-15 15:27:11 UTC
I should have added for both less ambiguous description and the MARC neutral aspect that `systempreferences`.`variable` should be something such as CountryOfProductionDefault or CountryOfProductionCodeDefault, but not DefaultCountryField008 as in the proposed fix.
Comment 13 Thomas Dukleth 2015-04-16 08:52:20 UTC
The proposed fix using $DefaultCountryField008 follows the somewhat less problematic example of $DefaultLanguageField008.


1.  CORRECTING HARD CODED CHOICES.

Already existing code has hard coded choices for both language of content and country of production in marc21_field_008.pl if no preference is specified, but we should not be perpetuating that mistake in a new patch.  Country also has a narrower scope and is thus more likely to be wrong if not specified than language.

If no preference has been set, the corresponding value should be empty by default or specified as an equivalent to "no attempt to code" where relevant.


2.  MARC NEUTRAL APPLICATION.

The proposed $DefaultCountryField008 follows the mistaken pattern of $DefaultLanguageField008 for the MARC 21 based description in `systempreferences`.`description`.  However, the same list of language codes for language of content applies to the current standard for both MARC 21 and UNIMARC $DefaultLanguageField008.  [There had been a few differences in language codes for the respective bibliographic standards from the 1990s and earlier.]  Consequently, a default specified in $DefaultLanguageField008 could be used equally for both MARC 21 and UNIMARC.

A more universal approach for specifying country of production could use a value list for country which would be a superset of country specifications from both the ISO 3166 Country Codes list and Library of Congress MARC Country Codes list.  The user could choose by the label for the country code in a manner independent of MARC and the appropriate code could be used based on the MARC standard specified in Koha $marcflavour.  Alas, I am uncertain, if I am prepared to do all the work which would be necessary for such a worthy goal along with related validation at the present time.


3.  KOHA MARC FRAMEWORK CENTRIC DEFAULT.

Tomás Cohen Arazi is interested in tying a default setting closer to the Koha MARC frameworks.  An advantage would be that the user could choose from different default values by choosing different frameworks which the user could create.

The difficulty of using `marc_subfield_structure`.`defaultvalue` is that fixed fields, such as MARC 21 008, would be difficult for users to encode as a default.  A plugin for the frameworks editor similar to one for the record editor could be used to populate default values for fixed fields in the frameworks.  [In the Koha MARC frameworks, MARC 21 fixed fields are managed as if they are subfield $0 of the respective fields.  UNIMARC fixed subfields are subfields which is unproblematic for the original design of the Koha MARC frameworks code.]

I am a little uncertain of the degree of debugging time required for plugins to work on framework values relative to my time.  I would be happy to have a more MARC neutral system preference for country of production at the present time in which the user would enter a value as in the proposed fix, but choosing from the linked documentation for MARC country code list for MARC 21 or the ISO 3166 code list for UNIMARC.  We could then file an enhancement bug for adding more granular defaults for fixed fields and fixed subfields associated with Koha MARC frameworks.
Comment 14 Tomás Cohen Arazi 2017-09-07 19:26:54 UTC
Created attachment 66963 [details] [review]
Bug 13912: Add DefaultCountryField008 syspref

This syspref is going to be used for populating field 008, range 15-17
with a desired default. It is currently hardcoded to 'xxu'. If not set,
it will still fallback to 'xxu'.

Signed-off-by: m23 <black23@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 15 Tomás Cohen Arazi 2017-09-07 19:27:03 UTC
Created attachment 66964 [details] [review]
Bug 13912: Fix LOC link

Signed-off-by: m23 <black23@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 16 Tomás Cohen Arazi 2017-09-07 19:27:10 UTC
Created attachment 66965 [details] [review]
Bug 13912: (QA followup) Update database

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 17 Jonathan Druart 2017-09-19 12:47:09 UTC
Why do we default to xxu?
There is no ref to "MARC21 only" in the pref description.
Comment 18 Tomás Cohen Arazi 2017-09-20 13:40:55 UTC
(In reply to Jonathan Druart from comment #17)
> Why do we default to xxu?

That's what the plugin does right now, it is preserving the current behaviour.

> There is no ref to "MARC21 only" in the pref description.

Yeah, missed it. Followup patch to be submitted within minutes
Comment 19 Tomás Cohen Arazi 2017-09-20 13:53:15 UTC
Created attachment 67235 [details] [review]
Bug 13912: (QA followup) Make it explicit that syspref applies to MARC21

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 20 Jonathan Druart 2017-09-29 20:17:11 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 21 Fridolin SOMERS 2017-10-27 12:34:35 UTC
Enhancement not pushed to 17.05.x