Bugzilla – Attachment 97468 Details for
Bug 24440
Add ->current_item_level_holds to Koha::Acquisition::Order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24440: Add ->holds and ->holds_count to Koha::Acquisition::Order
Bug-24440-Add--holds-and--holdscount-to-KohaAcquis.patch (text/plain), 2.00 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-01-16 19:01:43 UTC
(
hide
)
Description:
Bug 24440: Add ->holds and ->holds_count to Koha::Acquisition::Order
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-01-16 19:01:43 UTC
Size:
2.00 KB
patch
obsolete
>From 00f208cd18222357498a47d51e12f0c03b74a6bf Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 16 Jan 2020 15:58:25 -0300 >Subject: [PATCH] Bug 24440: Add ->holds and ->holds_count to > Koha::Acquisition::Order > >This patch introduces a method to fetch the holds associated with the >items associated to an order line. It also adds a method to get that >holds count, which will be handy on the API for embedding such >information on request. > >To test: >1. Apply this patches >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Acquisition/Order.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Acquisition/Order.pm | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 6d37e15c2b..3ee51b926d 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -25,6 +25,7 @@ use Koha::Acquisition::Invoices; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Biblios; >+use Koha::Holds; > use Koha::Items; > use Koha::Subscriptions; > >@@ -169,6 +170,44 @@ sub subscription { > return Koha::Subscription->_new_from_dbic( $subscription_rs ); > } > >+=head3 holds >+ >+ my $holds = $order->holds >+ >+Returns the holds associated to the order. It returns a I<Koha::Holds> >+resultset in scalar context or a list of I<Koha::Hold> objects in list context. >+ >+=cut >+ >+sub holds { >+ my ($self) = @_; >+ >+ my $items_rs = $self->_result->aqorders_items; >+ my @item_numbers = $items_rs->get_column( 'itemnumber' )->all; >+ >+ return Koha::Holds->search( >+ { >+ itemnumber => { >+ -in => \@item_numbers >+ } >+ } >+ ); >+} >+ >+=head3 holds_count >+ >+ my $count = $order->holds_count >+ >+Returns the holds count associated to the order. >+ >+=cut >+ >+sub holds_count { >+ my ($self) = @_; >+ >+ return $self->holds->count; >+} >+ > =head3 items > > my $items = $order->items >-- >2.25.0
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 24440
:
97467
|
97468
|
97491
|
97492
|
98194
|
98195
|
98196
|
98197
|
98205
|
98206
|
98207
|
98208
|
98237
|
98283
|
98284
|
98285
|
98286
|
98287
|
98288