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

(-)a/C4/Branch.pm (-8 lines)
Lines 50-63 The functions in this module deal with branches. Link Here
50
50
51
=cut
51
=cut
52
52
53
sub onlymine {
54
    return
55
         C4::Context->preference('IndependentBranches')
56
      && C4::Context->userenv
57
      && !C4::Context->IsSuperLibrarian()
58
      && C4::Context->userenv->{branch};
59
}
60
61
=head2 GetBranch
53
=head2 GetBranch
62
54
63
$branch = GetBranch( $query, $branches );
55
$branch = GetBranch( $query, $branches );
(-)a/C4/Context.pm (+9 lines)
Lines 1132-1137 sub mybranch { Link Here
1132
    C4::Context->userenv           or return '';
1132
    C4::Context->userenv           or return '';
1133
    return C4::Context->userenv->{branch} || '';
1133
    return C4::Context->userenv->{branch} || '';
1134
}
1134
}
1135
sub only_my_library {
1136
    return
1137
         C4::Context->preference('IndependentBranches')
1138
      && C4::Context->userenv
1139
      && !C4::Context->IsSuperLibrarian()
1140
      && C4::Context->userenv->{branch};
1141
}
1142
1143
1135
1144
1136
1;
1145
1;
1137
__END__
1146
__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