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 1145-1150 sub mybranch { Link Here
1145
    C4::Context->userenv           or return '';
1145
    C4::Context->userenv           or return '';
1146
    return C4::Context->userenv->{branch} || '';
1146
    return C4::Context->userenv->{branch} || '';
1147
}
1147
}
1148
sub only_my_library {
1149
    return
1150
         C4::Context->preference('IndependentBranches')
1151
      && C4::Context->userenv
1152
      && !C4::Context->IsSuperLibrarian()
1153
      && C4::Context->userenv->{branch};
1154
}
1155
1156
1148
1157
1149
1;
1158
1;
1150
__END__
1159
__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 88-100 while (my ($itemtype, $description) =$req->fetchrow) { Link Here
88
        itemtypename => $description,
88
        itemtypename => $description,
89
    };
89
    };
90
}
90
}
91
my $onlymine =
92
     C4::Context->preference('IndependentBranches')
93
  && C4::Context->userenv
94
  && !C4::Context->IsSuperLibrarian()
95
  && C4::Context->userenv->{branch};
96
97
$branchfilter = C4::Context->userenv->{'branch'} if ($onlymine && !$branchfilter);
98
91
99
# Filtering by Patron Attributes
92
# Filtering by Patron Attributes
100
#  @patron_attr_filter_loop        is non empty if there are any patron attribute filters
93
#  @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