Bug 33568: Restore bundle items
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
c871b26f6e
commit
1d8a6fa3fd
27
Koha/Item.pm
27
Koha/Item.pm
|
|
@ -1888,6 +1888,33 @@ sub bundle_items {
|
|||
return Koha::Items->_new_from_dbic($rs);
|
||||
}
|
||||
|
||||
|
||||
=head3 bundle_items_not_lost
|
||||
|
||||
my $bundle_items = $item->bundle_items_not_lost;
|
||||
|
||||
Returns the items associated with this bundle that are not lost
|
||||
|
||||
=cut
|
||||
|
||||
sub bundle_items_not_lost {
|
||||
my ($self) = @_;
|
||||
return $self->bundle_items->search( { itemlost => { '!=' => 0 } } );
|
||||
}
|
||||
|
||||
=head3 bundle_items_lost
|
||||
|
||||
my $bundle_items = $item->bundle_items_lost;
|
||||
|
||||
Returns the items associated with this bundle that are lost
|
||||
|
||||
=cut
|
||||
|
||||
sub bundle_items_lost {
|
||||
my ($self) = @_;
|
||||
return $self->bundle_items->search( { itemlost => 0 } );
|
||||
}
|
||||
|
||||
=head3 is_bundle
|
||||
|
||||
my $is_bundle = $item->is_bundle;
|
||||
|
|
|
|||
|
|
@ -270,6 +270,16 @@ properties:
|
|||
type:
|
||||
- object
|
||||
- "null"
|
||||
bundle_items_lost_count:
|
||||
type:
|
||||
- integer
|
||||
- "null"
|
||||
description: Number of lost items in the bundle
|
||||
bundle_items_not_lost_count:
|
||||
type:
|
||||
- integer
|
||||
- "null"
|
||||
description: Number of items not lost in the bundle
|
||||
course_item:
|
||||
type:
|
||||
- object
|
||||
|
|
|
|||
|
|
@ -437,6 +437,8 @@
|
|||
- item_type
|
||||
- in_bundle
|
||||
- bundle_host
|
||||
- bundle_items_lost+count
|
||||
- bundle_items_not_lost+count
|
||||
- course_item.course_reserves.course
|
||||
- cover_image_ids
|
||||
- item_group_item.item_group.description
|
||||
|
|
|
|||
|
|
@ -1857,14 +1857,15 @@
|
|||
|
||||
[% IF bundlesEnabled %]
|
||||
// Add event listener for opening and closing bundle details
|
||||
$('#' + table_name + ' tbody').on('click', 'button.details-control', function () {
|
||||
$('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
|
||||
var button = $(this);
|
||||
var tr = button.closest('tr');
|
||||
var dTable = button.closest('table').DataTable({ 'retrieve': true });
|
||||
|
||||
var itemnumber = tr.data('itemnumber');
|
||||
var duedate = tr.data('duedate');
|
||||
var row = dTable.row( tr );
|
||||
let row = dTable.row( tr );
|
||||
let data = row.data();
|
||||
let itemnumber = data.item_id;
|
||||
let duedate = (data.checkout&&data.checkout.due_date) || null;
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
// This row is already open - close it
|
||||
|
|
@ -2186,7 +2187,9 @@
|
|||
[% IF Koha.Preference('UseRecalls') %]
|
||||
embed.push('recall', 'recall+strings', 'recall.patron')
|
||||
[% END %]
|
||||
embed.push('in_bundle', 'bundle_host');
|
||||
[% IF bundlesEnabled %]
|
||||
embed.push('in_bundle', 'bundle_host', 'bundle_items_lost+count', 'bundle_items_not_lost+count');
|
||||
[% END %]
|
||||
[% IF Koha.Preference('UseCourseReserves') %]
|
||||
embed.push('course_item.course_reserves.course');
|
||||
[% END %]
|
||||
|
|
@ -2460,9 +2463,11 @@
|
|||
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString())));
|
||||
}
|
||||
|
||||
if ( row.in_bundle ) {
|
||||
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true })));
|
||||
}
|
||||
[% IF bundlesEnabled %]
|
||||
if ( row.in_bundle ) {
|
||||
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true })));
|
||||
}
|
||||
[% END %]
|
||||
return nodes;
|
||||
}
|
||||
},
|
||||
|
|
@ -2659,7 +2664,7 @@
|
|||
}
|
||||
[% IF bundlesEnabled %]
|
||||
// FIXME How do we handle that correctly?
|
||||
//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));
|
||||
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));
|
||||
[% END %]
|
||||
|
||||
return nodes;
|
||||
|
|
|
|||
Loading…
Reference in New Issue