Bugzilla – Attachment 87188 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.62 KB, created by
Julian Maurice
on 2019-03-29 12:19:54 UTC
(
hide
)
Description:
Bug 19380: Use Koha::Item::get_transfer instead of GetTransfers
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2019-03-29 12:19:54 UTC
Size:
4.62 KB
patch
obsolete
>From 70853a143dc7fb724daee49dfd36aea803cfc9ba 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 > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > 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 a629a1ce78..fffb497ff4 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 0e50c8e3ae..d102836386 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; > >@@ -568,8 +567,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}, >@@ -578,7 +577,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'); >@@ -586,11 +585,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