Bugzilla – Attachment 67577 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: Add transfer informations in ILS-DI GetRecords response
Bug-19380-Add-transfer-informations-in-ILS-DI-GetR.patch (text/plain), 4.15 KB, created by
Alex Buckley
on 2017-10-03 21:14:32 UTC
(
hide
)
Description:
Bug 19380: Add transfer informations in ILS-DI GetRecords response
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-10-03 21:14:32 UTC
Size:
4.15 KB
patch
obsolete
>From 2b08985978c09c0e3ad48a9de5b706ca28217eb3 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 27 Sep 2017 15:32:53 +0200 >Subject: [PATCH] Bug 19380: Add transfer informations in ILS-DI GetRecords > response > >Test plan: >1. Put an item into a 'transfer' state > a. Place a hold on an item in branch A for a patron of branch B > b. Check in this item in branch A and confirm transfer >2. Go to http://opac/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=XXX > where XXX is the biblionumber of the biblio the item belongs to. >3. Verify you have a new <transfer> element inside //record/items/item > that contains <datesent>, <frombranch> and <tobranch> >4. Check in the same item in branch B, so that the item is not flagged > as being transferred >5. Repeat 2 >6. Verify that the <transfer> element is not there. >7. prove t/db_dependent/ILSDI_Services.t > >Followed test plan, patch worked as described. Also ran QA test tools >and modified files passed > >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> >--- > C4/ILSDI/Services.pm | 9 +++++++ > t/db_dependent/ILSDI_Services.t | 58 ++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 66 insertions(+), 1 deletion(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index a0aec99..b70c542 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -239,6 +239,15 @@ sub GetRecords { > 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, >+ }; >+ } > } > > # Hashref building... >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index 7677db0..81295d9 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -19,11 +19,14 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; > use t::lib::Mocks; > use t::lib::TestBuilder; > >+use C4::Items qw( ModItemTransfer ); >+use C4::Circulation qw( GetTransfers ); >+ > use Koha::AuthUtils; > > BEGIN { >@@ -198,3 +201,56 @@ subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes > $schema->storage->txn_rollback; > }; > >+subtest 'GetRecords' => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ t::lib::Mocks::mock_preference( 'ILS-DI', 1 ); >+ >+ my $branch1 = $builder->build({ >+ source => 'Branch', >+ }); >+ my $branch2 = $builder->build({ >+ source => 'Branch', >+ }); >+ >+ my $biblio = $builder->build({ >+ source => 'Biblio', >+ }); >+ my $biblioitem = $builder->build({ >+ source => 'Biblioitem', >+ value => { >+ biblionumber => $biblio->{biblionumber}, >+ }, >+ }); >+ my $item = $builder->build({ >+ source => 'Item', >+ value => { >+ biblionumber => $biblio->{biblionumber}, >+ biblioitemnumber => $biblioitem->{biblioitemnumber}, >+ homebranch => $branch1->{branchcode}, >+ holdingbranch => $branch1->{branchcode}, >+ }, >+ }); >+ >+ ModItemTransfer($item->{itemnumber}, $branch1->{branchcode}, $branch2->{branchcode}); >+ >+ my $cgi = new CGI; >+ $cgi->param(service => 'GetRecords'); >+ $cgi->param(id => $biblio->{biblionumber}); >+ >+ my $reply = C4::ILSDI::Services::GetRecords($cgi); >+ >+ my ($datesent, $frombranch, $tobranch) = GetTransfers($item->{itemnumber}); >+ my $expected = { >+ datesent => $datesent, >+ frombranch => $frombranch, >+ tobranch => $tobranch, >+ }; >+ is_deeply($reply->{record}->[0]->{items}->{item}->[0]->{transfer}, $expected, >+ 'GetRecords returns transfer informations'); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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 19380
:
67427
|
67577
|
86740
|
86741
|
86800
|
86801
|
87187
|
87188