Bugzilla – Attachment 177776 Details for
Bug 37334
Cannot filter holdings table by status
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37334: Add ability to filter by in_bundle
Bug-37334-Add-ability-to-filter-by-inbundle.patch (text/plain), 3.35 KB, created by
Lucas Gass (lukeg)
on 2025-02-11 20:46:01 UTC
(
hide
)
Description:
Bug 37334: Add ability to filter by in_bundle
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-02-11 20:46:01 UTC
Size:
3.35 KB
patch
obsolete
>From 1f448a9938c7bde154b4487d5c06244757a564cf Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 13 Jan 2025 21:08:02 +0000 >Subject: [PATCH] Bug 37334: Add ability to filter by in_bundle > >Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >--- > Koha/Item.pm | 4 +++- > Koha/Items.pm | 21 +++++++++++++++++++ > .../tables/items/catalogue_detail.inc | 2 +- > 3 files changed, 25 insertions(+), 2 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 69a8c735188..e76e2c1f7cd 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1477,7 +1477,9 @@ sub _status { > push @statuses, 'restricted'; > } > >- # TODO in_bundle? >+ if ( $self->in_bundle ) { >+ push @statuses, 'in_bundle'; >+ } > > return join ',', @statuses; > } >diff --git a/Koha/Items.pm b/Koha/Items.pm >index a4c2c3dfb3c..f5e7b2c55c3 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -317,6 +317,24 @@ sub filter_by_has_recalls { > return $self->search( { 'me.itemnumber' => { '-in' => $recalls } } ); > } > >+=head3 filter_by_in_bundle >+ >+Returns a new resultset, containing only those items that currently are part of a bundle. >+ >+=cut >+ >+sub filter_by_in_bundle { >+ my ($self) = @_; >+ >+ my @in_bundle_items; >+ while ( my $item = $self->next ) { >+ push @in_bundle_items, $item if $item->in_bundle; >+ } >+ >+ my @bundled_items = map { $_->itemnumber } @in_bundle_items; >+ return $self->search( { 'me.itemnumber' => { '-in' => \@bundled_items } } ); >+} >+ > =head3 filter_by_available > > my $available_items = $items->filter_by_available; >@@ -658,6 +676,9 @@ sub search { > if ( $status eq 'recalled' ) { > $self = $self->filter_by_has_recalls; > } >+ if ( $status eq 'in_bundle' ) { >+ $self = $self->filter_by_in_bundle; >+ } > > if ( $status eq 'available' ) { > $self = $self->filter_by_available; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index 5ff3bec2214..80803b86075 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -214,7 +214,7 @@ > }); > const item_types_notforloan = new Map(all_item_types.map( it => [it.itemtype, it.notforloan] )); > >- const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted")}; >+ const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted"), in_bundle: _("In bundle")}; > const all_statuses = Object.keys(statuses).map(k => {return {_id: k, _str: statuses[k]}}); > > const can_edit_items_from = [% To.json(can_edit_items_from || []) | $raw %]; >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37334
:
172300
|
172301
|
172302
|
173499
|
173500
|
173501
|
173949
|
173950
|
173951
|
173982
|
174310
|
174798
|
174799
|
174800
|
174801
|
174802
|
174803
|
174804
|
174813
|
174814
|
174901
|
174902
|
174903
|
174955
|
175859
|
175860
|
175861
|
175862
|
175863
|
175864
|
175865
|
175866
|
175867
|
175868
|
175869
|
175870
|
175871
|
175999
|
176000
|
176001
|
176002
|
176003
|
176004
|
176005
|
176006
|
176007
|
176008
|
176009
|
176010
|
176011
|
176023
|
176024
|
176025
|
176026
|
176027
|
176028
|
176029
|
176030
|
176031
|
176032
|
176033
|
176034
|
176035
|
176475
|
176477
|
176480
|
176481
|
177321
|
177415
|
177416
|
177417
|
177418
|
177419
|
177420
|
177421
|
177422
|
177423
|
177424
|
177425
|
177426
|
177427
|
177428
|
177429
|
177430
|
177431
|
177432
|
177466
|
177516
|
177520
|
177524
|
177525
|
177526
|
177527
|
177528
|
177529
|
177530
|
177531
|
177764
|
177765
|
177766
|
177767
|
177768
|
177769
|
177770
|
177771
|
177772
|
177773
|
177774
|
177775
| 177776 |
177777
|
177778
|
177779
|
177780
|
177781
|
177782
|
177783