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

(-)a/Koha/Biblio.pm (+13 lines)
Lines 842-847 sub get_marc_notes { Link Here
842
    return \@marcnotes;
842
    return \@marcnotes;
843
}
843
}
844
844
845
=head3 public_read_list
846
847
This method returns the list of publicly readable database fields for both API and UI output purposes
848
849
=cut
850
851
sub public_read_list {
852
    return [
853
        'biblionumber', 'frameworkcode', 'title', 'unititle',
854
        'seriestitle',  'copyrightdate', 'datecreated'
855
    ];
856
}
857
845
=head3 to_api
858
=head3 to_api
846
859
847
    my $json = $biblio->to_api;
860
    my $json = $biblio->to_api;
(-)a/Koha/Item.pm (+15 lines)
Lines 1184-1189 sub _set_found_trigger { Link Here
1184
    return $self;
1184
    return $self;
1185
}
1185
}
1186
1186
1187
1188
=head3 public_read_list
1189
1190
This method returns the list of publicly readable database fields for both API and UI output purposes
1191
1192
=cut
1193
1194
sub public_read_list {
1195
    return [
1196
        'itemnumber', 'biblionumber',   'itype',
1197
        'barcode',    'itemcallnumber', 'damaged',
1198
        'withdrawn',  'notforloan',     'itemlost'
1199
    ];
1200
}
1201
1187
=head3 to_api_mapping
1202
=head3 to_api_mapping
1188
1203
1189
This method returns the mapping for representing a Koha::Item object
1204
This method returns the mapping for representing a Koha::Item object
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 173-178 Link Here
173
  "/public/biblios/{biblio_id}": {
173
  "/public/biblios/{biblio_id}": {
174
    "$ref": "paths/biblios.json#/~1public~1biblios~1{biblio_id}"
174
    "$ref": "paths/biblios.json#/~1public~1biblios~1{biblio_id}"
175
  },
175
  },
176
  "/public/items/{item_id}/bundled_items": {
177
    "$ref": "paths/items.json#/~1public~1items~1{item_id}~1bundled_items"
178
  },
176
  "/public/libraries": {
179
  "/public/libraries": {
177
    "$ref": "paths/libraries.json#/~1public~1libraries"
180
    "$ref": "paths/libraries.json#/~1public~1libraries"
178
  },
181
  },
(-)a/api/v1/swagger/paths/items.json (+88 lines)
Lines 465-469 Link Here
465
        }
465
        }
466
      }
466
      }
467
    }
467
    }
468
  },
469
  "/public/items/{item_id}/bundled_items": {
470
    "get": {
471
      "x-mojo-to": "Items#bundled_items",
472
      "operationId": "bundledItemsPublic",
473
      "tags": [
474
        "items"
475
      ],
476
      "summary": "List bundled items",
477
      "parameters": [
478
        {
479
          "$ref": "../parameters.json#/item_id_pp"
480
        },
481
        {
482
          "name": "external_id",
483
          "in": "query",
484
          "description": "Search on the item's barcode",
485
          "required": false,
486
          "type": "string"
487
        },
488
        {
489
          "$ref": "../parameters.json#/match"
490
        },
491
        {
492
          "$ref": "../parameters.json#/order_by"
493
        },
494
        {
495
          "$ref": "../parameters.json#/page"
496
        },
497
        {
498
          "$ref": "../parameters.json#/per_page"
499
        },
500
        {
501
          "$ref": "../parameters.json#/q_param"
502
        },
503
        {
504
          "$ref": "../parameters.json#/q_body"
505
        },
506
        {
507
          "$ref": "../parameters.json#/q_header"
508
        }
509
      ],
510
      "consumes": [
511
        "application/json"
512
      ],
513
      "produces": [
514
        "application/json"
515
      ],
516
      "responses": {
517
        "200": {
518
          "description": "A list of item",
519
          "schema": {
520
            "type": "array",
521
            "items": {
522
              "$ref": "../definitions.json#/item"
523
            }
524
          }
525
        },
526
        "401": {
527
          "description": "Authentication required",
528
          "schema": {
529
            "$ref": "../definitions.json#/error"
530
          }
531
        },
532
        "403": {
533
          "description": "Access forbidden",
534
          "schema": {
535
            "$ref": "../definitions.json#/error"
536
          }
537
        },
538
        "500": {
539
          "description": "Internal server error",
540
          "schema": {
541
            "$ref": "../definitions.json#/error"
542
          }
543
        },
544
        "503": {
545
          "description": "Under maintenance",
546
          "schema": {
547
            "$ref": "../definitions.json#/error"
548
          }
549
        }
550
      },
551
      "x-koha-embed": [
552
        "biblio",
553
        "checkout"
554
      ]
555
    }
468
  }
556
  }
469
}
557
}
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-2 / +89 lines)
Lines 1068-1074 Link Here
1068
        <caption class="sr-only">Holdings</caption>
1068
        <caption class="sr-only">Holdings</caption>
1069
        <thead>
1069
        <thead>
1070
            <tr>
1070
            <tr>
1071
1071
                [% IF ( itemdata_bundles ) %]
1072
                    <th id="item_bundle" data-colname="item_bundle"></th>
1073
                [% END %]
1072
                [% IF Koha.Preference('OPACLocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
1074
                [% IF Koha.Preference('OPACLocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
1073
                    <th id="item_cover" data-colname="item_cover">Cover image</th>
1075
                    <th id="item_cover" data-colname="item_cover">Cover image</th>
1074
                [% END %]
1076
                [% END %]
Lines 1118-1124 Link Here
1118
        </thead>
1120
        </thead>
1119
        <tbody>
1121
        <tbody>
1120
            [% FOREACH ITEM_RESULT IN items %]
1122
            [% FOREACH ITEM_RESULT IN items %]
1121
                <tr vocab="http://schema.org/" typeof="Offer">
1123
                <tr vocab="http://schema.org/" typeof="Offer" data-itemnumber="[% ITEM_RESULT.itemnumber | html %]">
1124
1125
                [% IF ( itemdata_bundles ) %]
1126
                    [% IF ITEM_RESULT.is_bundle %]
1127
                    <td class="details-control">
1128
                        <button><i class="fa fa-folder-open"></i></button>
1129
                    </td>
1130
                    [% ELSE %]
1131
                    <td></td>
1132
                    [% END %]
1133
                [% END %]
1122
1134
1123
                [% IF Koha.Preference('OPACLocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
1135
                [% IF Koha.Preference('OPACLocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
1124
                    <td class="cover">
1136
                    <td class="cover">
Lines 1421-1426 Link Here
1421
                "autoWidth": false
1433
                "autoWidth": false
1422
            }, columns_settings);
1434
            }, columns_settings);
1423
1435
1436
            function createChild ( row, itemnumber ) {
1437
                // This is the table we'll convert into a DataTable
1438
                var bundles_table = $('<table class="display" width="100%"/>');
1439
1440
                // Display it the child row
1441
                row.child( bundles_table ).show();
1442
1443
                // Initialise as a DataTable
1444
                var bundle_table_url = "/api/v1/public/items/" + itemnumber + "/bundled_items?";
1445
                var bundle_table = bundles_table.api({
1446
                    "ajax": {
1447
                        "url": bundle_table_url
1448
                    },
1449
                    "header_filter": false,
1450
                    "embed": [
1451
                        "biblio"
1452
                    ],
1453
                    "order": [[ 0, "asc" ]],
1454
                    "columns": [
1455
                        {
1456
                            "data": "item_type",
1457
                            "title": "Item Type",
1458
                            "searchable": false,
1459
                            "orderable": true,
1460
                        },
1461
                        {
1462
                            "data": "biblio.title",
1463
                            "title": "Title",
1464
                            "searchable": true,
1465
                            "orderable": true,
1466
                        },
1467
                        {
1468
                            "data": "damaged_status",
1469
                            "title": "Status",
1470
                            "searchable": false,
1471
                            "orderable": true,
1472
                        },
1473
                        {
1474
                            "data": "external_id",
1475
                            "title": "Barcode",
1476
                            "searchable": true,
1477
                            "orderable": true,
1478
                        },
1479
                        {
1480
                            "data": "callnumber",
1481
                            "title": "Callnumber",
1482
                            "searchable": true,
1483
                            "orderable": true,
1484
                        },
1485
                    ]
1486
                }, [], 1);
1487
1488
                return;
1489
            }
1490
1491
            // Add event listener for opening and closing details
1492
            $('#holdingst tbody').on('click', 'td.details-control', function () {
1493
                var tr = $(this).closest('tr');
1494
                var dTable = $(this).closest('table').DataTable({ 'retrieve': true });
1495
1496
                var itemnumber = tr.data('itemnumber');
1497
                var row = dTable.row( tr );
1498
1499
                if ( row.child.isShown() ) {
1500
                    // This row is already open - close it
1501
                    row.child.hide();
1502
                    tr.removeClass('shown');
1503
                }
1504
                else {
1505
                    // Open this row
1506
                    createChild(row, itemnumber);
1507
                    tr.addClass('shown');
1508
                }
1509
            } );
1510
1424
            var serial_column_settings = [% TablesSettings.GetColumns( 'opac', 'biblio-detail', 'subscriptionst', 'json' ) | $raw %];
1511
            var serial_column_settings = [% TablesSettings.GetColumns( 'opac', 'biblio-detail', 'subscriptionst', 'json' ) | $raw %];
1425
1512
1426
            KohaTable("#subscriptionst", {
1513
            KohaTable("#subscriptionst", {
(-)a/opac/opac-detail.pl (-1 / +10 lines)
Lines 751-756 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
751
        $itm->{cover_images} = $item->cover_images;
751
        $itm->{cover_images} = $item->cover_images;
752
    }
752
    }
753
753
754
    if ($item->is_bundle) {
755
        $itemfields{bundles} = 1;
756
        $itm->{is_bundle} = 1;
757
    }
758
759
    if ($item->in_bundle) {
760
        $itm->{bundle_host} = $item->bundle_host;
761
    }
762
754
    my $itembranch = $itm->{$separatebranch};
763
    my $itembranch = $itm->{$separatebranch};
755
    if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
764
    if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
756
        if ($itembranch and $itembranch eq $currentbranch) {
765
        if ($itembranch and $itembranch eq $currentbranch) {
Lines 802-807 my $norequests = ! $biblio->items->filter_by_for_hold->count; Link Here
802
                     MARCNOTES               => $marcnotesarray,
811
                     MARCNOTES               => $marcnotesarray,
803
                     norequests              => $norequests,
812
                     norequests              => $norequests,
804
                     RequestOnOpac           => C4::Context->preference("RequestOnOpac"),
813
                     RequestOnOpac           => C4::Context->preference("RequestOnOpac"),
814
                     itemdata_bundles        => $itemfields{bundles},
805
                     itemdata_ccode          => $itemfields{ccode},
815
                     itemdata_ccode          => $itemfields{ccode},
806
                     itemdata_materials      => $itemfields{materials},
816
                     itemdata_materials      => $itemfields{materials},
807
                     itemdata_enumchron      => $itemfields{enumchron},
817
                     itemdata_enumchron      => $itemfields{enumchron},
808
- 

Return to bug 28854