Bugzilla – Attachment 47762 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]
Bug 15758: Koha::Libraries - Move onlymine to C4::Context::only_my_library
Bug-15758-KohaLibraries---Move-onlymine-to-C4Conte.patch (text/plain), 4.15 KB, created by
Jonathan Druart
on 2016-02-08 17:46:21 UTC
(
hide
)
Description:
Bug 15758: Koha::Libraries - Move onlymine to C4::Context::only_my_library
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-08 17:46:21 UTC
Size:
4.15 KB
patch
obsolete
>From f78ca966f6305e1a0890e386de9c47be69c222c5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 5 Feb 2016 12:30:29 +0000 >Subject: [PATCH] Bug 15758: Koha::Libraries - Move onlymine to > C4::Context::only_my_library > >--- > C4/Branch.pm | 8 -------- > C4/Context.pm | 9 +++++++++ > C4/Utils/DataTables/Members.pm | 2 +- > Koha/Libraries.pm | 6 +----- > admin/smart-rules.pl | 2 +- > circ/overdue.pl | 7 ------- > members/member.pl | 2 +- > 7 files changed, 13 insertions(+), 23 deletions(-) > >diff --git a/C4/Branch.pm b/C4/Branch.pm >index 63ceafa..3f4354b 100644 >--- a/C4/Branch.pm >+++ b/C4/Branch.pm >@@ -50,14 +50,6 @@ The functions in this module deal with branches. > > =cut > >-sub onlymine { >- return >- C4::Context->preference('IndependentBranches') >- && C4::Context->userenv >- && !C4::Context->IsSuperLibrarian() >- && C4::Context->userenv->{branch}; >-} >- > =head2 GetBranch > > $branch = GetBranch( $query, $branches ); >diff --git a/C4/Context.pm b/C4/Context.pm >index 42fbcee..dec02af 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -1132,6 +1132,15 @@ sub mybranch { > C4::Context->userenv or return ''; > return C4::Context->userenv->{branch} || ''; > } >+sub only_my_library { >+ return >+ C4::Context->preference('IndependentBranches') >+ && C4::Context->userenv >+ && !C4::Context->IsSuperLibrarian() >+ && C4::Context->userenv->{branch}; >+} >+ >+ > > 1; > __END__ >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index 1ebecd7..724177e 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -25,7 +25,7 @@ sub search { > > # If branches are independent and user is not superlibrarian > # The search has to be only on the user branch >- if ( C4::Branch::onlymine ) { >+ if ( C4::Context::only_my_library ) { > my $userenv = C4::Context->userenv; > $branchcode = $userenv->{'branch'}; > >diff --git a/Koha/Libraries.pm b/Koha/Libraries.pm >index eb41184..4365730 100644 >--- a/Koha/Libraries.pm >+++ b/Koha/Libraries.pm >@@ -45,11 +45,7 @@ Koha::Libraries - Koha Library Object set class > sub search_filtered { > my ( $self, $params, $attributes ) = @_; > >- if ( C4::Context->preference('IndependentBranches') >- and C4::Context->userenv >- and not C4::Context->IsSuperLibrarian() >- and C4::Context->userenv->{branch} >- ) { >+ if ( C4::Context::only_my_library ) { > $params->{branchcode} = C4::Context->userenv->{branch}; > } > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 0363e74..5d95ee4 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -55,7 +55,7 @@ unless ( $branch ) { > $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch(); > } > else { >- $branch = C4::Branch::onlymine() ? ( C4::Context::mybranch() || '*' ) : '*'; >+ $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*'; > } > } > $branch = '*' if $branch eq 'NO_LIBRARY_SET'; >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 73b5251..6d59fb2 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -88,13 +88,6 @@ while (my ($itemtype, $description) =$req->fetchrow) { > itemtypename => $description, > }; > } >-my $onlymine = >- C4::Context->preference('IndependentBranches') >- && C4::Context->userenv >- && !C4::Context->IsSuperLibrarian() >- && C4::Context->userenv->{branch}; >- >-$branchfilter = C4::Context->userenv->{'branch'} if ($onlymine && !$branchfilter); > > # Filtering by Patron Attributes > # @patron_attr_filter_loop is non empty if there are any patron attribute filters >diff --git a/members/member.pl b/members/member.pl >index 130486f..a7e6e7e 100755 >--- a/members/member.pl >+++ b/members/member.pl >@@ -49,7 +49,7 @@ my $quicksearch = $input->param('quicksearch') // 0; > > if ( $quicksearch and $searchmember ) { > my $branchcode; >- if ( C4::Branch::onlymine ) { >+ if ( C4::Context::only_my_library ) { > my $userenv = C4::Context->userenv; > $branchcode = $userenv->{'branch'}; > } >-- >2.1.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 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