Bug 27738 - Set fallback for unset DefaultCountryField008 to |||, "no attempt to code"
Summary: Set fallback for unset DefaultCountryField008 to |||, "no attempt to code"
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Phil Ringnalda
QA Contact: Testopia
URL:
Keywords:
Depends on: 13912
Blocks: 27739
  Show dependency treegraph
 
Reported: 2021-02-21 17:06 UTC by Phil Ringnalda
Modified: 2021-02-22 09:03 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 27738: Set fallback for unset DefaultCountryField008 to |||, "no attempt to code" (2.86 KB, patch)
2021-02-21 18:56 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 27738: Set fallback for unset DefaultCountryField008 to |||, "no attempt to code" (2.93 KB, patch)
2021-02-22 09:01 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Ringnalda 2021-02-21 17:06:43 UTC
Bug 13912 added DefaultCountryField008 to allow defaulting the place of publication to something other than the previous default of xxu ("somewhere in the  United States, but I don't know what state"). Trying to follow the Koha Way of never changing existing behavior, only adding a preference to fix it, it intended to fall back to xxu, but https://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=cataloguing/value_builder/marc21_field_008.pl;h=b3c5d0c47f908edaa376b397a3bae5ecf8013c9e;hb=HEAD#l80 thought the preference would be undefined if it wasn't set, and then a QA followup updated the DB to add it so it's always defined, and the // "xxu" is unreached and the default value of the pref, '', gets space-padded to three characters long, '   '.

Since we've now gone 3.3 years with the default having switched from the unfortunate choice of 'xxu' to the invalid '   ' without anyone filing a bug about it, I assert that the Koha Way is wrong in this case, that nobody actually wanted to retain the behavior of defaulting to saying that every book was published in an unknown US state (or if they did exist, they already fixed it by using that as their DefaultCountryField008), and we can fix the bug of defaulting to an invalid value by choosing a new default when DefaultCountryField008 isn't set, the value "|||" which is "no attempt to code" which is precisely the case when the cataloger doesn't change it and the system adminstrator doesn't say it should have a particular value whether or not that value is correct.
Comment 1 Phil Ringnalda 2021-02-21 18:56:08 UTC
Created attachment 117126 [details] [review]
Bug 27738: Set fallback for unset DefaultCountryField008 to |||, "no attempt to code"

Current code intended to set a fallback of xxu, an unknown state in the US,
but because the preference is always defined, just sometimes unset, it
actually falls back to three spaces, an invalid value. This patch instead
uses the fallback value ||| which means no attempt to code.

Test plan:
1. Without the patch, verify that the value of the system preference
DefaultCountryField008 is empty.
2. Cataloging - New record - Default framework (if you have the Advanced
editor enabled, Settings - Switch to basic editor, this only applies to the
basic editor)
3. On tab 0, click in the text input for field 008 which fills in default
values, then click the Tag editor button at the end of the field
4. In the popup window, verify that the value for 15-17 is shown as ###
indicating three spaces
5. Apply patch, repeat the steps above, verify that the value is now |||
Comment 2 Phil Ringnalda 2021-02-21 19:01:07 UTC
Bah, forgot the last two steps,

6. Set DefaultCountryField008 to abc
7. Repeat steps 2-3 and verify that the value for 15-17 is abc
Comment 3 Martin Renvoize 2021-02-22 09:01:52 UTC
Created attachment 117134 [details] [review]
Bug 27738: Set fallback for unset DefaultCountryField008 to |||, "no attempt to code"

Current code intended to set a fallback of xxu, an unknown state in the US,
but because the preference is always defined, just sometimes unset, it
actually falls back to three spaces, an invalid value. This patch instead
uses the fallback value ||| which means no attempt to code.

Test plan:
1. Without the patch, verify that the value of the system preference
DefaultCountryField008 is empty.
2. Cataloging - New record - Default framework (if you have the Advanced
editor enabled, Settings - Switch to basic editor, this only applies to the
basic editor)
3. On tab 0, click in the text input for field 008 which fills in default
values, then click the Tag editor button at the end of the field
4. In the popup window, verify that the value for 15-17 is shown as ###
indicating three spaces
5. Apply patch, repeat the steps above, verify that the value is now |||

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2021-02-22 09:03:55 UTC
Works as expected and provides a more sane default.  Signing off.