From 55d1e68024aabbbb36855e23718df0857f2af185 Mon Sep 17 00:00:00 2001 From: Roch D'Amour Date: Wed, 21 Feb 2018 10:55:35 -0500 Subject: [PATCH] Bug 13412: Allow configuration of auto-created authorities MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch add 2 new system preferences: - GenerateAuthorityField667 - GenerateAuthorityField670 When Koha creates authority records from biblios, use these preferences instead of the hard-coded "Machine generated authority record." and "Work cat." values. Test plan: 1. Make sure AutoCreateAuthorities and BiblioAddsAuthorities are enabled in the system preferences 2. Go to Home › Cataloging › Add MARC record and add a new record 3. Fill in the required fields and add a name in the 100$a field. Note the name, and add the new record. 4. run rebuild_zebra.pl -a 5. Go to Home › Authorities and search for the name you entered in 100$a 6. Select details and look at the 667 and 670 fields. They should default to the hard-coded values. 7. Apply patch, run update database 8. Edit the new GenerateAuthorityField667 and GenerateAuthorityField670 system preferences 9. Do 2-6 . Now the 667 and 670 fields should be what you entered in the system preferences. Thanks for testing Signed-off-by: Bernardo Gonzalez Kriegel Works well, no errors Signed-off-by: Katrin Fischer Signed-off-by: Fridolin Somers --- C4/Biblio.pm | 4 ++-- .../bug_13412-add_GenerateAuthorityField_syspref.sql | 3 +++ installer/data/mysql/mandatory/sysprefs.sql | 2 ++ .../en/modules/admin/preferences/authorities.pref | 12 ++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_13412-add_GenerateAuthorityField_syspref.sql diff --git a/C4/Biblio.pm b/C4/Biblio.pm index de4b48ab47..f10f7b4754 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -703,7 +703,7 @@ sub LinkBibHeadingsToAuthorities { $marcrecordauth->insert_fields_ordered( MARC::Field->new( '667', '', '', - 'a' => "Machine generated authority record." + 'a' => C4::Context->preference('GenerateAuthorityField667') ) ); my $cite = @@ -713,7 +713,7 @@ sub LinkBibHeadingsToAuthorities { $cite =~ s/^[\s\,]*//; $cite =~ s/[\s\,]*$//; $cite = - "Work cat.: (" + C4::Context->preference('GenerateAuthorityField670') . ": (" . ( $library ? $library->get_effective_marcorgcode : C4::Context->preference('MARCOrgCode') ) . ")" . $bib->subfield( '999', 'c' ) . ": " . $cite; diff --git a/installer/data/mysql/atomicupdate/bug_13412-add_GenerateAuthorityField_syspref.sql b/installer/data/mysql/atomicupdate/bug_13412-add_GenerateAuthorityField_syspref.sql new file mode 100644 index 0000000000..f4c5ec7588 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_13412-add_GenerateAuthorityField_syspref.sql @@ -0,0 +1,3 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +( 'GenerateAuthorityField667', 'Machine generated authority record', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records', 'free' ), +( 'GenerateAuthorityField670', 'Work cat.', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 670$a field of MARC21 records', 'free' ) diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 11f03ec24d..8abdc95041 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -231,6 +231,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), ('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'), ('TaxRates','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'), +('GenerateAuthorityField667', 'Machine generated authority record', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records', 'free'), +('GenerateAuthorityField670', 'Work cat.', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 670$a field of MARC21 records', 'free'), ('GoogleJackets','0',NULL,'if ON, displays jacket covers from Google Books API','YesNo'), ('GoogleOpenIDConnect', '0', NULL, 'if ON, allows the use of Google OpenID Connect for login', 'YesNo'), ('GoogleOAuth2ClientID', '', NULL, 'Client ID for the web app registered with Google', 'Free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref index 80e8ee1292..d7ba7c024e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref @@ -63,6 +63,18 @@ Authorities: "loose": loose "strict": strict - mode. In strict mode subfields that are not found in the authority record, are deleted. Loose mode will keep them. Loose mode is the historical behavior and still the default. + - + - When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records + - pref: GenerateAuthorityField667 + default: "Machine generated authority record" + type: textarea + class: code + - + - When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 670$a field of MARC21 records + - pref: GenerateAuthorityField670 + default: "Work cat." + type: textarea + class: code Linker: - -- 2.39.5