Bugzilla – Attachment 54039 Details for
Bug 15758
Move the C4::Branch related code to Koha::Libraries - part 4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 15758: Koha::Libraries - Move mybranch to C4::Context
SIGNED-OFF-Bug-15758-KohaLibraries---Move-mybranch.patch (text/plain), 5.20 KB, created by
Owen Leonard
on 2016-08-05 12:44:13 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 15758: Koha::Libraries - Move mybranch to C4::Context
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-08-05 12:44:13 UTC
Size:
5.20 KB
patch
obsolete
>From 268301a0018a37e17e9908f83b0b7fe07c2828a8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 4 Feb 2016 15:24:12 +0000 >Subject: [PATCH] [SIGNED-OFF] Bug 15758: Koha::Libraries - Move mybranch to > C4::Context >Content-Type: text/plain; charset="utf-8" > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > C4/Branch.pm | 9 +-------- > C4/Circulation.pm | 4 ++-- > admin/branch_transfer_limits.pl | 4 ++-- > admin/smart-rules.pl | 4 ++-- > t/db_dependent/Branch.t | 4 ---- > tools/letter.pl | 2 +- > tools/overduerules.pl | 2 +- > 7 files changed, 9 insertions(+), 20 deletions(-) > >diff --git a/C4/Branch.pm b/C4/Branch.pm >index f2d7bf1..7f1b713 100644 >--- a/C4/Branch.pm >+++ b/C4/Branch.pm >@@ -29,9 +29,8 @@ BEGIN { > @EXPORT = qw( > &GetBranch > &GetBranches >- &mybranch > ); >- @EXPORT_OK = qw( &onlymine &mybranch ); >+ @EXPORT_OK = qw( &onlymine ); > } > > =head1 NAME >@@ -126,12 +125,6 @@ sub onlymine { > && C4::Context->userenv->{branch}; > } > >-# always returns a string for OK comparison via "eq" or "ne" >-sub mybranch { >- C4::Context->userenv or return ''; >- return C4::Context->userenv->{branch} || ''; >-} >- > =head2 GetBranch > > $branch = GetBranch( $query, $branches ); >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 4826487..c80723d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -170,7 +170,7 @@ System Pref options. > # > sub barcodedecode { > my ($barcode, $filter) = @_; >- my $branch = C4::Branch::mybranch(); >+ my $branch = C4::Context::mybranch(); > $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter; > $filter or return $barcode; # ensure filter is defined, else return untouched barcode > if ($filter eq 'whitespace') { >@@ -3290,7 +3290,7 @@ sub GetIssuingCharges { > if ( my $item_data = $sth->fetchrow_hashref ) { > $item_type = $item_data->{itemtype}; > $charge = $item_data->{rentalcharge}; >- my $branch = C4::Branch::mybranch(); >+ my $branch = C4::Context::mybranch(); > my $discount_query = q|SELECT rentaldiscount, > issuingrules.itemtype, issuingrules.branchcode > FROM borrowers >diff --git a/admin/branch_transfer_limits.pl b/admin/branch_transfer_limits.pl >index d1e59c7..b745136 100755 >--- a/admin/branch_transfer_limits.pl >+++ b/admin/branch_transfer_limits.pl >@@ -41,9 +41,9 @@ my ($template, $loggedinuser, $cookie) > > my $dbh = C4::Context->dbh; > my $branchcode; >-if((!defined($input->param('branchcode'))) & mybranch() ne '') >+if((!defined($input->param('branchcode'))) & C4::Context::mybranch() ne '') > { >- $branchcode = mybranch(); >+ $branchcode = C4::Context::mybranch(); > } > else > { >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 737dcb6..4103e2b 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -55,10 +55,10 @@ my $type=$input->param('type'); > my $branch = $input->param('branch'); > unless ( $branch ) { > if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) { >- $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Branch::mybranch(); >+ $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch(); > } > else { >- $branch = C4::Branch::onlymine() ? ( C4::Branch::mybranch() || '*' ) : '*'; >+ $branch = C4::Branch::onlymine() ? ( C4::Context::mybranch() || '*' ) : '*'; > } > } > $branch = '*' if $branch eq 'NO_LIBRARY_SET'; >diff --git a/t/db_dependent/Branch.t b/t/db_dependent/Branch.t >index 348adb3..9d4a5b9 100644 >--- a/t/db_dependent/Branch.t >+++ b/t/db_dependent/Branch.t >@@ -38,7 +38,6 @@ can_ok( > 'C4::Branch', qw( > GetBranch > GetBranches >- mybranch > ) > ); > >@@ -194,7 +193,4 @@ is_deeply( $b2info->get_categories->count, 1, 'BRB has the category CAT1' ); > Koha::LibraryCategory->new($cat2)->store; > is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two categories added" ); > >-#TODO later: test mybranchine and onlymine >-# Actually we cannot mock C4::Context->userenv in unit tests >- > $schema->storage->txn_rollback; >diff --git a/tools/letter.pl b/tools/letter.pl >index 0f72cd6..39b2aa2 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -358,7 +358,7 @@ sub default_display { > > unless ( defined $branchcode ) { > if ( C4::Context->preference('DefaultToLoggedInLibraryNoticesSlips') ) { >- $branchcode = C4::Branch::mybranch(); >+ $branchcode = C4::Context::mybranch(); > } > } > >diff --git a/tools/overduerules.pl b/tools/overduerules.pl >index f21092d..5c35a8c 100755 >--- a/tools/overduerules.pl >+++ b/tools/overduerules.pl >@@ -74,7 +74,7 @@ my $type = $input->param('type'); > my $branch = $input->param('branch'); > $branch = > defined $branch ? $branch >- : C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? C4::Branch::mybranch() >+ : C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? C4::Context::mybranch() > : Koha::Libraries->search->count() == 1 ? undef > : undef; > $branch ||= q{}; >-- >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 15758
:
47746
|
47747
|
47748
|
47749
|
47750
|
47751
|
47752
|
47753
|
47759
|
47760
|
47761
|
47762
|
47763
|
47764
|
47765
|
52723
|
52724
|
52726
|
52727
|
52728
|
52729
|
52730
|
52731
|
52736
|
52788
|
52789
|
52790
|
52791
|
52792
|
52793
|
52794
|
52795
|
52913
|
52914
|
52915
|
52916
|
52917
|
52918
|
52919
|
52920
|
53893
|
53894
|
53895
|
53896
|
53897
|
53898
|
53899
|
53900
|
53997
|
53998
|
53999
|
54000
|
54001
|
54002
|
54003
|
54004
|
54029
|
54030
|
54031
|
54032
|
54033
|
54034
|
54035
|
54036
|
54037
|
54038
|
54039
|
54040
|
54041
|
54042
|
54043
|
54044
|
54861
|
54862
|
54863
|
54864
|
54865
|
54866
|
54867
|
54868
|
54908
|
54909
|
54921
|
54925
|
55061
|
55062
|
55063
|
55064
|
55065
|
55066
|
55067
|
55068
|
55069
|
55070
|
55071
|
55072
|
55073
|
55346
|
55347
|
55348
|
55349
|
55350
|
55351
|
55352
|
55353
|
55354
|
55355
|
55356
|
55357
|
55358
|
55445