Bugzilla – Attachment 140467 Details for
Bug 30025
Split BiblioAddsAuthorities into 2 preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30025: Split BiblioAddsAuthorities into two sysprefs
Bug-30025-Split-BiblioAddsAuthorities-into-two-sys.patch (text/plain), 20.58 KB, created by
Martin Renvoize (ashimema)
on 2022-09-12 15:46:12 UTC
(
hide
)
Description:
Bug 30025: Split BiblioAddsAuthorities into two sysprefs
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-09-12 15:46:12 UTC
Size:
20.58 KB
patch
obsolete
>From 931811676b100f0ab6942109eeac43212e1e968a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 26 May 2022 16:14:40 +0000 >Subject: [PATCH] Bug 30025: Split BiblioAddsAuthorities into two sysprefs > >This patch adds two new sysprefs: >AutoLinkBiblios >AllowManualAuthorityEditing > >Both inherit the setting from BiblioAddsAuhtorities which is removed > >To test: >1 -Apply patches >2 - Update database >3 - Confirm old setting is transferred to new option >4 - Confirm you can edit authoriteis manually if AllowManualAuthorityEditing set to allow >5 - Confirm you cannot edit authorities manually if AllowManualAuthorityEditing set to don't allow >6 - Confirm a new bib is linked when AutoLinkBiblios is enabled (set AllowManualAuthorityEditing to add unlinked heading) >7 - Confirm new bib notlinked when AutoLinkBiblios is disabled >8 - Confim new bib not linked when AutoLinkBiblios is enabled, but heading doesn't match an authority and AutoCreateAuthorities is disabled >9 - Confim new bib linked to new authority when AutoLinkBiblios is enabled, but heading doesn't match an authority and AutoCreateAuthorities is enabled > >Signed-off-by: AFHDubCoLib <andrewfh@dubcolib.org> >--- > C4/Biblio.pm | 4 ++-- > C4/UsageStats.pm | 3 ++- > about.pl | 8 ++++---- > cataloguing/addbiblio.pl | 2 +- > installer/data/mysql/mandatory/sysprefs.sql | 3 ++- > .../intranet-tmpl/prog/en/modules/about.tt | 8 ++++---- > .../admin/preferences/authorities.pref | 19 +++++++++++++------ > t/db_dependent/Biblio.t | 10 +++++----- > t/db_dependent/Koha/SearchEngine/Indexer.t | 2 +- > 9 files changed, 34 insertions(+), 25 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index e2df601995..6fc9b3ebcd 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -282,7 +282,7 @@ sub AddBiblio { > # update MARC subfield that stores biblioitems.cn_sort > _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode ); > >- if (C4::Context->preference('BiblioAddsAuthorities')) { >+ if (C4::Context->preference('AutoLinkBiblios')) { > BiblioAutoLink( $record, $frameworkcode ); > } > >@@ -366,7 +366,7 @@ sub ModBiblio { > logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $biblio->metadata->record->as_formatted ); > } > >- if ( !$options->{disable_autolink} && C4::Context->preference('BiblioAddsAuthorities') ) { >+ if ( !$options->{disable_autolink} && C4::Context->preference('AutoLinkBiblios') ) { > BiblioAutoLink( $record, $frameworkcode ); > } > >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index 181a5cb555..16b833dd9c 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -152,7 +152,8 @@ sub _shared_preferences { > Persona > AuthDisplayHierarchy > AutoCreateAuthorities >- BiblioAddsAuthorities >+ AutoLinkBiblios >+ AllowManualAuthorityEditing > AuthorityMergeLimit > AuthorityMergeMode > UseAuthoritiesForTracings >diff --git a/about.pl b/about.pl >index 06f4050e28..9b01124ab9 100755 >--- a/about.pl >+++ b/about.pl >@@ -172,8 +172,8 @@ if ($prefStatisticsFields) { > } > > my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities'); >-my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities'); >-my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) ); >+my $prefAllowManualAuthorityEditing = C4::Context->preference('AllowManualAuthorityEditing'); >+my $warnPrefAllowManualAuthorityEditing = ( $prefAutoCreateAuthorities && ( !$prefAllowManualAuthorityEditing) ); > > my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords'); > my $prefUseControlNumber = C4::Context->preference('UseControlNumber'); >@@ -632,9 +632,9 @@ $template->param( > mysqlVersion => $versions{'mysqlVersion'}, > apacheVersion => $versions{'apacheVersion'}, > zebraVersion => $zebraVersion, >- prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities, >+ prefAllowManualAuthorityEditing => $prefAllowManualAuthorityEditing, > prefAutoCreateAuthorities => $prefAutoCreateAuthorities, >- warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities, >+ warnPrefAllowManualAuthorityEditing => $warnPrefAllowManualAuthorityEditing, > warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords, > warnPrefAnonymousPatronOPACPrivacy => $warnPrefAnonymousPatronOPACPrivacy, > warnPrefAnonymousPatronAnonSuggestions => $warnPrefAnonymousPatronAnonSuggestions, >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 92abe81082..494d4d84a7 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -376,7 +376,7 @@ sub create_input { > } > elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { > # when authorities auto-creation is allowed, do not set readonly >- my $is_readonly = !C4::Context->preference("BiblioAddsAuthorities"); >+ my $is_readonly = !C4::Context->preference("AllowManualAuthorityEditing"); > > $subfield_data{marc_value} = { > type => 'text', >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 3ee50c6d93..6c600d9fc2 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -31,6 +31,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AllowCheckoutNotes', '0', NULL, 'Allow patrons to submit notes about checked out items.','YesNo'), > ('AllowItemsOnHoldCheckoutSIP','0','','Do not generate RESERVED warning when checking out items reserved to someone else via SIP. This allows self checkouts for those items.','YesNo'), > ('AllowItemsOnHoldCheckoutSCO','0','','Do not generate RESERVE_WAITING and RESERVED warning in the SCO module when checking out items reserved to someone else. This allows self checkouts for those items.','YesNo'), >+('AllowManualAuthorityEditing','0',NULL,'Allow manual entry in controlled fields during cataloging.','YesNo'), > ('AllowMultipleCovers','0','1','Allow multiple cover images to be attached to each bibliographic record.','YesNo'), > ('AllowMultipleIssuesOnABiblio',1,'Allow/Don\'t allow patrons to check out multiple items from one biblio','','YesNo'), > ('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'), >@@ -80,6 +81,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'), > ('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses','YesNo'), > ('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'), >+('AutoLinkBiblios','0',NULL,'If enabled, link biblio to authorities on creation and edit','YesNo'), > ('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'), > ('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'), > ('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice'), >@@ -100,7 +102,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'), > ('BatchCheckouts','0','','Enable or disable batch checkouts','YesNo'), > ('BatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch','Free'), >-('BiblioAddsAuthorities','0',NULL,'If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist','YesNo'), > ('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'), > ('BiblioItemtypeInfo','0','0','Control which itemtype info displays for biblio level itemtypes','YesNo'), > ('BibtexExportAdditionalFields', '', NULL , 'Define additional BibTex tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 7dd92fb8e1..aa434efde8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -216,7 +216,7 @@ > </div> > > <div role="tabpanel" class="tab-pane" id="sysinfo"> >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing %] >+ [% IF warnAllowManualAuthorityEditing || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing %] > [% IF (warnIsRootUser) %] > <h2>Warning regarding current user</h2> > <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p> >@@ -300,12 +300,12 @@ > Contact your system administrator. > [% END %] > >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || warnXSLT || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size %] >+ [% IF warnPrefAllowManualAuthorityEditing || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || warnXSLT || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size %] > <h2>Warnings regarding the system configuration</h2> > <table> > <caption>Preferences and parameters</caption> >- [% IF (warnPrefBiblioAddsAuthorities) %] >- <tr><th scope="row"><strong>Warning</strong> </th><td>System preference 'AutoCreateAuthorities' set, but needs 'BiblioAddsAuthorities' set as well.</td></tr> >+ [% IF (warnPrefAllowManualAuthorityEditing) %] >+ <tr><th scope="row"><strong>Warning</strong> </th><td>System preference 'AutoCreateAuthorities' set, but needs 'AllowManualAuthorityEditing' set as well. Otherwise catalogers can add headings that will not be linked to authorities.</td></tr> > [% END %] > [% IF (warnPrefEasyAnalyticalRecords) %] > <tr><th scope="row"><strong>Warning</strong> </th><td>System preference 'EasyAnalyticalRecords' set, but UseControlNumber preference is set to 'Use'. Set it to 'Don't use' or else the 'Show analytics' links in the staff interface and the OPAC will be broken.</td></tr> >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 73e7f172e2..01f4ae1ff9 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 >@@ -16,12 +16,12 @@ Authorities: > type: textarea > - > - When editing records, >- - pref: BiblioAddsAuthorities >+ - pref: AllowManualAuthorityEditing > default: no > choices: > 1: allow > 0: "don't allow" >- - them to automatically create new authority records if needed, rather than having to reference existing authorities. >+ - catalogers to manually create new headings if needed, rather than having to reference existing authorities. > - > - When editing records, > - pref: AutoCreateAuthorities >@@ -29,7 +29,7 @@ Authorities: > choices: > 1: generate > 0: "don't generate" >- - authority records that are missing (<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BiblioAddsAuthorities">BiblioAddsAuthorities</a> must be set to "allow" for this to have any effect). >+ - authority records that are missing (<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AllowManualAuthorityEditing">AllowManualAuthorityEditing</a> must be set to "allow" for this to have any effect). > - > - When modifying an authority record, do not update attached bibliographic records if the number exceeds > - pref: AuthorityMergeLimit >@@ -64,13 +64,13 @@ Authorities: > "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. > - >- - "Use the following text as default value for the 667$a field of MARC21 authority records (requires <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BiblioAddsAuthorities'>BiblioAddsAuthorities</a> and <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreateAuthorities'>AutoCreateAuthorities</a>):" >+ - "Use the following text as default value for the 667$a field of MARC21 authority records (requires <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AllowManualAuthorityEditing'>AllowManualAuthorityEditing</a> and <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreateAuthorities'>AutoCreateAuthorities</a>):" > - pref: GenerateAuthorityField667 > default: "Machine generated authority record" > type: textarea > class: code > - >- - "Use the following text as default value for the 670$a field of MARC21 authority records (requires <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BiblioAddsAuthorities'>BiblioAddsAuthorities</a> and <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreateAuthorities'>AutoCreateAuthorities</a>):" >+ - "Use the following text as default value for the 670$a field of MARC21 authority records (requires <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AllowManualAuthorityEditing'>AllowManualAuthorityEditing</a> and <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreateAuthorities'>AutoCreateAuthorities</a>):" > - pref: GenerateAuthorityField670 > default: "Work cat." > type: textarea >@@ -111,4 +111,11 @@ Authorities: > choices: > 1: Do > 0: "Don't" >- - automatically relink headings that have previously been linked when saving records in the cataloging module. >+ - automatically relink headings that have previously been linked when saving records in the cataloging module (requires <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoLinkBiblios'>AutoLinkBiblios</a>). >+ - >+ - pref: AutoLinkBiblios >+ default: no >+ choices: >+ 1: Do >+ 0: "Don't" >+ - attempt to automatically link headings when saving records in the cataloging module, obeys <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=LinkerRelink'>LinkerRelink</a> and <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CatalogModuleRelink'>CatalogModuleRelink</a> for record edits. >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index ea8a8240ae..ddca106814 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -68,7 +68,7 @@ subtest 'AddBiblio' => sub { > is( Koha::Biblios->count, $nb_biblios, > 'No biblio should have been added if something went wrong' ); > >- t::lib::Mocks::mock_preference( 'BiblioAddsAuthorities', $marcflavour ); >+ t::lib::Mocks::mock_preference( 'AutoLinkBiblios', $marcflavour ); > t::lib::Mocks::mock_preference( 'AutoCreateAuthorities', $marcflavour ); > > my $mock_biblio = Test::MockModule->new("C4::Biblio"); >@@ -170,7 +170,7 @@ subtest "Authority creation with default linker" => sub { > plan tests => 4; > # Automatic authority creation > t::lib::Mocks::mock_preference('LinkerModule', 'Default'); >- t::lib::Mocks::mock_preference('BiblioAddsAuthorities', 1); >+ t::lib::Mocks::mock_preference('AutoLinkBiblios', 1); > t::lib::Mocks::mock_preference('AutoCreateAuthorities', 1); > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > my $linker = C4::Linker::Default->new({}); >@@ -447,7 +447,7 @@ sub run_tests { > 'GetMarcUrls prefixed a MARC21 URL with http://' ); > > # Automatic authority creation >- t::lib::Mocks::mock_preference('BiblioAddsAuthorities', 1); >+ t::lib::Mocks::mock_preference('AutoLinkBiblios', 1); > t::lib::Mocks::mock_preference('AutoCreateAuthorities', 1); > my $authorities_mod = Test::MockModule->new( 'C4::Heading' ); > $authorities_mod->mock( >@@ -491,7 +491,7 @@ sub run_tests { > is($field->subfield($author_relator_subfield), undef, 'Authority does not contain relator subfield'); > > # Reset settings >- t::lib::Mocks::mock_preference('BiblioAddsAuthorities', 0); >+ t::lib::Mocks::mock_preference('AutoLinkBiblios', 0); > t::lib::Mocks::mock_preference('AutoCreateAuthorities', 0); > } > >@@ -726,7 +726,7 @@ subtest 'MarcFieldForCreatorAndModifier' => sub { > subtest 'ModBiblio called from linker test' => sub { > plan tests => 2; > my $called = 0; >- t::lib::Mocks::mock_preference('BiblioAddsAuthorities', 1); >+ t::lib::Mocks::mock_preference('AutoLinkBiblios', 1); > my $biblio_mod = Test::MockModule->new( 'C4::Biblio' ); > $biblio_mod->mock( 'LinkBibHeadingsToAuthorities', sub { > $called = 1; >diff --git a/t/db_dependent/Koha/SearchEngine/Indexer.t b/t/db_dependent/Koha/SearchEngine/Indexer.t >index 4bb2fdf1f8..c593d03eda 100755 >--- a/t/db_dependent/Koha/SearchEngine/Indexer.t >+++ b/t/db_dependent/Koha/SearchEngine/Indexer.t >@@ -70,7 +70,7 @@ subtest 'Test indexer calls' => sub { > if scalar @engines == 1; > } > >- t::lib::Mocks::mock_preference( 'BiblioAddsAuthorities', 0 ); >+ t::lib::Mocks::mock_preference( 'AutoLinkBiblios', 0 ); > > for my $engine ( @engines ){ > t::lib::Mocks::mock_preference( 'SearchEngine', $engine ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30025
:
135389
|
135931
|
136807
|
136808
|
137235
|
137236
|
139176
|
139177
|
139178
|
139399
|
139505
|
139506
|
139507
|
140466
|
140467
|
140468
|
140469
|
140470
|
140471