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

(-)a/cataloguing/concerns.pl (+37 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use CGI qw ( -utf8 );
21
use C4::Context;
22
use C4::Auth qw( get_template_and_user );
23
use C4::Output qw( output_html_with_http_headers );
24
25
my $query = CGI->new;
26
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
27
    {
28
        template_name   => "cataloguing/concerns.tt",
29
        query           => $query,
30
        type            => "intranet",
31
        flagsrequired   => { cataloguing => '*' },
32
    }
33
);
34
35
output_html_with_http_headers $query, $cookie, $template->output;
36
37
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt (+229 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% USE TablesSettings %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>
7
    Concerns &rsaquo; Cataloging &rsaquo; Koha
8
</title>
9
[% INCLUDE 'doc-head-close.inc' %]
10
</head>
11
12
<body id="cat_concerns" class="cat">
13
    [% INCLUDE 'header.inc' %]
14
    [% INCLUDE 'cataloging-search.inc' %]
15
16
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17
        <ol>
18
            <li>
19
                <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20
            </li>
21
            <li>
22
                <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
23
            </li>
24
            <li>
25
                <a href="#" aria-current="page">
26
                    Concerns
27
                </a>
28
            </li>
29
        </ol>
30
    </nav>
31
32
    <div class="main container-fluid">
33
        <div class="row">
34
            <div class="col-sm-10 col-sm-push-2">
35
                <main>
36
                    <div id="toolbar" class="btn-toolbar">
37
                        <a class="btn btn-default" id="newconcern" role="button" href="#" data-toggle="modal" data-target="#addConcernModal"><i class="fa fa-plus"></i> New concern</a>
38
                    </div>
39
40
                    <h1>Concerns</h1>
41
42
                    <div class="table_concerns_table_controls"></div>
43
                    <table id="table_concerns">
44
                        <thead>
45
                            <tr>
46
                                <th>Reported</th>
47
                                <th>Concern</th>
48
                                <th>Title</th>
49
                                <th>Status</th>
50
                                <th data-class-name="actions noExport">Actions</th>
51
                            </tr>
52
                        </thead>
53
                    </table>
54
                </main>
55
            </div> <!-- /.col-sm-10.col-sm-push-2 -->
56
57
            <div class="col-sm-2 col-sm-pull-10">
58
                <aside>
59
                    [% INCLUDE 'cat-menu.inc' %]
60
                </aside>
61
            </div> <!-- /.col-sm-2.col-sm-pull-10 -->
62
        </div> <!-- /.row -->
63
64
        <!-- Add concern modal -->
65
        <div class="modal" id="addConcernModal" tabindex="-1" role="dialog" aria-labelledby="addConcernLabel">
66
            <div class="modal-dialog" role="document">
67
                <div class="modal-content">
68
                    <div class="modal-header">
69
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
70
                        <h4 class="modal-title" id="addConcernLabel">Add concern</h4>
71
                    </div>
72
                    <div class="modal-body">
73
                        <fieldset class="rows">
74
                            <ol>
75
                                <li>
76
                                    <label class="required" for="biblio_id">Biblio: </label>
77
                                    <input type="text" name="biblio_id" id="biblio_add">
78
                                    <span class="required">Required</span>
79
                                </li>
80
                                <li>
81
                                    <label class="required" for="message">Please describe your concern: </label>
82
                                    <textarea id="message_add" name="message" required="required"></textarea>
83
                                    <span class="required">Required</span>
84
                                    <p id="helpBlock" class="help-block">A short summary of what the library policy is for dealing with such concerns and what constitutes a valid concern</p>
85
                                </li>
86
                            </ol>
87
                        </fieldset>
88
                    </div> <!-- /.modal-body -->
89
                    <div class="modal-footer">
90
                        <button type="submit" class="btn btn-default" id="addConfirm">Confirm</button>
91
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
92
                    </div> <!-- /.modal-footer -->
93
                </div> <!-- /.modal-content -->
94
            </div> <!-- /.modal-dialog -->
95
        </div> <!-- /#addConcernModal -->
96
97
[% MACRO jsinclude BLOCK %]
98
    [% INCLUDE 'datatables.inc' %]
99
    [% INCLUDE 'columns_settings.inc' %]
100
    [% INCLUDE 'js-date-format.inc' %]
101
    [% INCLUDE 'js-patron-format.inc' %]
102
    [% INCLUDE 'js-biblio-format.inc' %]
103
    <script>
104
        $(document).ready(function() {
105
106
            var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
107
108
            var concerns_url = '/api/v1/catalog/concerns';
109
            var concerns = $("#table_concerns").kohaTable({
110
                "ajax": {
111
                    "url": concerns_url
112
                },
113
                "embed": [
114
                    "reporter",
115
                    "resolver",
116
                    "biblio"
117
                ],
118
                'emptyTable': '<div class="dialog message">'+_("Congradulations, there are no catalog concerns.")+'</div>',
119
                "columnDefs": [ {
120
                    "targets": [0,1,2,3],
121
                    "render": function (data, type, row, meta) {
122
                        if ( type == 'display' ) {
123
                            if ( data != null ) {
124
                                return data.escapeHtml();
125
                            }
126
                            else {
127
                                return "";
128
                            }
129
                        }
130
                        return data;
131
                    }
132
                } ],
133
                "columns": [
134
                    {
135
                        "data": "reported_date:reporter.firstname",
136
                        "render": function(data, type, row, meta) {
137
                            let reported = '<span class="date clearfix">'+$datetime(row.reported_date)+'</span>';
138
                            reported += '<span class="reporter clearfix">'+$patron_to_html( row.reporter, { display_cardnumber: false, url: true } )+'</span>';
139
                            return reported;
140
                        },
141
                        "searchable": true,
142
                        "orderable": true
143
                    },
144
                    {
145
                        "data": "message",
146
                        "searchable": true,
147
                        "orderable": true
148
                    },
149
                    {
150
                        "data": "biblio.title",
151
                        "render": function(data, type, row, meta) {
152
                            return $biblio_to_html(row.biblio, { link: 1 });
153
                        },
154
                        "searchable": true,
155
                        "orderable": true
156
                    },
157
                    {
158
                        "data": "resolved_date",
159
                        "render": function(data, type, row, meta) {
160
                            let result = '';
161
                            if ( row.resolved_date ) {
162
                                result += _("Resolved by:")+' <span>'+$patron_to_html( row.resolver, { display_cardnumber: false, url: true } )+'</span>';
163
                                result += '<span class="clearfix">'+$datetime(row.resolved_date)+'</span>';
164
                            } else {
165
                                result += _("Open");
166
                            }
167
                            return result;
168
                        },
169
                        "searchable": true,
170
                        "orderable": true
171
                    },
172
                    {
173
                        "data": function( row, type, val, meta ) {
174
                            var result = '<a class="btn btn-default btn-xs" role="button" class="resolve_concern" data-concern-id="'+ encodeURIComponent(row.concern_id) +'"><i class="fa fa-check" aria-hidden="true"></i> '+_("Resolve")+'</a>';
175
                            return result;
176
                        },
177
                        "searchable": false,
178
                        "orderable": false
179
                    },
180
                ]
181
            });
182
183
            $('#table_concerns').on( "click", '.resolve_concern', function () {
184
                var concern_id   = decodeURIComponent($(this).data('concern-id'));
185
186
                $("#delete_confirm_modal_button").unbind("click").on( "click", function () {
187
                    $.ajax({
188
                        method: "PUT",
189
                        url: "/api/v1/catalog/concerns/"+concern_id
190
                    }).success(function() {
191
                        $("#delete_confirm_modal").modal('hide');
192
                        concerns.api().ajax.reload(function (data) {
193
                            $("#concern_action_result_dialog").hide();
194
                            $("#concern_delete_success").html(_("Concern #%s deleted successfully.").format(concern_id)).show();
195
                        });
196
                    }).error(function () {
197
                        $("#concern_delete_error").html(_("Error deleting concern #%s. Check the logs.").format(concern_id)).show();
198
                    });
199
                });
200
            });
201
202
            $('#addConcernModal').on('click', '#addConfirm', function(e) {
203
                let biblio_id = $('#biblio_add').val();
204
                let message = $('#message_add').val();
205
206
                params = {
207
                    message: message,
208
                    biblio_id: biblio_id,
209
                    reporter_id: logged_in_user_borrowernumber,
210
                };
211
212
                $.ajax({
213
                    url: '/api/v1/catalog/concerns',
214
                    type: 'POST',
215
                    data: JSON.stringify(params),
216
                    success: function(data) {
217
                        $('#AddConcernModal').modal('hide');
218
219
                        if ( $.fn.dataTable.isDataTable("#table_concerns") ) {
220
                            $("#table_concerns").DataTable().ajax.reload();
221
                        }
222
                    },
223
                    contentType: "json"
224
                });
225
            });
226
        });
227
    </script>
228
[% END %]
229
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-1 / +8 lines)
Lines 166-172 Link Here
166
                <div class="row">
166
                <div class="row">
167
                    <div class="col-sm-12">
167
                    <div class="col-sm-12">
168
                        [%# Following statement must be in one line for translatability %]
168
                        [%# Following statement must be in one line for translatability %]
169
                        [% IF ( CAN_user_tools_moderate_comments  && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_suggestions_suggestions_manage && ( pendingsuggestions || all_pendingsuggestions )) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || new_curbside_pickups.count %]
169
                        [% IF ( CAN_user_tools_moderate_comments  && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_suggestions_suggestions_manage && ( pendingsuggestions || all_pendingsuggestions )) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) || ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && pending_catalog_concerns && CAN_user_editcatalogue_edit_catalogue ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || new_curbside_pickups.count %]
170
                            <div id="area-pending">
170
                            <div id="area-pending">
171
                                [% IF pending_article_requests %]
171
                                [% IF pending_article_requests %]
172
                                <div class="pending-info" id="article_requests_pending">
172
                                <div class="pending-info" id="article_requests_pending">
Lines 221-226 Link Here
221
                                </div>
221
                                </div>
222
                                [% END %]
222
                                [% END %]
223
223
224
                                [% IF ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue %]
225
                                <div class="pending-info" id="catalog_concerns_pending">
226
                                    <a href="/cgi-bin/koha/cataloguing/concerns.pl">Catalog concerns pending</a>:
227
                                    <span class="pending-number-link">[% pending_catalog_concerns | html %]</span>
228
                                </div>
229
                                [% END %]
230
224
                                [% IF Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count %]
231
                                [% IF Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count %]
225
                                    <div class="pending-info" id="checkout_notes_pending">
232
                                    <div class="pending-info" id="checkout_notes_pending">
226
                                        <a href="/cgi-bin/koha/circ/checkout-notes.pl">Checkout notes pending</a>:
233
                                        <a href="/cgi-bin/koha/circ/checkout-notes.pl">Checkout notes pending</a>:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (+5 lines)
Lines 224-229 Link Here
224
    <dd>Perform inventory of your catalog</dd>
224
    <dd>Perform inventory of your catalog</dd>
225
    [% END %]
225
    [% END %]
226
226
227
    [% IF ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue %]
228
    <dt><a href="/cgi-bin/koha/cataloguing/concerns.pl">Catalog concerns</a></dt>
229
    <dd>Manage catalog concern reports</dd>
230
    [% END %]
231
227
    [% IF ( CAN_user_tools_label_creator ) %]
232
    [% IF ( CAN_user_tools_label_creator ) %]
228
    <dt><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></dt>
233
    <dt><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></dt>
229
    <dd>Create printable labels and barcodes from catalog data</dd>
234
    <dd>Create printable labels and barcodes from catalog data</dd>
(-)a/mainpage.pl (-1 / +6 lines)
Lines 31-36 use Koha::Patron::Discharge; Link Here
31
use Koha::Reviews;
31
use Koha::Reviews;
32
use Koha::ArticleRequests;
32
use Koha::ArticleRequests;
33
use Koha::ProblemReports;
33
use Koha::ProblemReports;
34
use Koha::Catalog::Concerns;
34
use Koha::Quotes;
35
use Koha::Quotes;
35
use Koha::Suggestions;
36
use Koha::Suggestions;
36
use Koha::BackgroundJobs;
37
use Koha::BackgroundJobs;
Lines 103-108 my $pending_article_requests = Koha::ArticleRequests->search_limited( Link Here
103
)->count;
104
)->count;
104
my $pending_problem_reports = Koha::ProblemReports->search({ status => 'New' });
105
my $pending_problem_reports = Koha::ProblemReports->search({ status => 'New' });
105
106
107
if ( C4::Context->preference('CatalogConcerns') || C4::Context->preference('OpacCatalogConcerns') ) {
108
    my $concerns = Koha::Catalog::Concerns->search({ resolved_date => undef });
109
    $template->param( pending_catalog_concerns => $concerns->count );
110
}
111
106
unless ( $logged_in_user->has_permission( { parameters => 'manage_background_jobs' } ) ) {
112
unless ( $logged_in_user->has_permission( { parameters => 'manage_background_jobs' } ) ) {
107
    my $already_ran_jobs = Koha::BackgroundJobs->search(
113
    my $already_ran_jobs = Koha::BackgroundJobs->search(
108
        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;
114
        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;
109
- 

Return to bug 31028