From 225a6d276a6e9973d2a77c14d407833038dda5c4 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Tue, 14 Apr 2020 12:51:50 +0300 Subject: [PATCH] Bug 16371: Use multi-select on syspref and remove 'display_daily_quote' condition This patch replaces textbox with multi-select dropdown on syspref 'QuoteOfTheDay' and changes tests to match this change. Also removes condition 'display_daily_quite' from opac-main.tt since it's no longer needed and prevents quotes showing in OPAC. Sponsored-by: Koha-Suomi Oy --- .../en/modules/admin/preferences/opac.pref | 11 +++++----- .../bootstrap/en/modules/opac-main.tt | 2 +- .../Koha/GetDailyQuoteForInterface.t | 21 ++++++++++++++++--- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 437a96b410..5e14d3360e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -512,13 +512,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 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt index e113357cca..7a8699a8b2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -141,7 +141,7 @@ [% END # IF koha_news %] [% UNLESS news_item # Don't show under single news item %] - [% IF ( display_daily_quote && daily_quote ) %] + [% IF ( daily_quote ) %]

Quote of the day

diff --git a/t/db_dependent/Koha/GetDailyQuoteForInterface.t b/t/db_dependent/Koha/GetDailyQuoteForInterface.t index da4507df55..47966e86d3 100644 --- a/t/db_dependent/Koha/GetDailyQuoteForInterface.t +++ b/t/db_dependent/Koha/GetDailyQuoteForInterface.t @@ -1,5 +1,20 @@ #!/usr/bin/perl +# This file is part of Koha +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + use Modern::Perl; use Test::More; use Test::More tests => 3; @@ -34,7 +49,7 @@ my $expected_quote = { text => 'Unfurl thy limbs breathless succubus
How the full embosomed fog
Imparts the night to us....', }; -t::lib::Mocks::mock_preference('QuoteOfTheDay', ''); +t::lib::Mocks::mock_preference('QuoteOfTheDay', 0); subtest "GetDailyQuoteForInterface" => sub { @@ -48,12 +63,12 @@ subtest "GetDailyQuoteForInterface" => 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 = C4::Koha::GetDailyQuoteForInterface(id => $test_quote->{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 = C4::Koha::GetDailyQuoteForInterface(id => $test_quote->{id}); is($quote->{text}, $expected_quote->{text}, "Got the expected quote"); -- 2.17.1