View | Details | Raw Unified | Return to bug 15758
Collapse All | Expand All

(-)a/C4/Branch.pm (-8 lines)
Lines 48-61 The functions in this module deal with branches. Link Here
48
48
49
=cut
49
=cut
50
50
51
sub onlymine {
52
    return
53
         C4::Context->preference('IndependentBranches')
54
      && C4::Context->userenv
55
      && !C4::Context->IsSuperLibrarian()
56
      && C4::Context->userenv->{branch};
57
}
58
59
=head2 GetBranch
51
=head2 GetBranch
60
52
61
$branch = GetBranch( $query, $branches );
53
$branch = GetBranch( $query, $branches );
(-)a/C4/Context.pm (+9 lines)
Lines 1035-1040 sub mybranch { Link Here
1035
    C4::Context->userenv           or return '';
1035
    C4::Context->userenv           or return '';
1036
    return C4::Context->userenv->{branch} || '';
1036
    return C4::Context->userenv->{branch} || '';
1037
}
1037
}
1038
sub only_my_library {
1039
    return
1040
         C4::Context->preference('IndependentBranches')
1041
      && C4::Context->userenv
1042
      && !C4::Context->IsSuperLibrarian()
1043
      && C4::Context->userenv->{branch};
1044
}
1045
1046
1038
1047
1039
1;
1048
1;
1040
__END__
1049
__END__
(-)a/C4/Utils/DataTables/Members.pm (-1 / +1 lines)
Lines 25-31 sub search { Link Here
25
25
26
    # If branches are independent and user is not superlibrarian
26
    # If branches are independent and user is not superlibrarian
27
    # The search has to be only on the user branch
27
    # The search has to be only on the user branch
28
    if ( C4::Branch::onlymine ) {
28
    if ( C4::Context::only_my_library ) {
29
        my $userenv = C4::Context->userenv;
29
        my $userenv = C4::Context->userenv;
30
        $branchcode = $userenv->{'branch'};
30
        $branchcode = $userenv->{'branch'};
31
31
(-)a/Koha/Libraries.pm (-5 / +1 lines)
Lines 45-55 Koha::Libraries - Koha Library Object set class Link Here
45
sub search_filtered {
45
sub search_filtered {
46
    my ( $self, $params, $attributes ) = @_;
46
    my ( $self, $params, $attributes ) = @_;
47
47
48
    if (    C4::Context->preference('IndependentBranches')
48
    if ( C4::Context::only_my_library ) {
49
        and C4::Context->userenv
50
        and not C4::Context->IsSuperLibrarian()
51
        and C4::Context->userenv->{branch}
52
    ) {
53
        $params->{branchcode} = C4::Context->userenv->{branch};
49
        $params->{branchcode} = C4::Context->userenv->{branch};
54
    }
50
    }
55
51
(-)a/admin/smart-rules.pl (-1 / +1 lines)
Lines 58-64 unless ( $branch ) { Link Here
58
        $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
58
        $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
59
    }
59
    }
60
    else {
60
    else {
61
        $branch = C4::Branch::onlymine() ? ( C4::Context::mybranch() || '*' ) : '*';
61
        $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
62
    }
62
    }
63
}
63
}
64
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
64
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
(-)a/circ/overdue.pl (-7 lines)
Lines 89-101 while (my ($itemtype, $description) =$req->fetchrow) { Link Here
89
        itemtypename => $description,
89
        itemtypename => $description,
90
    };
90
    };
91
}
91
}
92
my $onlymine =
93
     C4::Context->preference('IndependentBranches')
94
  && C4::Context->userenv
95
  && !C4::Context->IsSuperLibrarian()
96
  && C4::Context->userenv->{branch};
97
98
$branchfilter = C4::Context->userenv->{'branch'} if ($onlymine && !$branchfilter);
99
92
100
# Filtering by Patron Attributes
93
# Filtering by Patron Attributes
101
#  @patron_attr_filter_loop        is non empty if there are any patron attribute filters
94
#  @patron_attr_filter_loop        is non empty if there are any patron attribute filters
(-)a/members/member.pl (-2 / +1 lines)
Lines 49-55 my $quicksearch = $input->param('quicksearch') // 0; Link Here
49
49
50
if ( $quicksearch and $searchmember ) {
50
if ( $quicksearch and $searchmember ) {
51
    my $branchcode;
51
    my $branchcode;
52
    if ( C4::Branch::onlymine ) {
52
    if ( C4::Context::only_my_library ) {
53
        my $userenv = C4::Context->userenv;
53
        my $userenv = C4::Context->userenv;
54
        $branchcode = $userenv->{'branch'};
54
        $branchcode = $userenv->{'branch'};
55
    }
55
    }
56
- 

Return to bug 15758