Bugzilla – Attachment 60327 Details for
Bug 17974
Add the Koha::Item->biblio method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17974: Add the Koha::Item->biblio method
Bug-17974-Add-the-KohaItem-biblio-method.patch (text/plain), 1.98 KB, created by
Nick Clemens (kidclamp)
on 2017-02-16 11:08:11 UTC
(
hide
)
Description:
Bug 17974: Add the Koha::Item->biblio method
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-02-16 11:08:11 UTC
Size:
1.98 KB
patch
obsolete
>From e95479f8b021d2033a599d1eec63cc56c98abecb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 21 Jan 2017 16:45:34 +0100 >Subject: [PATCH] Bug 17974: Add the Koha::Item->biblio method > >Test plan: > prove t/db_dependent/Koha/Items.t >should return green > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Item.pm | 14 ++++++++++++++ > t/db_dependent/Koha/Items.t | 10 +++++++++- > 2 files changed, 23 insertions(+), 1 deletion(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 52a7700..da3d11a 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -77,6 +77,20 @@ sub holding_branch { > return $self->{_holding_branch}; > } > >+=head3 biblio >+ >+my $biblio = $item->biblio; >+ >+Return the bibliographic record of this item >+ >+=cut >+ >+sub biblio { >+ my ( $self ) = @_; >+ my $biblio_rs = $self->_result->biblio; >+ return Koha::Biblio->_new_from_dbic( $self->_result->biblio ); >+} >+ > =head3 get_transfer > > my $transfer = $item->get_transfer; >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index 843bf44..c9d4bac 100644 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > > use C4::Circulation; > use Koha::Item; >@@ -74,6 +74,14 @@ subtest 'get_transfer' => sub { > is( $transfer->itemnumber, $new_item_1->itemnumber, 'Koha::Item->get_transfer should return a valid Koha::Item::Transfers object' ); > }; > >+subtest 'biblio' => sub { >+ plan tests => 2; >+ >+ my $biblio = $retrieved_item_1->biblio; >+ is( ref( $biblio ), 'Koha::Biblio', 'Koha::Item->bilio should return a Koha::Biblio' ); >+ is( $biblio->biblionumber, $retrieved_item_1->biblionumber, 'Koha::Item->biblio should return the correct biblio' ); >+}; >+ > $retrieved_item_1->delete; > is( Koha::Items->search->count, $nb_of_items + 1, 'Delete should have deleted the item' ); > >-- >2.1.4
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 17974
:
59441
|
59464
| 60327 |
60328