Bugzilla – Attachment 61979 Details for
Bug 18401
Add the Koha::Checkout->patron method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18401: Add new method Koha::Checkout->patron
Bug-18401-Add-new-method-KohaCheckout-patron.patch (text/plain), 1.89 KB, created by
Jonathan Druart
on 2017-04-07 21:18:52 UTC
(
hide
)
Description:
Bug 18401: Add new method Koha::Checkout->patron
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-04-07 21:18:52 UTC
Size:
1.89 KB
patch
obsolete
>From cf5523f7f3ad791703b5aa8d24f0a485e3c1ee3b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Apr 2017 16:42:26 -0300 >Subject: [PATCH] Bug 18401: Add new method Koha::Checkout->patron > >Return the patron related to a given checkout > >Test plan: > prove t/db_dependent/Koha/Checkouts.t >should return green >--- > Koha/Checkout.pm | 14 ++++++++++++++ > t/db_dependent/Koha/Checkouts.t | 9 ++++++++- > 2 files changed, 22 insertions(+), 1 deletion(-) > >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index 40a7ad7..b7a752c 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -74,6 +74,20 @@ sub item { > return Koha::Item->_new_from_dbic( $item_rs ); > } > >+=head3 patron >+ >+my $patron = $checkout->patron >+ >+Return the patron for who the checkout has been done >+ >+=cut >+ >+sub patron { >+ my ( $self ) = @_; >+ my $patron_rs = $self->_result->borrower; >+ return Koha::Patron->_new_from_dbic( $patron_rs ); >+} >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index a8eaa69..89b0126 100644 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > > use Koha::Checkouts; > use Koha::Database; >@@ -93,6 +93,13 @@ subtest 'item' => sub { > is( $item->itemnumber, $item_1->{itemnumber}, 'Koha::Checkout->item should return the correct item' ); > }; > >+subtest 'patron' => sub { >+ plan tests => 2; >+ my $p = $new_checkout_1->patron; >+ is( ref($p), 'Koha::Patron', 'Koha::Checkout->patron should return a Koha::Patron' ); >+ is( $p->borrowernumber, $patron->{borrowernumber}, 'Koha::Checkout->patron should return the correct patron' ); >+}; >+ > $retrieved_checkout_1->delete; > is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); > >-- >2.9.3
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 18401
:
61979
|
61985
|
62700