Bug 11994: (follow-up) Make things work when LibraryName is empty
authorKatrin Fischer <katrin.fischer.83@web.de>
Fri, 1 May 2020 20:11:29 +0000 (20:11 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 24 Jun 2020 12:31:37 +0000 (14:31 +0200)
When LibraryName system preference was not set, the installation
of the plugin would fail with:

Firefox could not download the search plugin from: ...

Now if the pref is empty, the description 'Library catalog'
will be used instead.

To test:
- Empty your LibraryName pref
- Verify the search plugin can still be installed
  (see first patch for further instructions)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt

index 7b43110..43d205e 100644 (file)
@@ -1,12 +1,12 @@
-<?xml version='1.0' encoding='utf-8'  ?>
-[% USE raw %]
-[% USE Koha %]
-[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
-[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
+<?xml version='1.0' encoding='utf-8' ?>
+[%- USE raw -%]
+[%- USE Koha -%]
+[%- SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') -%]
+[%- SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') -%]
 
 [% IF ( opensearchdescription ) %]
     <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
-        <ShortName>[% LibraryNameTitle | html %]</ShortName>
+        <ShortName>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Library catalog[% END %]</ShortName>
         <Description>Search the [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha library[% END %] catalog</Description>
         <InputEncoding>UTF-8</InputEncoding>
         <Image width="16" height="16" type="image/x-icon">