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

(-)a/Koha/Item.pm (+27 lines)
Lines 1888-1893 sub bundle_items { Link Here
1888
    return Koha::Items->_new_from_dbic($rs);
1888
    return Koha::Items->_new_from_dbic($rs);
1889
}
1889
}
1890
1890
1891
1892
=head3 bundle_items_not_lost
1893
1894
  my $bundle_items = $item->bundle_items_not_lost;
1895
1896
Returns the items associated with this bundle that are not lost
1897
1898
=cut
1899
1900
sub bundle_items_not_lost {
1901
    my ($self) = @_;
1902
    return $self->bundle_items->search( { itemlost => { '!=' => 0 } } );
1903
}
1904
1905
=head3 bundle_items_lost
1906
1907
  my $bundle_items = $item->bundle_items_lost;
1908
1909
Returns the items associated with this bundle that are lost
1910
1911
=cut
1912
1913
sub bundle_items_lost {
1914
    my ($self) = @_;
1915
    return $self->bundle_items->search( { itemlost => 0 } );
1916
}
1917
1891
=head3 is_bundle
1918
=head3 is_bundle
1892
1919
1893
  my $is_bundle = $item->is_bundle;
1920
  my $is_bundle = $item->is_bundle;
(-)a/api/v1/swagger/definitions/item.yaml (+10 lines)
Lines 270-275 properties: Link Here
270
    type:
270
    type:
271
      - object
271
      - object
272
      - "null"
272
      - "null"
273
  bundle_items_lost_count:
274
    type:
275
      - integer
276
      - "null"
277
    description: Number of lost items in the bundle
278
  bundle_items_not_lost_count:
279
    type:
280
      - integer
281
      - "null"
282
    description: Number of items not lost in the bundle
273
  course_item:
283
  course_item:
274
    type:
284
    type:
275
      - object
285
      - object
(-)a/api/v1/swagger/paths/biblios.yaml (+2 lines)
Lines 437-442 Link Here
437
            - item_type
437
            - item_type
438
            - in_bundle
438
            - in_bundle
439
            - bundle_host
439
            - bundle_host
440
            - bundle_items_lost+count
441
            - bundle_items_not_lost+count
440
            - course_item.course_reserves.course
442
            - course_item.course_reserves.course
441
            - cover_image_ids
443
            - cover_image_ids
442
            - item_group_item.item_group.description
444
            - item_group_item.item_group.description
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-10 / +14 lines)
Lines 1857-1870 Link Here
1857
1857
1858
                [% IF bundlesEnabled %]
1858
                [% IF bundlesEnabled %]
1859
                // Add event listener for opening and closing bundle details
1859
                // Add event listener for opening and closing bundle details
1860
                $('#' + table_name + ' tbody').on('click', 'button.details-control', function () {
1860
                $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1861
                    var button = $(this);
1861
                    var button = $(this);
1862
                    var tr = button.closest('tr');
1862
                    var tr = button.closest('tr');
1863
                    var dTable = button.closest('table').DataTable({ 'retrieve': true });
1863
                    var dTable = button.closest('table').DataTable({ 'retrieve': true });
1864
1864
1865
                    var itemnumber = tr.data('itemnumber');
1865
                    let row = dTable.row( tr );
1866
                    var duedate = tr.data('duedate');
1866
                    let data = row.data();
1867
                    var row = dTable.row( tr );
1867
                    let itemnumber = data.item_id;
1868
                    let duedate = (data.checkout&&data.checkout.due_date) || null;
1868
1869
1869
                    if ( row.child.isShown() ) {
1870
                    if ( row.child.isShown() ) {
1870
                        // This row is already open - close it
1871
                        // This row is already open - close it
Lines 2186-2192 Link Here
2186
        [% IF Koha.Preference('UseRecalls') %]
2187
        [% IF Koha.Preference('UseRecalls') %]
2187
            embed.push('recall', 'recall+strings', 'recall.patron')
2188
            embed.push('recall', 'recall+strings', 'recall.patron')
2188
        [% END %]
2189
        [% END %]
2189
        embed.push('in_bundle', 'bundle_host');
2190
        [% IF bundlesEnabled %]
2191
            embed.push('in_bundle', 'bundle_host', 'bundle_items_lost+count', 'bundle_items_not_lost+count');
2192
        [% END %]
2190
        [% IF Koha.Preference('UseCourseReserves') %]
2193
        [% IF Koha.Preference('UseCourseReserves') %]
2191
            embed.push('course_item.course_reserves.course');
2194
            embed.push('course_item.course_reserves.course');
2192
        [% END %]
2195
        [% END %]
Lines 2460-2468 Link Here
2460
                            nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString())));
2463
                            nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString())));
2461
                        }
2464
                        }
2462
2465
2463
                        if ( row.in_bundle ) {
2466
                        [% IF bundlesEnabled %]
2464
                            nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true })));
2467
                            if ( row.in_bundle ) {
2465
                        }
2468
                                nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true })));
2469
                            }
2470
                        [% END %]
2466
                        return nodes;
2471
                        return nodes;
2467
                    }
2472
                    }
2468
                },
2473
                },
Lines 2659-2665 Link Here
2659
                        }
2664
                        }
2660
                        [% IF bundlesEnabled %]
2665
                        [% IF bundlesEnabled %]
2661
                            // FIXME How do we handle that correctly?
2666
                            // FIXME How do we handle that correctly?
2662
                            //nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle (%s|%s)</button>'.format(escape_str(row.bundled), escape_str(row.bundled_lost));
2667
                            nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle (%s|%s)</button>'.format(escape_str(row.bundle_items_not_lost_count), escape_str(row.bundle_items_lost_count));
2663
                        [% END %]
2668
                        [% END %]
2664
2669
2665
                        return nodes;
2670
                        return nodes;
2666
- 

Return to bug 33568