diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 4dfb152a6c..0a9fc82fa1 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -531,6 +531,21 @@ modules: - columnname: subscription_callnumber + comments-table: + columns: + - + columnname: patron + - + columnname: date + - + columnname: status + - + columnname: comment + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 + checkoutshistory-table: default_display_length: 20 columns: diff --git a/catalogue/detail.pl b/catalogue/detail.pl index dd0802c025..343146937e 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -57,6 +57,7 @@ use Koha::Patrons; use Koha::Virtualshelves; use Koha::Plugins; use Koha::Recalls; +use Koha::Reviews; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; use Koha::Serial::Items; @@ -85,10 +86,15 @@ if ( C4::Context->config('enable_plugins') ) { ); } +my $activetab = $query->param('activetab'); my $biblionumber = $query->param('biblionumber'); $biblionumber = HTML::Entities::encode($biblionumber); my $biblio = Koha::Biblios->find( $biblionumber ); -$template->param( 'biblio', $biblio ); + +$template->param( + biblio => $biblio, + activetab => $activetab, +); unless ( $biblio ) { # biblionumber invalid -> report and exit @@ -382,6 +388,37 @@ if (C4::Context->preference("AlternateHoldingsField") && $items_to_display->coun ); } +if ( C4::Context->preference('OPACComments') ) { + my $reviews = Koha::Reviews->search( + { biblionumber => $biblionumber }, + { order_by => { -desc => 'datereviewed' } } + )->unblessed; + my $libravatar_enabled = 0; + if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto') ) { + eval { + require Libravatar::URL; + Libravatar::URL->import(); + }; + if ( !$@ ) { + $libravatar_enabled = 1; + } + } + for my $review (@$reviews) { + my $review_patron = + Koha::Patrons->find( $review->{borrowernumber} ); # FIXME Should be Koha::Review->reviewer or similar + + # setting some borrower info into this hash + if ($review_patron) { + $review->{patron} = $review_patron; + if ( $libravatar_enabled and $review_patron->email ) { + $review->{avatarurl} = libravatar_url( email => $review_patron->email, https => $ENV{HTTPS} ); + } + } + } + $template->param( 'reviews' => $reviews ); + +} + my @results = ( $dat, ); foreach ( keys %{$dat} ) { $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' ); diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 2d3bed2ad2..5b702b4477 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2753,6 +2753,15 @@ fieldset > .toptabs { font-style: italic; } +.commentline { + border-bottom: 1px solid #CCC; + + .btn-toolbar { + margin-bottom: 0; + margin-left: 0; + } +} + .contents { width: 75%; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 0a71edd3b4..6c2048aee8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -51,7 +51,6 @@ [% END %]
- [% WRAPPER 'header.inc' %] [% INCLUDE 'cat-search.inc' %] [% END %] @@ -381,6 +380,12 @@ [% END %] [% END %] + [% IF ( reviews ) %] + [% WRAPPER tab_item tabname= "comments" %] + Comments [% ' ( ' _ ( reviews.size ) _ ' )' | html %] + [% END %] + [% END %] + [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %] [% WRAPPER tab_item tabname= "NovelistSelect" %] NoveList Select @@ -837,6 +842,82 @@ [% END # /tab_panel %] [% END # /IF HTML5MediaEnabled %] + [% IF ( reviews ) %] + [% WRAPPER tab_panel tabname="comments" %] + [% SET ShowReviewerPhoto = Koha.Preference( "ShowReviewerPhoto" ) %] +| Commenter | +Date | +Status | +Comment | +Actions | +
|---|---|---|---|---|
|
+ [% IF ( review.patron ) %]
+ [% IF ( review.avatarurl ) %]
+ |
+ + [% review.datereviewed | $KohaDates %] + | ++ [% IF ( review.approved ) %] + Approved + [% ELSE %] + Unapproved + [% END %] + | ++ [% FILTER html_break %] + [% review.review | html %] + [% END %] + | + [% IF ( CAN_user_tools_moderate_comments ) %] ++ [% IF ( review.approved ) %] + + [% ELSE %] + + [% END %] + + | + [% END # /IF CAN_user_tools_moderate_comments %] +