View | Details | Raw Unified | Return to bug 2486
Collapse All | Expand All

(-)a/admin/columns_settings.yml (+15 lines)
Lines 531-536 modules: Link Here
531
            -
531
            -
532
              columnname: subscription_callnumber
532
              columnname: subscription_callnumber
533
533
534
      comments-table:
535
          columns:
536
              -
537
                columnname: patron
538
              -
539
                columnname: date
540
              -
541
                columnname: status
542
              -
543
                columnname: comment
544
              -
545
                columnname: actions
546
                cannot_be_toggled: 1
547
                cannot_be_modified: 1
548
534
      checkoutshistory-table:
549
      checkoutshistory-table:
535
        default_display_length: 20
550
        default_display_length: 20
536
        columns:
551
        columns:
(-)a/catalogue/detail.pl (-1 / +38 lines)
Lines 57-62 use Koha::Patrons; Link Here
57
use Koha::Virtualshelves;
57
use Koha::Virtualshelves;
58
use Koha::Plugins;
58
use Koha::Plugins;
59
use Koha::Recalls;
59
use Koha::Recalls;
60
use Koha::Reviews;
60
use Koha::SearchEngine::Search;
61
use Koha::SearchEngine::Search;
61
use Koha::SearchEngine::QueryBuilder;
62
use Koha::SearchEngine::QueryBuilder;
62
use Koha::Serial::Items;
63
use Koha::Serial::Items;
Lines 85-94 if ( C4::Context->config('enable_plugins') ) { Link Here
85
    );
86
    );
86
}
87
}
87
88
89
my $activetab    = $query->param('activetab');
88
my $biblionumber = $query->param('biblionumber');
90
my $biblionumber = $query->param('biblionumber');
89
$biblionumber = HTML::Entities::encode($biblionumber);
91
$biblionumber = HTML::Entities::encode($biblionumber);
90
my $biblio = Koha::Biblios->find( $biblionumber );
92
my $biblio = Koha::Biblios->find( $biblionumber );
91
$template->param( 'biblio', $biblio );
93
94
$template->param(
95
    biblio    => $biblio,
96
    activetab => $activetab,
97
);
92
98
93
unless ( $biblio ) {
99
unless ( $biblio ) {
94
    # biblionumber invalid -> report and exit
100
    # biblionumber invalid -> report and exit
Lines 382-387 if (C4::Context->preference("AlternateHoldingsField") && $items_to_display->coun Link Here
382
        );
388
        );
383
}
389
}
384
390
391
if ( C4::Context->preference('OPACComments') ) {
392
    my $reviews = Koha::Reviews->search(
393
        { biblionumber => $biblionumber },
394
        { order_by     => { -desc => 'datereviewed' } }
395
    )->unblessed;
396
    my $libravatar_enabled = 0;
397
    if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto') ) {
398
        eval {
399
            require Libravatar::URL;
400
            Libravatar::URL->import();
401
        };
402
        if ( !$@ ) {
403
            $libravatar_enabled = 1;
404
        }
405
    }
406
    for my $review (@$reviews) {
407
        my $review_patron =
408
            Koha::Patrons->find( $review->{borrowernumber} );    # FIXME Should be Koha::Review->reviewer or similar
409
410
        # setting some borrower info into this hash
411
        if ($review_patron) {
412
            $review->{patron} = $review_patron;
413
            if ( $libravatar_enabled and $review_patron->email ) {
414
                $review->{avatarurl} = libravatar_url( email => $review_patron->email, https => $ENV{HTTPS} );
415
            }
416
        }
417
    }
418
    $template->param( 'reviews' => $reviews );
419
420
}
421
385
my @results = ( $dat, );
422
my @results = ( $dat, );
386
foreach ( keys %{$dat} ) {
423
foreach ( keys %{$dat} ) {
387
    $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
424
    $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+9 lines)
Lines 2817-2822 fieldset > .toptabs { Link Here
2817
    font-style: italic;
2817
    font-style: italic;
2818
}
2818
}
2819
2819
2820
.commentline {
2821
    border-bottom: 1px solid #CCC;
2822
2823
    .btn-toolbar {
2824
        margin-bottom: 0;
2825
        margin-left: 0;
2826
    }
2827
}
2828
2820
.contents {
2829
.contents {
2821
    width: 75%;
2830
    width: 75%;
2822
2831
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-3 / +99 lines)
Lines 51-57 Link Here
51
[% END %]
51
[% END %]
52
52
53
<body id="catalog_detail" class="catalog">
53
<body id="catalog_detail" class="catalog">
54
55
    [% WRAPPER 'header.inc' %]
54
    [% WRAPPER 'header.inc' %]
56
        [% INCLUDE 'cat-search.inc' %]
55
        [% INCLUDE 'cat-search.inc' %]
57
    [% END %]
56
    [% END %]
Lines 384-389 Link Here
384
                                [% END %]
383
                                [% END %]
385
                            [% END %]
384
                            [% END %]
386
385
386
                            [% IF ( reviews ) %]
387
                                [% WRAPPER tab_item tabname= "comments" %]
388
                                    <span>Comments [% ' ( ' _ ( reviews.size ) _ ' )' | html %]</span>
389
                                [% END %]
390
                            [% END %]
391
387
                            [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
392
                            [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
388
                                [% WRAPPER tab_item tabname= "NovelistSelect" %]
393
                                [% WRAPPER tab_item tabname= "NovelistSelect" %]
389
                                    <span>NoveList Select</span>
394
                                    <span>NoveList Select</span>
Lines 840-845 Link Here
840
                                [% END # /tab_panel %]
845
                                [% END # /tab_panel %]
841
                            [% END # /IF HTML5MediaEnabled %]
846
                            [% END # /IF HTML5MediaEnabled %]
842
847
848
                            [% IF ( reviews ) %]
849
                                [% WRAPPER tab_panel tabname="comments" %]
850
                                    [% SET ShowReviewerPhoto = Koha.Preference( "ShowReviewerPhoto" ) %]
851
                                    <table id="comments_table">
852
                                        <thead>
853
                                            <tr>
854
                                                <th>Commenter</th>
855
                                                <th>Date</th>
856
                                                <th>Status</th>
857
                                                <th>Comment</th>
858
                                                <th class="NoSort">Actions</th>
859
                                            </tr>
860
                                        </thead>
861
                                        <tbody>
862
                                            [% FOREACH review IN reviews %]
863
                                                <tr id="comment[% review.reviewid | html %]">
864
                                                    <td>
865
                                                        [% IF ( review.patron ) %]
866
                                                            [% IF ( review.avatarurl ) %]
867
                                                                <img class="avatar" src="[% review.avatarurl | html %]" height="80" width="80" alt="" />
868
                                                            [% END %]
869
                                                            [% INCLUDE 'patron-title.inc' patron=review.patron hide_patron_infos_if_needed=1 %]
870
                                                        [% ELSE %]
871
                                                            <em>Patron deleted<em>
872
                                                        [% END %]
873
                                                    </td>
874
                                                    <td data-order="[% review.datereviewed | html %]">
875
                                                        [% review.datereviewed | $KohaDates %]
876
                                                    </td>
877
                                                    <td>
878
                                                        [% IF ( review.approved ) %]
879
                                                            <em>Approved</em>
880
                                                        [% ELSE %]
881
                                                            <em>Unapproved</em>
882
                                                        [% END %]
883
                                                    </td>
884
                                                    <td>
885
                                                        [% FILTER html_break %]
886
                                                            [% review.review | html %]
887
                                                        [% END %]
888
                                                    </td>
889
                                                    [% IF ( CAN_user_tools_moderate_comments ) %]
890
                                                        <td class="actions">
891
                                                            [% IF ( review.approved ) %]
892
                                                                <form action="/cgi-bin/koha/reviews/reviewswaiting.pl" method="post">
893
                                                                    [% INCLUDE 'csrf-token.inc' %]
894
                                                                    <input type="hidden" name="op" value="cud-unapprove" />
895
                                                                    <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
896
                                                                    <input type="hidden" name="reviewid" value="[% review.reviewid | html %]" />
897
                                                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-times" aria-hidden="true"></i> Unapprove</button>
898
                                                                </form>
899
                                                            [% ELSE %]
900
                                                                <form action="/cgi-bin/koha/reviews/reviewswaiting.pl" method="post">
901
                                                                    [% INCLUDE 'csrf-token.inc' %]
902
                                                                    <input type="hidden" name="op" value="cud-approve" />
903
                                                                    <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
904
                                                                    <input type="hidden" name="reviewid" value="[% review.reviewid | html %]" />
905
                                                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-check" aria-hidden="true"></i> Approve</button>
906
                                                                </form>
907
                                                            [% END %]
908
                                                            <form action="/cgi-bin/koha/reviews/reviewswaiting.pl" method="post">
909
                                                                [% INCLUDE 'csrf-token.inc' %]
910
                                                                <input type="hidden" name="op" value="cud-delete" />
911
                                                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
912
                                                                <input type="hidden" name="reviewid" value="[% review.reviewid | html %]" />
913
                                                                <button type="submit" class="btn btn-default btn-xs delete-comment"><i class="fa fa-trash-can" aria-hidden="true"></i> Delete</button>
914
                                                            </form>
915
                                                        </td>
916
                                                    [% END # /IF CAN_user_tools_moderate_comments %]
917
                                                </tr>
918
                                            [% END # / FOREACH reviews %]
919
                                        </tbody>
920
                                    </table>
921
                                [% END %]
922
                            [% END # /IF reviews %]
923
843
                            [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
924
                            [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
844
                                [% WRAPPER tab_panel tabname="NovelistSelect" %]
925
                                [% WRAPPER tab_panel tabname="NovelistSelect" %]
845
                                    <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
926
                                    <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
Lines 850-856 Link Here
850
                                [% WRAPPER tab_panel tabname="${ plugins_intranet_catalog_biblio_tab.id }" %]
931
                                [% WRAPPER tab_panel tabname="${ plugins_intranet_catalog_biblio_tab.id }" %]
851
                                    [% plugins_intranet_catalog_biblio_tab.content | $raw %]
932
                                    [% plugins_intranet_catalog_biblio_tab.content | $raw %]
852
                                [% END # /tab_panel %]
933
                                [% END # /tab_panel %]
853
                            [% END %]
934
                            [% END # /WRAPPER comments %]
854
                        [% END # /WRAPPER tab_panels %]
935
                        [% END # /WRAPPER tab_panels %]
855
                    [% END # /WRAPPER tabs %]
936
                    [% END # /WRAPPER tabs %]
856
937
Lines 1439-1445 Link Here
1439
1520
1440
        $(document).ready(function() {
1521
        $(document).ready(function() {
1441
            // Pick details tab to display by default
1522
            // Pick details tab to display by default
1442
            [% IF count == 0 %]
1523
            [% IF activetab == "comments" %]
1524
                $("#bibliodetails a[href='#comments_panel']").tab("show");
1525
            [% ELSIF count == 0 %]
1443
                [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
1526
                [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
1444
                    $("#bibliodetails a[href='#html5media_panel']").tab("show");
1527
                    $("#bibliodetails a[href='#html5media_panel']").tab("show");
1445
                [% ELSIF ComponentParts && ComponentParts.size %]
1528
                [% ELSIF ComponentParts && ComponentParts.size %]
Lines 1925-1930 Link Here
1925
                }));
2008
                }));
1926
            [% END %]
2009
            [% END %]
1927
2010
2011
            [% IF ( reviews ) %]
2012
                var comment_table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'comments-table', 'json') | $raw %];
2013
                var comments_table = KohaTable("comments_table", {
2014
                    "paginate": false,
2015
                    "autoWidth": false,
2016
                    "order": [[ 2, "desc" ]],
2017
                }, comment_table_settings);
2018
            [% END %]
1928
        });
2019
        });
1929
2020
1930
        [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2021
        [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
Lines 2174-2181 Link Here
2174
2265
2175
                $('#modal-item-group-unset').modal('hide');
2266
                $('#modal-item-group-unset').modal('hide');
2176
            });
2267
            });
2268
2177
        [% END # /IF EnableItemGroups %]
2269
        [% END # /IF EnableItemGroups %]
2178
2270
2271
        $(".delete-comment").on("click", function(){
2272
            return confirm( _("Are you sure you want to delete this comment?") );
2273
        });
2274
2179
    </script>
2275
    </script>
2180
2276
2181
    [%# The following PROCESS needs: %]
2277
    [%# The following PROCESS needs: %]
(-)a/reviews/reviewswaiting.pl (-1 / +6 lines)
Lines 41-46 my $reviewid = $query->param('reviewid'); Link Here
41
my $page     = $query->param('page') || 1;
41
my $page     = $query->param('page') || 1;
42
my $count    = C4::Context->preference('numSearchResults') || 20;
42
my $count    = C4::Context->preference('numSearchResults') || 20;
43
my $total    = Koha::Reviews->search_limited({ approved => $status })->count;
43
my $total    = Koha::Reviews->search_limited({ approved => $status })->count;
44
my $biblionumber = $query->param('biblionumber');
44
45
45
if ( $op eq 'cud-approve' ) {
46
if ( $op eq 'cud-approve' ) {
46
    my $review = Koha::Reviews->find( $reviewid );
47
    my $review = Koha::Reviews->find( $reviewid );
Lines 55-60 elsif ( $op eq 'cud-delete' ) { Link Here
55
    $review->delete if $review;
56
    $review->delete if $review;
56
}
57
}
57
58
59
if ( $op && $biblionumber ) {
60
    print scalar $query->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&activetab=comments");
61
    exit;    # You can only send 1 redirect!  After that, content or other headers don't matter.
62
}
63
58
my $reviews = Koha::Reviews->search_limited(
64
my $reviews = Koha::Reviews->search_limited(
59
    { approved => $status },
65
    { approved => $status },
60
    {
66
    {
61
- 

Return to bug 2486