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.
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 |||
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
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>
Works as expected and provides a more sane default. Signing off.