Bug 26368: Add OCLC options to marc21_leader.tt
authorNick Clemens <nick@bywatersolutions.com>
Thu, 3 Sep 2020 12:52:28 +0000 (12:52 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 3 Oct 2022 11:04:05 +0000 (08:04 -0300)
See documentation at:
https://www.oclc.org/bibformats/en/fixedfield/elvl.html

To test:
 1 - Apply patch, updatedatabase
 2 - Edit a record in the basic editor
 3 - Edit the leader using the plugin
 4 - Note the options for '17 - Encoding level'
 5 - Find the system preference 'UseOCLCEncodingLevels'
 6 - Edit the record again
 7 - Note new options I,J,K,M
 8 - Set the value of encodign level to one of the new options and save
 9 - Edit again
10 - Confirm the value is displayed correctly selected
11 - Repeat tests using advanced cataloging editor

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
installer/data/mysql/atomicupdate/bug_26368_add_OCLC_encoding_syspref.perl [new file with mode: 0644]
installer/data/mysql/mandatory/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_leader.tt

diff --git a/installer/data/mysql/atomicupdate/bug_26368_add_OCLC_encoding_syspref.perl b/installer/data/mysql/atomicupdate/bug_26368_add_OCLC_encoding_syspref.perl
new file mode 100644 (file)
index 0000000..8e53efe
--- /dev/null
@@ -0,0 +1,15 @@
+use Modern::Perl;
+
+return {
+    bug_number => "26368",
+    description => "Add OCLC Encoding Levels system preference",
+    up => sub {
+        my ($args) = @_;
+        my ($dbh, $out) = @$args{qw(dbh out)};
+        $dbh->do(q{
+            INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type)
+            VALUES ('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo')
+        });
+        say $out "Added UseOCLCEncodingLevels system preference";
+    },
+};
index db99d68..8ea49bb 100644 (file)
@@ -762,6 +762,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
 ('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
 ('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
+('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
 ('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
 ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
 ('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
index 340c2a2..2876b9b 100644 (file)
             <option value="5">5 - Partial (preliminary) level</option>
             <option value="7">7 - Minimal level</option>
             <option value="8">8 - Prepublication level</option>
+            [% IF Koha.Preference('UseOCLCEncodingLevels') %]
+                <option value="I">I- Full-level input by OCLC participants</option>
+                <option value="J">J- Deleted record</option>
+                <option value="K">K- Less-than-full input by OCLC participants</option>
+                <option value="M">M- Added from a batch process</option>
+            [% END %]
             <option value="u">u - Unknown</option>
             <option value="z">z - Not applicable</option>
         </select>
index 5b2cbf8..5613386 100644 (file)
@@ -171,6 +171,12 @@ Cataloging:
               choices:
                   biblionumber: generated as biblionumber.
                   "OFF": not generated automatically.
+        -
+            - Display OCLC defined values for MARC encoding level in leader value builder?
+            - pref: UseOCLCEncodingLevels
+              choices:
+                  1: Yes.
+                  0: No.
     Display:
         -
             - 'Separate main entry and subdivisions with '
index e77d2a8..100725d 100644 (file)
@@ -1,4 +1,5 @@
 [% SET footerjs = 1 %]
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>000 - Leader builder &rsaquo; Cataloging &rsaquo; Koha</title>
 [% INCLUDE 'doc-head-close.inc' %]
                                [% ELSE %]
                                        <option value="8">8- Prepublication level</option>
                                [% END %]
+                [% IF Koha.Preference('UseOCLCEncodingLevels') %]
+                    [% IF ( f17I ) %]
+                            <option value="I" selected="selected">I- Full-level input by OCLC participants</option>
+                    [% ELSE %]
+                            <option value="I">I- Full-level input by OCLC participants</option>
+                    [% END %]
+                    [% IF ( f17J ) %]
+                            <option value="J" selected="selected">J- Deleted record</option>
+                    [% ELSE %]
+                            <option value="J">J- Deleted record</option>
+                    [% END %]
+                    [% IF ( f17K ) %]
+                            <option value="K" selected="selected">K- Less-than-full input by OCLC participants</option>
+                    [% ELSE %]
+                            <option value="K">K- Less-than-full input by OCLC participants</option>
+                    [% END %]
+                    [% IF ( f17K ) %]
+                            <option value="M" selected="selected">M- Added from a batch process</option>
+                    [% ELSE %]
+                            <option value="M">M- Added from a batch process</option>
+                    [% END %]
+                [% END %]
                                [% IF ( f17u ) %]
                                        <option value="u" selected="selected">u - Unknown</option>
                                [% ELSE %]