Bug 14457: (follow-up) Add syspref for Libris API URL
authorChris Cormack <chrisc@catalyst.net.nz>
Thu, 29 Sep 2016 21:47:52 +0000 (21:47 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 16 Apr 2019 13:17:33 +0000 (13:17 +0000)
Added another syspref for the url of the Libris API
Added sysprefs to syspref.sql

Please test the 2 patches together

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha/SuggestionEngine/Plugin/LibrisSpellcheck.pm
installer/data/mysql/atomicupdate/bug_14557_add_libriskey_syspref.sql
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref

index 5d0b7f0..6177892 100644 (file)
@@ -29,9 +29,9 @@ sub NAME {
 sub get_suggestions {
     my ($self, $query) = @_;
     my $key = C4::Context->preference('LibrisKey');
-
+    my $base = C4::Context->preference('LibrisURL');
     my $search = $query->{'search'};
-    my $response = LWP::UserAgent->new->get("http://api.libris.kb.se/bibspell/spell?query={$search}&key=$key");
+    my $response = LWP::UserAgent->new->get($base."spell?query={$search}&key=$key");
     my $xml = XMLin($response->content, NoAttr => 1, ForceArray => qr/term/);
 
     my @terms;
index 4f36288..c7d2386 100644 (file)
@@ -1 +1,2 @@
-INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('LibrisKey', '', 'This key must be obtained at http://api.libris.kb.se/. It is unique for the IP of the server.', NULL, 'Free');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('LibrisKey', '', 'This key must be obtained at http://api.libris.kb.se/. It is unique for the IP of the server.', NULL, 'Free');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('LibrisURL', 'http://api.libris.kb.se/bibspell/', 'This it the base URL for the Libris spellchecking API.',NULL,'Free');
index 0a983e3..40488d1 100644 (file)
@@ -647,5 +647,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
 ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
 ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
-('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
-;
+('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
+('LibrisKey', '', 'This key must be obtained at http://api.libris.kb.se/. It is unique for the IP of the server.', NULL, 'Free'),
+('LibrisURL', 'http://api.libris.kb.se/bibspell/', 'This it the base URL for the Libris spellchecking API.',NULL,'Free');
index c5a5102..fd53954 100644 (file)
@@ -243,8 +243,12 @@ Searching:
                   yes: "search"
                   no: "don't search"
             - on all variations of the ISBN. Note that this preference has no effect if UseQueryParser is on.
-    API Keys:
+    Did you Mean/Spell checking:
         -
-            - LIBRIS Spellcheking API key
+            - LIBRIS Spellchecking API key
             - pref: LibrisKey
             - "Can be obtained at http://api.libris.kb.se/bibspell."
+        -
+            - LIBRIS base URL
+            - pref: LibrisURL
+            - "Please only change this if you are sure it needs changing."