Bugzilla – Attachment 183812 Details for
Bug 40308
New Perl Class (Koha::ExternalContent::OCLC) for integrating with OCLC's APIs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40308: add new System Preferences for OCLC Dewey API
Bug-40308-add-new-System-Preferences-for-OCLC-Dewe.patch (text/plain), 10.06 KB, created by
Andreas Roussos
on 2025-07-07 00:17:30 UTC
(
hide
)
Description:
Bug 40308: add new System Preferences for OCLC Dewey API
Filename:
MIME Type:
Creator:
Andreas Roussos
Created:
2025-07-07 00:17:30 UTC
Size:
10.06 KB
patch
obsolete
>From 3a996962a510c6b796b905971d4b1649f560a1c8 Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <a.roussos@dataly.gr> >Date: Mon, 7 Jul 2025 02:45:50 +0300 >Subject: [PATCH] Bug 40308: add new System Preferences for OCLC Dewey API > >This patch adds four new System Preferences that control the >integration with the OCLC Dewey Linked Data API, namely: > >- OCLCAPIWSKeyClientID: Stores the client ID component of your > OCLC API WSKey >- OCLCAPIWSKeyClientSecret: Stores the client secret component > of your OCLC API WSKey >- OCLCDeweyLinkedDataAPI: Basically an On/Off "switch" for the > lookup service >- OCLCDeweyLinkedDataLanguage: Sets the language of the DDC > description to be fetched > >Test plan: > >0) Launch either a MARC21 or a UNIMARC KTD container (MARC flavour does > not play a role for this particular test plan), then apply this patch. > >1) Run `reset_all` to force your KTD instance to load > installer/data/mysql/mandatory/sysprefs.sql. > >2) Then, visit Administration > System preferences > Web services and > inspect the four new sysprefs under 'OCLC Dewey Linked Data API'. > Look for typos in the descriptions, etc. > >3) Then, run `updatedatabase` to test the atomic update. > It should complete without warnings/errors. > >4) Finally, visually inspect the output of `git log -p C4/UsageStats.pm` > for errors. Notice that the System Preferences pertaining to the WSKey > client ID and secret were *not* added for security reasons. >--- > C4/UsageStats.pm | 2 + > .../data/mysql/atomicupdate/bug_40308.pl | 49 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 4 ++ > .../admin/preferences/web_services.pref | 33 +++++++++++++ > 4 files changed, 88 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_40308.pl > >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index 4022741ac0..535d92b6ee 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -351,6 +351,8 @@ sub _shared_preferences { > ILS-DI > OAI-PMH > version >+ OCLCDeweyLinkedDataAPI >+ OCLCDeweyLinkedDataLanguage > /; > > return \@preferences; >diff --git a/installer/data/mysql/atomicupdate/bug_40308.pl b/installer/data/mysql/atomicupdate/bug_40308.pl >new file mode 100755 >index 0000000000..c961700bd2 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40308.pl >@@ -0,0 +1,49 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "40308", >+ description => >+ "Adds new system preferences 'OCLCAPIWSKeyClientID', 'OCLCAPIWSKeyClientSecret', 'OCLCDeweyLinkedDataAPI', and 'OCLCDeweyLinkedDataLanguage'", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('OCLCAPIWSKeyClientID', '', NULL, 'The client ID component of your OCLC API WSKey', 'Free') >+ } >+ ); >+ say_success( $out, "Added new system preference 'OCLCAPIWSKeyClientID'" ); >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('OCLCAPIWSKeyClientSecret', '', NULL, 'The client secret component of your OCLC API WSKey', 'Free') >+ } >+ ); >+ say_success( $out, "Added new system preference 'OCLCAPIWSKeyClientSecret'" ); >+ >+ say_info( >+ $out, >+ "Please refer to https://help.oclc.org/Librarian_Toolbox/OCLC_APIs/Get_started/Request_an_API_WSKey for information on how to obtain an OCLC API WSKey" >+ ); >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('OCLCDeweyLinkedDataAPI', '0', NULL, 'If enabled, users will be able to query the OCLC Dewey Linked Data API while cataloguing authorities', 'YesNo') >+ } >+ ); >+ say_success( $out, "Added new system preference 'OCLCDeweyLinkedDataAPI'" ); >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('OCLCDeweyLinkedDataLanguage', 'en', 'de|en|fr|it|no|sv', 'Defines the language of the DDC number/range description to be copied in authority subfield 083$c (MARC21) or 676$c (UNIMARC)', 'Choice') >+ } >+ ); >+ say_success( $out, "Added new system preference 'OCLCDeweyLinkedDataLanguage'" ); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index f9f419c39d..763fd90622 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -465,6 +465,10 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OAI-PMH:DeletedRecord','persistent','Koha\'s deletedbiblio table will never be deleted (persistent), might be deleted (transient), or will never have any data in it (no)','transient|persistent|no','Choice'), > ('OAI-PMH:HarvestEmailReport','','','After an OAI-PMH harvest, send a report email to the email address','Free'), > ('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'), >+('OCLCAPIWSKeyClientID', '', NULL, 'The client ID component of your OCLC API WSKey', 'Free'), >+('OCLCAPIWSKeyClientSecret', '', NULL, 'The client secret component of your OCLC API WSKey', 'Free'), >+('OCLCDeweyLinkedDataAPI', '0', NULL, 'If enabled, users will be able to query the OCLC Dewey Linked Data API while cataloguing authorities', 'YesNo'), >+('OCLCDeweyLinkedDataLanguage', 'en', 'de|en|fr|it|no|sv', 'Defines the language of the DDC number/range description to be copied in authority subfield 083$c (MARC21) or 676$c (UNIMARC)', 'Choice'), > ('OnSiteCheckoutAutoCheck','0','','Enable/Do not enable onsite checkout by default if last checkout was an onsite checkout','YesNo'), > ('OnSiteCheckouts','0','','Enable/Disable the on-site checkouts feature','YesNo'), > ('OnSiteCheckoutsForce','0','','Enable/Disable the on-site for all cases (Even if a user is debarred, etc.)','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref >index a1900bc746..f574530768 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref >@@ -141,3 +141,36 @@ Web services: > 0: Disable > - the IdRef web service from the OPAC detail page. IdRef allows requests for authorities from the Sudoc database. > - Please note that this feature is available only for UNIMARC. >+ >+ OCLC Dewey Linked Data API: >+ - >+ - "OCLC API WSKey Client ID:" >+ - pref: OCLCAPIWSKeyClientID >+ - Along with <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OCLCAPIWSKeyClientSecret">OCLCAPIWSKeyClientSecret</a>, enables <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OCLCDeweyLinkedDataAPI">OCLCDeweyLinkedDataAPI</a>. >+ - >+ - "OCLC API WSKey Client Secret:" >+ - pref: OCLCAPIWSKeyClientSecret >+ - Along with <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OCLCAPIWSKeyClientID">OCLCAPIWSKeyClientID</a>, enables <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OCLCDeweyLinkedDataAPI">OCLCDeweyLinkedDataAPI</a>. >+ - >+ - pref: OCLCDeweyLinkedDataAPI >+ choices: >+ 1: Enable >+ 0: Disable >+ - querying the OCLC Dewey Linked Data API while editing authority records. >+ - <br><br>This feature enables searching for DDC (Dewey Decimal Classification) numbers in the <a href="https://help.oclc.org/Metadata_Services/WebDewey/WebDewey_Linked_Data/Dewey_Linked_Data_API">OCLC Dewey Linked Data API</a>. >+ - <br>The API is capable of returning unique Linked Data IDs (URIs) and corresponding URLs for a given DDC number (or range), which can then be stored in subfield <a href="https://www.loc.gov/marc/authority/ad082.html">082</a>$1/<a href="https://www.loc.gov/marc/authority/ad083.html">083</a>$1 (MARC21), or <a href="https://www.ifla.org/unimarc-updates/unimarc-authorities-format-manual-online-ed/">676</a>$R (UNIMARC). >+ - <br>The API is also capable of returning Descriptions for a given Linked Data URI, which can then be stored in subfield <a href="https://www.loc.gov/marc/authority/ad083.html">083</a>$c (MARC21), or <a href="https://www.ifla.org/unimarc-updates/unimarc-authorities-format-manual-online-ed/">676</a>$c (UNIMARC). >+ - <br><br>Requires both <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OCLCAPIWSKeyClientID">OCLCAPIWSKeyClientID</a> and <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OCLCAPIWSKeyClientSecret">OCLCAPIWSKeyClientSecret</a> to be set before set to 'Enable'. >+ - <br>Please refer to the <a href="https://help.oclc.org/Librarian_Toolbox/OCLC_APIs/Get_started/Request_an_API_WSKey">official OCLC documentation</a> for information on how to obtain an OCLC API WSKey. >+ - <br><br><strong>NOTE:</strong> You must have a valid WebDewey subscription in order to <a href="https://help.oclc.org/Librarian_Toolbox/OCLC_APIs/Get_started/Request_an_API_WSKey">request a WSKey</a> capable of accessing the OCLC Dewey Linked Data API. >+ - >+ - Use >+ - pref: OCLCDeweyLinkedDataLanguage >+ choices: >+ en: English >+ fr: French >+ de: German >+ it: Italian >+ no: Norwegian >+ sv: Swedish >+ - as the language of the DDC number/range description to be copied in authority subfield 083$c (MARC21) or 676$c (UNIMARC). >-- >2.39.5
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 40308
:
183809
|
183810
|
183811
| 183812 |
183813