Bugzilla – Attachment 175764 Details for
Bug 38686
Add Koha::Items->filter_by_checked_out
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38686: Add Koha::Items->filter_by_checked_out()
Bug-38686-Add-KohaItems-filterbycheckedout.patch (text/plain), 1.28 KB, created by
Roman Dolny
on 2024-12-19 13:15:39 UTC
(
hide
)
Description:
Bug 38686: Add Koha::Items->filter_by_checked_out()
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2024-12-19 13:15:39 UTC
Size:
1.28 KB
patch
obsolete
>From acd30ce6603609d7b2c1971f6ffda6f91fa1c458 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 12 Dec 2024 10:18:32 -0300 >Subject: [PATCH] Bug 38686: Add Koha::Items->filter_by_checked_out() > >This patch adds a method for filtering `Koha::Items` resultsets by >keeping only those items that currently checked out. > >Usage: > >```perl >if ( $biblio->items->filter_by_checked_out()->count ) { > # do your stuff >} >``` > >To test: >1. Apply this patches >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Items.t >=> SUCCESS: Tests pass >3. Sign off :-D > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > Koha/Items.pm | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 1cb1dce1b5..978be39319 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -222,6 +222,23 @@ sub filter_by_bookable { > ); > } > >+=head3 filter_by_checked_out >+ >+ my $filterd_items = $items->filter_by_checked_out(); >+ >+Returns a new resultset, containing only those items that are checked out. >+ >+=cut >+ >+sub filter_by_checked_out { >+ my ($self) = @_; >+ >+ return $self->search( >+ { issue_id => { '!=' => undef } }, >+ { join => 'issue' } >+ ); >+} >+ > =head3 move_to_biblio > > $items->move_to_biblio($to_biblio); >-- >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 38686
:
175396
|
175398
|
175763
| 175764