Bug 16371: Use multi-select on syspref
authorEmmi Takkinen <emmi.takkinen@outlook.com>
Tue, 14 Apr 2020 09:51:50 +0000 (12:51 +0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:15:33 +0000 (10:15 +0200)
This patch replaces textbox with multi-select dropdown on
syspref 'QuoteOfTheDay' and changes tests to match this change.

To test:
1. Check 'OPAC', 'staff client' or both on 'QuoteOfTheDay'.
2. Make sure that quote is displayed on (both) mainpage(s).

Prove t/db_dependent/Koha/Quotes.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

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

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

koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
t/db_dependent/Koha/Quotes.t

index c47e7cd..9fdd12b 100644 (file)
@@ -491,13 +491,12 @@ OPAC:
                   no: Disable
             - browsing and paging search results from the OPAC detail page.
         -
+            - Show quote of the day in the
             - pref: QuoteOfTheDay
-              default:
-              class: short
-            - Quote of the Day display in Koha.
-            - Add 'opac' to show in OPAC home page.
-            - Add 'intranet' to show in the staff client main page.
-            - Example 'opac intranet', displays QOTD in OPAC and the staff client.
+              multiple:
+                intranet: staff client
+                opac: OPAC
+            - main page.
         -
             - pref: OPACPopupAuthorsSearch
               default: 0
index dd1477e..de8212a 100644 (file)
@@ -98,7 +98,7 @@ subtest "get_daily_quote_for_interface" => sub {
         timestamp   => DateTime::Format::MySQL->format_datetime(dt_from_string),
     };
 
-    t::lib::Mocks::mock_preference('QuoteOfTheDay', '');
+    t::lib::Mocks::mock_preference('QuoteOfTheDay', 0);
 
     ##Set interface and get nothing because syspref is not set.
     C4::Context->interface('opac');
@@ -106,12 +106,12 @@ subtest "get_daily_quote_for_interface" => sub {
     ok(not($quote), "'QuoteOfTheDay'-syspref not set so nothing returned");
 
     ##Set 'QuoteOfTheDay'-syspref to not include current interface 'opac'
-    t::lib::Mocks::mock_preference('QuoteOfTheDay', 'intra commandline sip2 api yo-mama');
+    t::lib::Mocks::mock_preference('QuoteOfTheDay', 'intranet');
     $quote = Koha::Quote->get_daily_quote_for_interface(id => $quote_1->id);
     ok(not($quote), "'QuoteOfTheDay'-syspref doesn't include 'opac'");
 
     ##Set 'QuoteOfTheDay'-syspref to include current interface 'opac'
-    t::lib::Mocks::mock_preference('QuoteOfTheDay', 'intraopaccommandline');
+    t::lib::Mocks::mock_preference('QuoteOfTheDay', 'opac,intranet');
     $quote = Koha::Quote->get_daily_quote_for_interface(id => $quote_1->id);
     is_deeply($quote, $expected_quote, "Got the expected quote");