@@ -, +, @@
interfaces
---
C4/Koha.pm | 26 ++++++++++
.../en/modules/admin/preferences/opac.pref | 11 ++--
.../prog/en/modules/intranet-main.tt | 8 +++
.../prog/en/modules/tools/quotes.tt | 5 +-
mainpage.pl | 3 +-
opac/opac-main.pl | 5 +-
.../Koha/GetDailyQuoteForInterface.t | 52 +++++++++++++++++++
7 files changed, 97 insertions(+), 13 deletions(-)
create mode 100644 t/db_dependent/Koha/GetDailyQuoteForInterface.t
--- a/C4/Koha.pm
+++ a/C4/Koha.pm
@@ -35,6 +35,8 @@ use autouse 'Data::cselectall_arrayref' => qw(Dumper);
use DBI qw(:sql_types);
use vars qw(@ISA @EXPORT @EXPORT_OK $DEBUG);
+use Koha::Exceptions::UnknownProgramState;
+
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@@ -973,6 +975,30 @@ sub GetVariationsOfISSNs {
1;
+=head2 GetDailyQuoteForInterface
+
+ my $quote = C4::Koha::GetDailyQuoteForInterface();
+
+Is a wrapper for GetDailyQuotes(), with an extra check for using the correct
+interface defined in the syspref 'QuoteOfTheDay'.
+If the current interface is not allowed to display quotes, then returns undef.
+
+=cut
+
+sub GetDailyQuoteForInterface {
+ my %opts = @_;
+ my $qotdPref = C4::Context->preference('QuoteOfTheDay');
+ my $interface = C4::Context->interface();
+ unless ($interface) {
+ my @cc = caller(3);
+ Koha::Exceptions::UnknownProgramState->throw(error => $cc[3]."()> C4::Context->interface() is not set! Don't know are you in OPAC or staff client?");
+ }
+ unless ($qotdPref =~ /$interface/) {
+ return undef;
+ }
+ return GetDailyQuote(%opts);
+}
+
__END__
=head1 AUTHOR
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -513,11 +513,12 @@ OPAC:
- browsing and paging search results from the OPAC detail page.
-
- pref: QuoteOfTheDay
- default: 0
- choices:
- yes: Enable
- no: Disable
- - Quote of the Day display on OPAC home page
+ 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.
-
- pref: OPACPopupAuthorsSearch
default: 0
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
@@ -34,6 +34,14 @@
[% END %]
[% END %]
+ [% IF ( daily_quote ) %]
+