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 817dad6725..3399c3812a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -135,24 +135,24 @@ [% END # /casAuthentication %] [% ELSE %] - [% IF Koha.Preference('OPACUserSummary') %] + [% IF Koha.Preference('OPACUserSummary') && dashboard_info %]

Welcome, [% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]

diff --git a/opac/opac-main.pl b/opac/opac-main.pl index d63392b864..33e100f361 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -27,8 +27,8 @@ use C4::Languages qw(getTranslatedLanguages accept_language); use C4::Koha qw( GetDailyQuote ); use C4::Members; use C4::Overdues; -use C4::Reserves; use Koha::Checkouts; +use Koha::Holds; my $input = new CGI; my $dbh = C4::Context->dbh; @@ -66,23 +66,22 @@ my $koha_news_count = scalar @$all_koha_news; my $quote = GetDailyQuote(); # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha +# For dashboard my $checkouts = Koha::Checkouts->search({ borrowernumber => $borrowernumber })->count; my ( $overdues_count, $overdues ) = checkoverdues($borrowernumber); -my @holds = GetReservesFromBorrowernumber($borrowernumber); -my $holds_pending = 0; -foreach my $hold (@holds) { - if (not defined($hold->{found})){ - $holds_pending++; - } -} -my @holds_waiting = GetReservesFromBorrowernumber($borrowernumber, 'W'); +my $holds_pending = Koha::Holds->search({ borrowernumber => $borrowernumber, found => undef })->count; +my $holds_waiting = Koha::Holds->search({ borrowernumber => $borrowernumber })->waiting->count; my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); +if ( $checkouts > 0 || $overdues_count > 0 || $holds_pending > 0 || $holds_waiting > 0 || $total > 0 ) { + $template->param( dashboard_info => 1 ); +} + $template->param( checkouts => $checkouts, overdues => $overdues_count, holds_pending => $holds_pending, - holds_waiting => scalar @holds_waiting, + holds_waiting => $holds_waiting, total_owing => $total, koha_news => $all_koha_news, koha_news_count => $koha_news_count,