Bugzilla – Attachment 86741 Details for
Bug 19380
Add transfer informations in ILS-DI GetRecords response
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19380: Use Koha::Item::get_transfer instead of GetTransfers
Bug-19380-Use-KohaItemgettransfer-instead-of-GetTr.patch (text/plain), 4.57 KB, created by
Julian Maurice
on 2019-03-19 13:17:13 UTC
(
hide
)
Description:
Bug 19380: Use Koha::Item::get_transfer instead of GetTransfers
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2019-03-19 13:17:13 UTC
Size:
4.57 KB
patch
obsolete
>From d2a3af76f23c65325db1eaadc92afdbc1c8d92d6 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Tue, 19 Mar 2019 14:16:06 +0100 >Subject: [PATCH] Bug 19380: Use Koha::Item::get_transfer instead of > GetTransfers > >--- > C4/ILSDI/Services.pm | 34 ++++++++++++++++++--------------- > t/db_dependent/ILSDI_Services.t | 15 +++++++-------- > 2 files changed, 26 insertions(+), 23 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 414063f302..444c8d34f5 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -230,32 +230,36 @@ sub GetRecords { > my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; > my $holds = $biblio->current_holds->unblessed; > my $issues = GetBiblioIssues($biblionumber); >- my $items = $biblio->items->unblessed; >+ my @items = $biblio->items; >+ >+ $biblioitem->{items}->{item} = []; > > # We loop over the items to clean them >- foreach my $item (@$items) { >+ foreach my $item (@items) { >+ my %item = %{ $item->unblessed }; > > # This hides additionnal XML subfields, we don't need these info >- delete $item->{'more_subfields_xml'}; >+ delete $item{'more_subfields_xml'}; > > # Display branch names instead of branch codes >- my $home_library = Koha::Libraries->find( $item->{homebranch} ); >- my $holding_library = Koha::Libraries->find( $item->{holdingbranch} ); >- $item->{'homebranchname'} = $home_library ? $home_library->branchname : ''; >- $item->{'holdingbranchname'} = $holding_library ? $holding_library->branchname : ''; >- >- my ($transferDate, $transferFrom, $transferTo) = GetTransfers($item->{itemnumber}); >- if ($transferDate) { >- $item->{transfer} = { >- datesent => $transferDate, >- frombranch => $transferFrom, >- tobranch => $transferTo, >+ my $home_library = $item->home_branch; >+ my $holding_library = $item->holding_branch; >+ $item{'homebranchname'} = $home_library ? $home_library->branchname : ''; >+ $item{'holdingbranchname'} = $holding_library ? $holding_library->branchname : ''; >+ >+ my $transfer = $item->get_transfer; >+ if ($transfer) { >+ $item{transfer} = { >+ datesent => $transfer->datesent, >+ frombranch => $transfer->frombranch, >+ tobranch => $transfer->tobranch, > }; > } >+ >+ push @{ $biblioitem->{items}->{item} }, \%item; > } > > # Hashref building... >- $biblioitem->{'items'}->{'item'} = $items; > $biblioitem->{'reserves'}->{'reserve'} = $holds; > $biblioitem->{'issues'}->{'issue'} = $issues; > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index edb86c0de2..cfa28ac4ef 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -25,7 +25,6 @@ use t::lib::Mocks; > use t::lib::TestBuilder; > > use C4::Items qw( ModItemTransfer ); >-use C4::Circulation qw( GetTransfers ); > > use Koha::AuthUtils; > >@@ -476,8 +475,8 @@ subtest 'GetRecords' => sub { > biblionumber => $biblio->{biblionumber}, > }, > }); >- my $item = $builder->build({ >- source => 'Item', >+ my $item = $builder->build_object({ >+ class => 'Koha::Items', > value => { > biblionumber => $biblio->{biblionumber}, > biblioitemnumber => $biblioitem->{biblioitemnumber}, >@@ -486,7 +485,7 @@ subtest 'GetRecords' => sub { > }, > }); > >- ModItemTransfer($item->{itemnumber}, $branch1->{branchcode}, $branch2->{branchcode}); >+ ModItemTransfer($item->itemnumber, $branch1->{branchcode}, $branch2->{branchcode}); > > my $cgi = new CGI; > $cgi->param(service => 'GetRecords'); >@@ -494,11 +493,11 @@ subtest 'GetRecords' => sub { > > my $reply = C4::ILSDI::Services::GetRecords($cgi); > >- my ($datesent, $frombranch, $tobranch) = GetTransfers($item->{itemnumber}); >+ my $transfer = $item->get_transfer; > my $expected = { >- datesent => $datesent, >- frombranch => $frombranch, >- tobranch => $tobranch, >+ datesent => $transfer->datesent, >+ frombranch => $transfer->frombranch, >+ tobranch => $transfer->tobranch, > }; > is_deeply($reply->{record}->[0]->{items}->{item}->[0]->{transfer}, $expected, > 'GetRecords returns transfer informations'); >-- >2.20.1
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 19380
:
67427
|
67577
|
86740
|
86741
|
86800
|
86801
|
87187
|
87188