Bugzilla – Attachment 70385 Details for
Bug 19943
Koha::Biblio - Remove GetBiblioItemData
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19943: Koha::GetBiblioItemData - Replace existing occurrences
Bug-19943-KohaGetBiblioItemData---Replace-existing.patch (text/plain), 4.15 KB, created by
Jonathan Druart
on 2018-01-09 18:47:49 UTC
(
hide
)
Description:
Bug 19943: Koha::GetBiblioItemData - Replace existing occurrences
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-01-09 18:47:49 UTC
Size:
4.15 KB
patch
obsolete
>From 616850f8cefca86ea3844e384e567fff48ab0718 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Jan 2018 14:37:20 -0300 >Subject: [PATCH] Bug 19943: Koha::GetBiblioItemData - Replace existing > occurrences > >The biblioitem's info can be retrieved with Koha::Biblio->biblioitem > >Test plan: >1. Use the age restriction to restrict checkouts for a given patron >2. Check some items of a biblio out, go to "Items" tab, then "View >item's checkout history" link. Compare views with and without patches >--- > C4/Circulation.pm | 7 ++++--- > circ/bookcount.pl | 9 +++++---- > t/db_dependent/Biblio.t | 8 ++++---- > 3 files changed, 13 insertions(+), 11 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 88c0687d1b..45795f88d2 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -682,7 +682,8 @@ sub CanBookBeIssued { > > my $item = GetItem(undef, $barcode ); > my $issue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } ); >- my $biblioitem = GetBiblioItemData($item->{biblioitemnumber}); >+ my $biblio = Koha::Biblios->( $item->{biblionumber} ); >+ my $biblioitem = $biblio->biblioitem; > my $effective_itemtype = $item->{itype}; # GetItem deals with that > my $dbh = C4::Context->dbh; > >@@ -947,7 +948,7 @@ sub CanBookBeIssued { > } > } > } >- elsif ($biblioitem->{'notforloan'} == 1){ >+ elsif ($biblioitem->notforloan == 1){ > if (!C4::Context->preference("AllowNotForLoanOverride")) { > $issuingimpossible{NOT_FOR_LOAN} = 1; > $issuingimpossible{itemtype_notforloan} = $effective_itemtype; >@@ -1029,7 +1030,7 @@ sub CanBookBeIssued { > } > > ## CHECK AGE RESTRICTION >- my $agerestriction = $biblioitem->{'agerestriction'}; >+ my $agerestriction = $biblioitem->agerestriction; > my ($restriction_age, $daysToAgeRestriction) = GetAgeRestriction( $agerestriction, $borrower ); > if ( $daysToAgeRestriction && $daysToAgeRestriction > 0 ) { > if ( C4::Context->preference('AgeRestrictionOverride') ) { >diff --git a/circ/bookcount.pl b/circ/bookcount.pl >index 2976a05b66..c0b116bfbe 100755 >--- a/circ/bookcount.pl >+++ b/circ/bookcount.pl >@@ -29,7 +29,7 @@ use C4::Circulation; > use C4::Output; > use C4::Koha; > use C4::Auth; >-use C4::Biblio; # GetBiblioItemData >+use Koha::Biblios; > use Koha::DateUtils; > use Koha::Libraries; > >@@ -39,7 +39,8 @@ my $bi = $input->param('bi'); > my $biblionumber = $input->param('biblionumber'); > > my $idata = itemdatanum($itm); >-my $data = GetBiblioItemData($bi); >+my $biblio = Koha::Biblios->find( $biblionumber ); >+die "No valid biblionumber passed" unless $biblio; # FIXME A bit rude! > > my $lastmove = lastmove($itm); > >@@ -74,8 +75,8 @@ for my $library ( @$libraries ) { > > $template->param( > biblionumber => $biblionumber, >- title => $data->{'title'}, >- author => $data->{'author'}, >+ title => $biblio->title, >+ author => $biblio->author, > barcode => $idata->{'barcode'}, > biblioitemnumber => $bi, > homebranch => $idata->{homebranch}, >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 4c4e72da8f..12dc25bd4d 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -197,10 +197,10 @@ sub run_tests { > my ( $title_field, $title_subfield ) = get_title_field(); > is( $marc->subfield( $title_field, $title_subfield ), $title, ); > >- my $itemdata = GetBiblioItemData( $biblioitemnumber ); >- is( $itemdata->{ title }, $title, >- 'First test of GetBiblioItemData to get same result of previous two GetBiblioData tests.'); >- is( $itemdata->{ isbn }, $isbn, >+ my $biblioitem = Koha::Biblioitems->find( $biblioitemnumber ); >+ is( $biblioitem->_result->biblio->title, $title, # Should be $biblioitem->biblio instead, but not needed elsewhere for now >+ 'Do not know if this makes sense - compare result of previous two GetBiblioData tests.'); >+ is( $biblioitem->isbn, $isbn, > 'Second test checking it returns the correct isbn.'); > > my $success = 0; >-- >2.11.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 19943
:
70384
|
70385
|
70386
|
72568
|
72569
|
72570
|
72593
|
72594
|
72595
|
72596
|
73189
|
73190
|
73191
|
73192
|
73194
|
73198
|
73199
|
73200