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 294-299 Link Here
294
[% 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 %]
294
[% 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 %]
295
[% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
295
[% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
296
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
296
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
297
[% 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 %]
297
[% IF ( LocalCoverImages ) %]
298
[% IF ( LocalCoverImages ) %]
298
    <li role="presentation">
299
    <li role="presentation">
299
        <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
300
        <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
Lines 995-1000 Note that permanent location is a code, and location may be an authval. Link Here
995
</table></div>[% END %]
996
</table></div>[% END %]
996
[% END %]
997
[% END %]
997
998
999
[% IF ( Koha.Prefernce('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) %]
1000
<div role="tabpanel" class="tab-pane" id="concerns">
1001
    <fieldset class="action" style="cursor:pointer;">
1002
        <a id="hideResolved"><i class="fa fa-minus-square"></i> Hide resolved</a>
1003
        | <a id="showAll"><i class="fa fa-bars"></i> Show all</a>
1004
    </fieldset>
1005
1006
    <table id="table_concerns" width="100%">
1007
        <thead>
1008
            <tr>
1009
                <th>Reported</th>
1010
                <th>Details</th>
1011
                <th>Status</th>
1012
                <th data-class-name="actions noExport">Actions</th>
1013
            </tr>
1014
        </thead>
1015
    </table>
1016
1017
    <!-- Resolve concern modal -->
1018
    <div class="modal" id="resolveConcernModal" tabindex="-1" role="dialog" aria-labelledby="resolveConcernLabel">
1019
        <div class="modal-dialog" role="document">
1020
            <div class="modal-content">
1021
                <div class="modal-header">
1022
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
1023
                    <h4 class="modal-title" id="resolveConcernLabel">Resolve concern</h4>
1024
                </div>
1025
                <div class="modal-body">
1026
                    <fieldset class="rows">
1027
                        <ol>
1028
                            <li>
1029
                                <label for="notify">Notify: </label>
1030
                                <input type="checkbox" name="notify" id="resolve_notify">
1031
                            </li>
1032
                            <li>
1033
                                <label for="message">Resolution: </label>
1034
                                <textarea id="resolve_message" name="message"></textarea>
1035
                                <p id="helpBlock" class="help-block">Optional message to include with the notification to the reporter</p>
1036
1037
                            </li>
1038
                        </ol>
1039
                    </fieldset>
1040
                </div> <!-- /.modal-body -->
1041
                <div class="modal-footer">
1042
                    <input type="hidden" name="concern_id" id="concern_id">
1043
                    <button type="submit" class="btn btn-default" id="resolveConfirm">Confirm</button>
1044
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
1045
                </div> <!-- /.modal-footer -->
1046
            </div> <!-- /.modal-content -->
1047
        </div> <!-- /.modal-dialog -->
1048
    </div> <!-- /#resolveConcernModal -->
1049
</div>
1050
[% END %]
1051
998
[% IF ( LocalCoverImages ) %]
1052
[% IF ( LocalCoverImages ) %]
999
    <div role="tabpanel" class="tab-pane" id="images">
1053
    <div role="tabpanel" class="tab-pane" id="images">
1000
        [% IF localimages.count %]
1054
        [% IF localimages.count %]
Lines 1308-1313 Note that permanent location is a code, and location may be an authval. Link Here
1308
        <script>
1362
        <script>
1309
            /* Set a variable needed by add_catalog_concern.js */
1363
            /* Set a variable needed by add_catalog_concern.js */
1310
            var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1364
            var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1365
1366
            $(document).ready(function() {
1367
                var table_settings = [% TablesSettings.GetTableSettings( 'cataloguing', 'concerns', 'table_concerns', 'json' ) | $raw %];
1368
    
1369
                var concerns_url = '/api/v1/catalog/concerns';
1370
                var concerns = $("#table_concerns").kohaTable({
1371
                    "ajax": {
1372
                        "url": concerns_url
1373
                    },
1374
                    "embed": [
1375
                        "reporter",
1376
                        "resolver",
1377
                    ],
1378
                    'emptyTable': '<div class="dialog message">'+_("Congradulations, there are no catalog concerns.")+'</div>',
1379
                    "columnDefs": [ {
1380
                        "targets": [0,1,2],
1381
                        "render": function (data, type, row, meta) {
1382
                            if ( type == 'display' ) {
1383
                                if ( data != null ) {
1384
                                    return data.escapeHtml();
1385
                                }
1386
                                else {
1387
                                    return "";
1388
                                }
1389
                            }
1390
                            return data;
1391
                        }
1392
                    } ],
1393
                    "columns": [
1394
                        {
1395
                            "data": "reported_date:reporter.firstname",
1396
                            "render": function(data, type, row, meta) {
1397
                                let reported = '<span class="date clearfix">'+$datetime(row.reported_date)+'</span>';
1398
                                reported += '<span class="reporter clearfix">'+$patron_to_html( row.reporter, { display_cardnumber: false, url: true } )+'</span>';
1399
                                return reported;
1400
                            },
1401
                            "searchable": true,
1402
                            "orderable": true
1403
                        },
1404
                        {
1405
                            "data": "message:resolution_message",
1406
                            "render": function(data, type, row, meta) {
1407
                                let result = '<span class="clearfix">'+row.message+'</span>';
1408
                                if ( row.resolution_message ) {
1409
                                    result += '<span class="clearfix">'+_('Resolution: %s').format(row.resolution_message)+'</spani>';
1410
                                }
1411
                                return result;
1412
                            },
1413
                            "searchable": true,
1414
                            "orderable": true
1415
                        },
1416
                        {
1417
                            "data": "resolved_date:resolver.firstname",
1418
                            "render": function(data, type, row, meta) {
1419
                                let result = '';
1420
                                if ( row.resolved_date ) {
1421
                                    result += _("Resolved by:")+' <span>'+$patron_to_html( row.resolver, { display_cardnumber: false, url: true } )+'</span>';
1422
                                    result += '<span class="clearfix">'+$datetime(row.resolved_date)+'</span>';
1423
                                } else {
1424
                                    result += _("Open");
1425
                                }
1426
                                return result;
1427
                            },
1428
                            "searchable": true,
1429
                            "orderable": true
1430
                        },
1431
                        {
1432
                            "data": function( row, type, val, meta ) {
1433
                                let result = '';
1434
                                if ( !row.resolved_date ) {
1435
                                    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>';
1436
                                }
1437
                                return result;
1438
                            },
1439
                            "searchable": false,
1440
                            "orderable": false
1441
                        },
1442
                    ]
1443
                }, table_settings, 0, { biblio_id: [% biblionumber | uri %]});
1444
    
1445
                $('#hideResolved').on( "click", function() {
1446
                    // It would be great if we could pass null here but it gets stringified
1447
                    concerns.DataTable().columns('3').search('special:undefined').draw();
1448
                });
1449
    
1450
                $('#showAll').on( "click", function() {
1451
                    concerns.DataTable().columns('3').search('').draw();
1452
                });
1453
    
1454
                $('#resolveConcernModal').on('show.bs.modal', function (event) {
1455
                      let modal = $(this);
1456
                      let button = $(event.relatedTarget);
1457
                      let concern = button.data('concern');
1458
    
1459
                      modal.find('.modal-footer input').val(concern)
1460
                });
1461
    
1462
                $('#resolveConcernModal').on('click', '#resolveConfirm', function(e) {
1463
                    let concern_id = $('#concern_id').val();
1464
                    let params = { notify: $('#resolve_notify').is(":checked"), message: $('#resolve_message').val() };
1465
    
1466
                    $.ajax({
1467
                        url: "/api/v1/catalog/concerns/"+concern_id+"/resolve",
1468
                        method: "POST",
1469
                        data: JSON.stringify(params)
1470
                    }).success(function() {
1471
                        $("#resolveConcernModal").modal('hide');
1472
                        concerns.DataTable().ajax.reload(function (data) {
1473
                            $("#concern_action_result_dialog").hide();
1474
                            $("#concern_delete_success").html(_("Concern #%s deleted successfully.").format(concern_id)).show();
1475
                        });
1476
                    }).error(function () {
1477
                        $("#concern_resolve_error").html(_("Error resolving concern #%s. Check the logs.").format(concern_id)).show();
1478
                    });
1479
                });
1480
            });
1311
        </script>
1481
        </script>
1312
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1482
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1313
    [% END %]
1483
    [% END %]
1314
- 

Return to bug 31028