Bugzilla – Attachment 99953 Details for
Bug 24759
OpacRenewalBranch code should be a Koha::Item method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24759: Rename renewalbranch to renewal_branchcode
Bug-24759-Rename-renewalbranch-to-renewalbranchcod.patch (text/plain), 7.41 KB, created by
Nick Clemens (kidclamp)
on 2020-03-02 17:03:10 UTC
(
hide
)
Description:
Bug 24759: Rename renewalbranch to renewal_branchcode
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-03-02 17:03:10 UTC
Size:
7.41 KB
patch
obsolete
>From 91182910bf264691b0286e0021b0c70327f37e9c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 2 Mar 2020 17:01:42 +0000 >Subject: [PATCH] Bug 24759: Rename renewalbranch to renewal_branchcode > >--- > C4/Circulation.pm | 2 +- > Koha/Item.pm | 16 ++++++++-------- > t/db_dependent/Koha/Item.t | 28 ++++++++++++++-------------- > 3 files changed, 23 insertions(+), 23 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 07b7b050e7..b5a9c8b3b3 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3035,7 +3035,7 @@ sub AddRenewal { > # Add the renewal to stats > UpdateStats( > { >- branch => $item_object->renewalbranch({branch => $branch}), >+ branch => $item_object->renewal_branchcode({branch => $branch}), > type => 'renew', > amount => $charge, > itemnumber => $itemnumber, >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 86361ee56b..5eb9952054 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -490,30 +490,30 @@ sub as_marc_field { > return $field; > } > >-=head3 renewalbranch >+=head3 renewal_branchcode > >-Returns the branch to be recorded in statistics renewal of the item >+Returns the branchcode to be recorded in statistics renewal of the item > > =cut > >-sub renewalbranch { >+sub renewal_branchcode { > > my ($self, $params ) = @_; > > my $interface = C4::Context->interface; > my $branchcode; > if ( $interface eq 'opac' ){ >- my $renewalbranch = C4::Context->preference('OpacRenewalBranch'); >- if( !defined $renewalbranch || $renewalbranch eq 'opacrenew' ){ >+ my $renewal_branchcode = C4::Context->preference('OpacRenewalBranch'); >+ if( !defined $renewal_branchcode || $renewal_branchcode eq 'opacrenew' ){ > $branchcode = 'OPACRenew'; > } >- elsif ( $renewalbranch eq 'itemhomebranch' ) { >+ elsif ( $renewal_branchcode eq 'itemhomebranch' ) { > $branchcode = $self->homebranch; > } >- elsif ( $renewalbranch eq 'patronhomebranch' ) { >+ elsif ( $renewal_branchcode eq 'patronhomebranch' ) { > $branchcode = $self->checkout->patron->branchcode; > } >- elsif ( $renewalbranch eq 'checkoutbranch' ) { >+ elsif ( $renewal_branchcode eq 'checkoutbranch' ) { > $branchcode = $self->checkout->branchcode; > } > else { >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index badca41b76..eac8ad6ec3 100644 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -330,7 +330,7 @@ subtest 'pickup_locations' => sub { > $schema->storage->txn_rollback; > }; > >-subtest 'renewalbranch' => sub { >+subtest 'renewal_branchcode' => sub { > plan tests => 15; > > $schema->storage->txn_begin; >@@ -348,31 +348,31 @@ subtest 'renewalbranch' => sub { > C4::Context->interface( 'intranet' ); > t::lib::Mocks::mock_userenv({ branchcode => $branch->branchcode }); > >- is( $item->renewalbranch, $branch->branchcode, "If interface not opac, we get the branch from context"); >- is( $item->renewalbranch({ branch => "PANDA"}), $branch->branchcode, "If interface not opac, we get the branch from context even if we pass one in"); >+ is( $item->renewal_branchcode, $branch->branchcode, "If interface not opac, we get the branch from context"); >+ is( $item->renewal_branchcode({ branch => "PANDA"}), $branch->branchcode, "If interface not opac, we get the branch from context even if we pass one in"); > C4::Context->set_userenv(51, 'userid4tests', undef, 'firstname', 'surname', undef, undef, 0, undef, undef, undef ); #mock userenv doesn't let us set null branch >- is( $item->renewalbranch({ branch => "PANDA"}), "PANDA", "If interface not opac, we get the branch we pass one in if context not set"); >+ is( $item->renewal_branchcode({ branch => "PANDA"}), "PANDA", "If interface not opac, we get the branch we pass one in if context not set"); > > C4::Context->interface( 'opac' ); > > t::lib::Mocks::mock_preference('OpacRenewalBranch', undef); >- is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew"); >- is( $item->renewalbranch({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed"); >+ is( $item->renewal_branchcode, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew"); >+ is( $item->renewal_branchcode({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed"); > > t::lib::Mocks::mock_preference('OpacRenewalBranch', 'none'); >- is( $item->renewalbranch, '', "If interface opac and OpacRenewalBranch is none, we get blank string"); >- is( $item->renewalbranch({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is none, we get blank string even if branch passed"); >+ is( $item->renewal_branchcode, '', "If interface opac and OpacRenewalBranch is none, we get blank string"); >+ is( $item->renewal_branchcode({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is none, we get blank string even if branch passed"); > > t::lib::Mocks::mock_preference('OpacRenewalBranch', 'checkoutbranch'); >- is( $item->renewalbranch, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout"); >- is( $item->renewalbranch({branch=>'MONKEY'}), $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout even if branch passed"); >+ is( $item->renewal_branchcode, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout"); >+ is( $item->renewal_branchcode({branch=>'MONKEY'}), $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout even if branch passed"); > > t::lib::Mocks::mock_preference('OpacRenewalBranch','patronhomebranch'); >- is( $item->renewalbranch, $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron"); >- is( $item->renewalbranch({branch=>'TURKEY'}), $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron even if branch passed"); >+ is( $item->renewal_branchcode, $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron"); >+ is( $item->renewal_branchcode({branch=>'TURKEY'}), $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron even if branch passed"); > > t::lib::Mocks::mock_preference('OpacRenewalBranch','itemhomebranch'); >- is( $item->renewalbranch, $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item"); >- is( $item->renewalbranch({branch=>'MANATEE'}), $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item even if branch passed"); >+ is( $item->renewal_branchcode, $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item"); >+ is( $item->renewal_branchcode({branch=>'MANATEE'}), $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item even if branch passed"); > > }; >-- >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 24759
:
99763
|
99764
|
99780
|
99953
|
100002
|
100003
|
101238
|
101239
|
101240
|
101241
|
101242
|
101243
|
101244
|
101245
|
101285
|
101286
|
101287
|
101288
|
101289
|
101290
|
101291