Bug 30025: Replace AllowManualAuthorityEditing with RequireChoosingExistingAuthority
authorNick Clemens <nick@bywatersolutions.com>
Tue, 16 Aug 2022 11:11:09 +0000 (11:11 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 16 Sep 2022 19:48:34 +0000 (16:48 -0300)
This flips the pref from an allowance to a requirement, hopefully this makes the logic here clearer

Test as before, but the values for the renamed pref flipped

Signed-off-by: AFHDubCoLib <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/UsageStats.pm
about.pl
cataloguing/addbiblio.pl
installer/data/mysql/atomicupdate/bug_30025.pl
installer/data/mysql/mandatory/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref

index 16b833d..7cf2098 100644 (file)
@@ -153,7 +153,7 @@ sub _shared_preferences {
         AuthDisplayHierarchy
         AutoCreateAuthorities
         AutoLinkBiblios
-        AllowManualAuthorityEditing
+        RequireChoosingExistingAuthority
         AuthorityMergeLimit
         AuthorityMergeMode
         UseAuthoritiesForTracings
index 9b01124..8adf1c9 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -172,8 +172,8 @@ if ($prefStatisticsFields) {
 }
 
 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
-my $prefAllowManualAuthorityEditing = C4::Context->preference('AllowManualAuthorityEditing');
-my $warnPrefAllowManualAuthorityEditing = ( $prefAutoCreateAuthorities && ( !$prefAllowManualAuthorityEditing) );
+my $prefRequireChoosingExistingAuthority = C4::Context->preference('RequireChoosingExistingAuthority');
+my $warnPrefRequireChoosingExistingAuthority = ( !$prefAutoCreateAuthorities && ( !$prefRequireChoosingExistingAuthority) );
 
 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,
-    prefAllowManualAuthorityEditing => $prefAllowManualAuthorityEditing,
+    prefRequireChoosingExistingAuthority => $prefRequireChoosingExistingAuthority,
     prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
-    warnPrefAllowManualAuthorityEditing => $warnPrefAllowManualAuthorityEditing,
+    warnPrefRequireChoosingExistingAuthority => $warnPrefRequireChoosingExistingAuthority,
     warnPrefEasyAnalyticalRecords  => $warnPrefEasyAnalyticalRecords,
     warnPrefAnonymousPatronOPACPrivacy        => $warnPrefAnonymousPatronOPACPrivacy,
     warnPrefAnonymousPatronAnonSuggestions    => $warnPrefAnonymousPatronAnonSuggestions,
index 20fa1ad..5896de1 100755 (executable)
@@ -380,7 +380,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("AllowManualAuthorityEditing");
+        my $is_readonly = C4::Context->preference("RequireChoosingExistingAuthority");
 
         $subfield_data{marc_value} = {
             type      => 'text',
index d82246f..56337b6 100755 (executable)
@@ -11,10 +11,10 @@ return {
         $dbh->do(q{
             INSERT IGNORE INTO systempreferences
             ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
-            ('AllowManualAuthorityEditing',?,NULL,'Allow manual entry in controlled fields during cataloging.','YesNo'),
+            ('RequireChoosingExistingAuthority',?,NULL,'Require selecting existing authority entry in controlled fields during cataloging.','YesNo'),
             ('AutoLinkBiblios',?,NULL,'If enabled, link biblio to authorities on creation and edit','YesNo')
-        },undef,($biblio_adds_authorities,$biblio_adds_authorities));
-        say $out "Added AllowManualAuthorityEditing and AutoLinkBiblios";
+        },undef,($biblio_adds_authorities eq '1' ? '0' : '1', $biblio_adds_authorities));
+        say $out "Added RequireChoosingExistingAuthority and AutoLinkBiblios";
         $dbh->do(q{DELETE FROM systempreferences WHERE variable="BiblioAddsAuthorities";});
         say $out "BiblioAddsAuthorities removed";
     },
index 0594d72..617d34b 100644 (file)
@@ -31,7 +31,6 @@ 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'),
@@ -591,6 +590,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('ReplyToDefault','',NULL,'Use this email address as the replyto in emails','Free'),
 ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'),
 ('RequireCashRegister','0',NULL,'Require a cash register when collecting a payment','YesNo'),
+('RequireChoosingExistingAuthority','0',NULL,'Require existing authority selection in controlled fields during cataloging.','YesNo'),
 ('RequirePaymentType','0','','Require staff to select a payment type when a payment is made','YesNo'),
 ('RequireStrongPassword','1','','Require a strong login password for staff and patrons','YesNo'),
 ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
index aa434ef..bfba839 100644 (file)
         </div>
 
         <div role="tabpanel" class="tab-pane" id="sysinfo">
-    [% 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 warnRequireChoosingExistingAuthority || 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>
             Contact your system administrator.
         [% END %]
 
-        [% 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 %]
+        [% IF warnPrefRequireChoosingExistingAuthority || 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 (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>
+                [% IF (warnPrefRequireChoosingExistingAuthority) %]
+                <tr><th scope="row"><strong>Warning</strong> </th><td>System preference 'RequireChoosingExistingAuthority' is disabled, but needs 'AutoCreateAuthorites' enabled. 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>
index 01f4ae1..a8a5244 100644 (file)
@@ -16,12 +16,12 @@ Authorities:
               type: textarea
         -
             - When editing records,
-            - pref: AllowManualAuthorityEditing
-              default: no
+            - pref: RequireChoosingExistingAuthority
+              default: yes
               choices:
-                  1: allow
-                  0: "don't allow"
-            - catalogers to manually create new headings if needed, rather than having to reference existing authorities.
+                  1: require
+                  0: "don't require"
+            - catalogers to reference existing authorities. If set to don't, catalogers can manually enter uncontrolled terms into controlled fields
         -
             - 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=AllowManualAuthorityEditing">AllowManualAuthorityEditing</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=RequireChoosingExistingAuthority">RequireChoosingExistingAuthority</a> must be set to "don't require" 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=AllowManualAuthorityEditing'>AllowManualAuthorityEditing</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 (must not require <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RequireChoosingExistingAuthority'>RequireChoosingExistingAuthority</a> and must allow <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=AllowManualAuthorityEditing'>AllowManualAuthorityEditing</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 (must not require <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RequireChoosingExistingAuthority'>RequireChoosingExistingAuthority</a> and must allow <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreateAuthorities'>AutoCreateAuthorities</a>):"
             - pref: GenerateAuthorityField670
               default: "Work cat."
               type: textarea