Bugzilla – Attachment 108273 Details for
Bug 23695
Items holdingbranch should be set to the originating library when generating a manual transfer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23695: (follow-up) Add exceptions for missing branch parameters
Bug-23695-follow-up-Add-exceptions-for-missing-bra.patch (text/plain), 2.88 KB, created by
Nick Clemens (kidclamp)
on 2020-08-14 12:58:05 UTC
(
hide
)
Description:
Bug 23695: (follow-up) Add exceptions for missing branch parameters
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-08-14 12:58:05 UTC
Size:
2.88 KB
patch
obsolete
>From c81a9e5fb0496a702bd7faaf8e19bc5a95c54ca4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 14 Aug 2020 12:57:25 +0000 >Subject: [PATCH] Bug 23695: (follow-up) Add exceptions for missing branch > parameters > >--- > C4/Circulation.pm | 8 ++++++++ > t/db_dependent/Circulation.t | 33 ++++++++++++++++++++++++++++++++- > 2 files changed, 40 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 8cfcdb005b..b24ef6e90d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -322,6 +322,14 @@ sub transferbook { > my $dotransfer = 1; > my $item = Koha::Items->find( { barcode => $barcode } ); > >+ Koha::Exceptions::MissingParameter->throw( >+ "Missing mandatory parameter: from_branch") >+ unless $fbr; >+ >+ Koha::Exceptions::MissingParameter->throw( >+ "Missing mandatory parameter: to_branch") >+ unless $tbr; >+ > # bad barcode.. > unless ( $item ) { > $messages->{'BadBarcode'} = $barcode; >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index a9fa393fc6..f621da5df6 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,8 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 49; >+use Test::More tests => 50; >+use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); > >@@ -4449,6 +4450,36 @@ subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddIssue' => sub { > }; > }; > >+subtest 'transferbook tests' => sub { >+ plan tests => 9; >+ >+ throws_ok >+ { C4::Circulation::transferbook({}); } >+ 'Koha::Exceptions::MissingParameter', >+ 'Koha::Patron->store raises an exception on missing params'; >+ >+ throws_ok >+ { C4::Circulation::transferbook({to_branch=>'anything'}); } >+ 'Koha::Exceptions::MissingParameter', >+ 'Koha::Patron->store raises an exception on missing params'; >+ >+ throws_ok >+ { C4::Circulation::transferbook({from_branch=>'anything'}); } >+ 'Koha::Exceptions::MissingParameter', >+ 'Koha::Patron->store raises an exception on missing params'; >+ >+ my ($doreturn,$messages) = C4::Circulation::transferbook({to_branch=>'there',from_branch=>'here'}); >+ is( $doreturn, 0, "No return without barcode"); >+ ok( exists $messages->{BadBarcode}, "We get a BadBarcode message if no barcode passed"); >+ is( $messages->{BadBarcode}, undef, "No barcode passed means undef BadBarcode" ); >+ >+ my ($doreturn,$messages) = C4::Circulation::transferbook({to_branch=>'there',from_branch=>'here',barcode=>'BadBarcode'}); >+ is( $doreturn, 0, "No return without barcode"); >+ ok( exists $messages->{BadBarcode}, "We get a BadBarcode message if no barcode passed"); >+ is( $messages->{BadBarcode}, 'BadBarcode', "No barcode passed means undef BadBarcode" ); >+ >+}; >+ > $schema->storage->txn_rollback; > C4::Context->clear_syspref_cache(); > $branches = Koha::Libraries->search(); >-- >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 23695
:
93231
|
98942
|
99955
|
99956
|
100567
|
100568
|
101441
|
101442
|
101443
|
107463
|
107464
|
107465
|
108183
|
108184
|
108185
|
108186
|
108273
|
108495
|
111391
|
111394