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 1185-1190 sub mybranch { Link Here
1185
    C4::Context->userenv           or return '';
1185
    C4::Context->userenv           or return '';
1186
    return C4::Context->userenv->{branch} || '';
1186
    return C4::Context->userenv->{branch} || '';
1187
}
1187
}
1188
sub only_my_library {
1189
    return
1190
         C4::Context->preference('IndependentBranches')
1191
      && C4::Context->userenv
1192
      && !C4::Context->IsSuperLibrarian()
1193
      && C4::Context->userenv->{branch};
1194
}
1195
1196
1188
1197
1189
1;
1198
1;
1190
__END__
1199
__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 55-61 unless ( $branch ) { Link Here
55
        $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
55
        $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
56
    }
56
    }
57
    else {
57
    else {
58
        $branch = C4::Branch::onlymine() ? ( C4::Context::mybranch() || '*' ) : '*';
58
        $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
59
    }
59
    }
60
}
60
}
61
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
61
$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