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

(-)a/Koha/Biblio.pm (+15 lines)
Lines 35-40 use Koha::ArticleRequests; Link Here
35
use Koha::Biblio::Metadatas;
35
use Koha::Biblio::Metadatas;
36
use Koha::Biblio::ItemGroups;
36
use Koha::Biblio::ItemGroups;
37
use Koha::Biblioitems;
37
use Koha::Biblioitems;
38
use Koha::Catalog::Concerns;
38
use Koha::Checkouts;
39
use Koha::Checkouts;
39
use Koha::CirculationRules;
40
use Koha::CirculationRules;
40
use Koha::Item::Transfer::Limits;
41
use Koha::Item::Transfer::Limits;
Lines 119-124 sub active_orders { Link Here
119
    return $self->orders->search({ datecancellationprinted => undef });
120
    return $self->orders->search({ datecancellationprinted => undef });
120
}
121
}
121
122
123
=head3 concerns
124
125
  my $concerns = $biblio->concerns();
126
127
Returns all concerns linked to the biblio
128
129
=cut
130
131
sub concerns {
132
    my ( $self ) = @_;
133
    my $rs = $self->_result->catalog_concerns;
134
    return Koha::Catalog::Concerns->_new_from_dbic( $rs );
135
}
136
122
=head3 item_groups
137
=head3 item_groups
123
138
124
my $item_groups = $biblio->item_groups();
139
my $item_groups = $biblio->item_groups();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +170 lines)
Lines 299-304 Link Here
299
[% IF Koha.Preference('AcquisitionDetails') %]<li role="presentation"><a href="#acq_details"  aria-controls="acq_details" role="tab" data-toggle="tab">Acquisition details</a></li>[% END %]
299
[% IF Koha.Preference('AcquisitionDetails') %]<li role="presentation"><a href="#acq_details"  aria-controls="acq_details" role="tab" data-toggle="tab">Acquisition details</a></li>[% END %]
300
[% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
300
[% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
301
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
301
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
302
[% IF ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) %]<li role="presentation"><a href="#concerns" aria-controls="concerns" role="tab" data-toggle="tab">Concerns ([% biblio.concerns.count | html %])</a></li>[% END %]
302
[% IF ( LocalCoverImages ) %]
303
[% IF ( LocalCoverImages ) %]
303
    <li role="presentation">
304
    <li role="presentation">
304
        <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
305
        <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
Lines 1000-1005 Note that permanent location is a code, and location may be an authval. Link Here
1000
</table></div>[% END %]
1001
</table></div>[% END %]
1001
[% END %]
1002
[% END %]
1002
1003
1004
[% IF ( Koha.Prefernce('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) %]
1005
<div role="tabpanel" class="tab-pane" id="concerns">
1006
    <fieldset class="action" style="cursor:pointer;">
1007
        <a id="hideResolved"><i class="fa fa-minus-square"></i> Hide resolved</a>
1008
        | <a id="showAll"><i class="fa fa-bars"></i> Show all</a>
1009
    </fieldset>
1010
1011
    <table id="table_concerns" width="100%">
1012
        <thead>
1013
            <tr>
1014
                <th>Reported</th>
1015
                <th>Details</th>
1016
                <th>Status</th>
1017
                <th data-class-name="actions noExport">Actions</th>
1018
            </tr>
1019
        </thead>
1020
    </table>
1021
1022
    <!-- Resolve concern modal -->
1023
    <div class="modal" id="resolveConcernModal" tabindex="-1" role="dialog" aria-labelledby="resolveConcernLabel">
1024
        <div class="modal-dialog" role="document">
1025
            <div class="modal-content">
1026
                <div class="modal-header">
1027
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
1028
                    <h4 class="modal-title" id="resolveConcernLabel">Resolve concern</h4>
1029
                </div>
1030
                <div class="modal-body">
1031
                    <fieldset class="rows">
1032
                        <ol>
1033
                            <li>
1034
                                <label for="notify">Notify: </label>
1035
                                <input type="checkbox" name="notify" id="resolve_notify">
1036
                            </li>
1037
                            <li>
1038
                                <label for="message">Resolution: </label>
1039
                                <textarea id="resolve_message" name="message"></textarea>
1040
                                <p id="helpBlock" class="help-block">Optional message to include with the notification to the reporter</p>
1041
1042
                            </li>
1043
                        </ol>
1044
                    </fieldset>
1045
                </div> <!-- /.modal-body -->
1046
                <div class="modal-footer">
1047
                    <input type="hidden" name="concern_id" id="concern_id">
1048
                    <button type="submit" class="btn btn-default" id="resolveConfirm">Confirm</button>
1049
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
1050
                </div> <!-- /.modal-footer -->
1051
            </div> <!-- /.modal-content -->
1052
        </div> <!-- /.modal-dialog -->
1053
    </div> <!-- /#resolveConcernModal -->
1054
</div>
1055
[% END %]
1056
1003
[% IF ( LocalCoverImages ) %]
1057
[% IF ( LocalCoverImages ) %]
1004
    <div role="tabpanel" class="tab-pane" id="images">
1058
    <div role="tabpanel" class="tab-pane" id="images">
1005
        [% IF localimages.count %]
1059
        [% IF localimages.count %]
Lines 1313-1318 Note that permanent location is a code, and location may be an authval. Link Here
1313
        <script>
1367
        <script>
1314
            /* Set a variable needed by add_catalog_concern.js */
1368
            /* Set a variable needed by add_catalog_concern.js */
1315
            var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1369
            var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1370
1371
            $(document).ready(function() {
1372
                var table_settings = [% TablesSettings.GetTableSettings( 'cataloguing', 'concerns', 'table_concerns', 'json' ) | $raw %];
1373
1374
                var concerns_url = '/api/v1/catalog/concerns';
1375
                var concerns = $("#table_concerns").kohaTable({
1376
                    "ajax": {
1377
                        "url": concerns_url
1378
                    },
1379
                    "embed": [
1380
                        "reporter",
1381
                        "resolver",
1382
                    ],
1383
                    'emptyTable': '<div class="dialog message">'+_("Congradulations, there are no catalog concerns.")+'</div>',
1384
                    "columnDefs": [ {
1385
                        "targets": [0,1,2],
1386
                        "render": function (data, type, row, meta) {
1387
                            if ( type == 'display' ) {
1388
                                if ( data != null ) {
1389
                                    return data.escapeHtml();
1390
                                }
1391
                                else {
1392
                                    return "";
1393
                                }
1394
                            }
1395
                            return data;
1396
                        }
1397
                    } ],
1398
                    "columns": [
1399
                        {
1400
                            "data": "reported_date:reporter.firstname",
1401
                            "render": function(data, type, row, meta) {
1402
                                let reported = '<span class="date clearfix">'+$datetime(row.reported_date)+'</span>';
1403
                                reported += '<span class="reporter clearfix">'+$patron_to_html( row.reporter, { display_cardnumber: false, url: true } )+'</span>';
1404
                                return reported;
1405
                            },
1406
                            "searchable": true,
1407
                            "orderable": true
1408
                        },
1409
                        {
1410
                            "data": "message:resolution_message",
1411
                            "render": function(data, type, row, meta) {
1412
                                let result = '<span class="clearfix">'+row.message+'</span>';
1413
                                if ( row.resolution_message ) {
1414
                                    result += '<span class="clearfix">'+_('Resolution: %s').format(row.resolution_message)+'</spani>';
1415
                                }
1416
                                return result;
1417
                            },
1418
                            "searchable": true,
1419
                            "orderable": true
1420
                        },
1421
                        {
1422
                            "data": "resolved_date",
1423
                            "render": function(data, type, row, meta) {
1424
                                let result = '';
1425
                                if ( row.resolved_date ) {
1426
                                    result += _("Resolved by:")+' <span>'+$patron_to_html( row.resolver, { display_cardnumber: false, url: true } )+'</span>';
1427
                                    result += '<span class="clearfix">'+$datetime(row.resolved_date)+'</span>';
1428
                                } else {
1429
                                    result += _("Open");
1430
                                }
1431
                                return result;
1432
                            },
1433
                            "searchable": true,
1434
                            "orderable": true
1435
                        },
1436
                        {
1437
                            "data": function( row, type, val, meta ) {
1438
                                let result = '';
1439
                                if ( !row.resolved_date ) {
1440
                                    result += '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#resolveConcernModal" data-concern="'+ encodeURIComponent(row.concern_id) +'"><i class="fa fa-check" aria-hidden="true"></i> '+_("Resolve")+'</a>';
1441
                                }
1442
                                return result;
1443
                            },
1444
                            "searchable": false,
1445
                            "orderable": false
1446
                        },
1447
                    ]
1448
                }, table_settings, 0, { biblio_id: [% biblionumber | uri %]});
1449
1450
                $('#hideResolved').on( "click", function() {
1451
                    // It would be great if we could pass null here but it gets stringified
1452
                    concerns.DataTable().columns('3').search('special:undefined').draw();
1453
                });
1454
1455
                $('#showAll').on( "click", function() {
1456
                    concerns.DataTable().columns('3').search('').draw();
1457
                });
1458
1459
                $('#resolveConcernModal').on('show.bs.modal', function (event) {
1460
                      let modal = $(this);
1461
                      let button = $(event.relatedTarget);
1462
                      let concern = button.data('concern');
1463
1464
                      modal.find('.modal-footer input').val(concern)
1465
                });
1466
1467
                $('#resolveConcernModal').on('click', '#resolveConfirm', function(e) {
1468
                    let concern_id = $('#concern_id').val();
1469
                    let params = { notify: $('#resolve_notify').is(":checked"), message: $('#resolve_message').val() };
1470
1471
                    $.ajax({
1472
                        url: "/api/v1/catalog/concerns/"+concern_id+"/resolve",
1473
                        method: "POST",
1474
                        data: JSON.stringify(params)
1475
                    }).success(function() {
1476
                        $("#resolveConcernModal").modal('hide');
1477
                        concerns.DataTable().ajax.reload(function (data) {
1478
                            $("#concern_action_result_dialog").hide();
1479
                            $("#concern_delete_success").html(_("Concern #%s deleted successfully.").format(concern_id)).show();
1480
                        });
1481
                    }).error(function () {
1482
                        $("#concern_resolve_error").html(_("Error resolving concern #%s. Check the logs.").format(concern_id)).show();
1483
                    });
1484
                });
1485
            });
1316
        </script>
1486
        </script>
1317
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1487
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1318
    [% END %]
1488
    [% END %]
1319
- 

Return to bug 31028