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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 256-262 sub get_template_and_user { Link Here
256
            );
256
            );
257
        }
257
        }
258
258
259
        $template->param( "USER_INFO" => $patron->unblessed );
259
        $template->param( "USER_INFO" => $patron->unblessed ) if $borrowernumber != 0;
260
260
261
        my $all_perms = get_all_subpermissions();
261
        my $all_perms = get_all_subpermissions();
262
262
(-)a/Koha/ArticleRequests.pm (-1 / +1 lines)
Lines 51-57 sub search_limited { Link Here
51
51
52
    my $userenv = C4::Context->userenv;
52
    my $userenv = C4::Context->userenv;
53
    my @restricted_branchcodes;
53
    my @restricted_branchcodes;
54
    if ( $userenv ) {
54
    if ( $userenv and $userenv->{number} ) {
55
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
55
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
56
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
56
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
57
    }
57
    }
(-)a/Koha/Libraries.pm (-1 / +2 lines)
Lines 46-52 sub search_filtered { Link Here
46
    my ( $self, $params, $attributes ) = @_;
46
    my ( $self, $params, $attributes ) = @_;
47
47
48
    my @branchcodes;
48
    my @branchcodes;
49
    if ( my $userenv = C4::Context->userenv ) {
49
    my $userenv = C4::Context->userenv;
50
    if ( $userenv and $userenv->{number} ) {
50
        my $only_from_group = $params->{only_from_group};
51
        my $only_from_group = $params->{only_from_group};
51
        if ( $only_from_group ) {
52
        if ( $only_from_group ) {
52
            my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
53
            my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
(-)a/Koha/Patron/Discharge.pm (-1 / +1 lines)
Lines 183-189 sub search_limited { Link Here
183
    my ( $params, $attributes ) = @_;
183
    my ( $params, $attributes ) = @_;
184
    my $userenv = C4::Context->userenv;
184
    my $userenv = C4::Context->userenv;
185
    my @restricted_branchcodes;
185
    my @restricted_branchcodes;
186
    if ( $userenv ) {
186
    if ( $userenv and $userenv->{number} ) {
187
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
187
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
188
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
188
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
189
    }
189
    }
(-)a/Koha/Patron/Modifications.pm (-1 / +1 lines)
Lines 54-60 sub pending_count { Link Here
54
54
55
    my $userenv = C4::Context->userenv;
55
    my $userenv = C4::Context->userenv;
56
    my @branchcodes;
56
    my @branchcodes;
57
    if ( $userenv ) {
57
    if ( $userenv and $userenv->{number} ) {
58
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
58
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
59
        if ($branchcode) {
59
        if ($branchcode) {
60
            return 0 unless $logged_in_user->can_see_patrons_from($branchcode);
60
            return 0 unless $logged_in_user->can_see_patrons_from($branchcode);
(-)a/Koha/Patrons.pm (-1 / +1 lines)
Lines 54-60 sub search_limited { Link Here
54
54
55
    my $userenv = C4::Context->userenv;
55
    my $userenv = C4::Context->userenv;
56
    my @restricted_branchcodes;
56
    my @restricted_branchcodes;
57
    if ( $userenv ) {
57
    if ( $userenv and $userenv->{number} ) {
58
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
58
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
59
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
59
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
60
    }
60
    }
(-)a/Koha/Reviews.pm (-1 / +1 lines)
Lines 48-54 sub search_limited { Link Here
48
48
49
    my $userenv = C4::Context->userenv;
49
    my $userenv = C4::Context->userenv;
50
    my @restricted_branchcodes;
50
    my @restricted_branchcodes;
51
    if ( $userenv ) {
51
    if ( $userenv and $userenv->{number} ) {
52
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
52
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
53
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
53
        @restricted_branchcodes = $logged_in_user->libraries_where_can_see_patrons;
54
    }
54
    }
(-)a/members/member-flags.pl (-2 / +5 lines)
Lines 41-48 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
41
        debug           => 1,
41
        debug           => 1,
42
});
42
});
43
43
44
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
44
my $userenv = C4::Context->userenv;
45
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
45
if ( $userenv and $userenv->{number} ) { # Allow DB user to create a superlibrarian patron
46
    my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
47
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
48
}
46
49
47
my %member2;
50
my %member2;
48
$member2{'borrowernumber'}=$member;
51
$member2{'borrowernumber'}=$member;
(-)a/members/memberentry.pl (-4 / +5 lines)
Lines 76-84 my ($template, $loggedinuser, $cookie) Link Here
76
       });
76
       });
77
77
78
my $borrowernumber = $input->param('borrowernumber');
78
my $borrowernumber = $input->param('borrowernumber');
79
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
80
my $patron         = Koha::Patrons->find($borrowernumber);
79
my $patron         = Koha::Patrons->find($borrowernumber);
81
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
80
my $userenv = C4::Context->userenv;
81
if ( $userenv and $userenv->{number} ) { # Allow DB user to create a superlibrarian patron
82
    my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
83
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
84
}
82
85
83
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
86
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
84
    my @providers = Koha::SMS::Providers->search();
87
    my @providers = Koha::SMS::Providers->search();
Lines 106-113 my $step = $input->param('step') || 0; Link Here
106
my @errors;
109
my @errors;
107
my $borrower_data;
110
my $borrower_data;
108
my $NoUpdateLogin;
111
my $NoUpdateLogin;
109
my $userenv = C4::Context->userenv;
110
111
112
112
## Deal with debarments
113
## Deal with debarments
113
$template->param(
114
$template->param(
(-)a/members/moremember.pl (-4 / +5 lines)
Lines 119-127 my $borrowernumber = $input->param('borrowernumber'); Link Here
119
my $error = $input->param('error');
119
my $error = $input->param('error');
120
$template->param( error => $error ) if ( $error );
120
$template->param( error => $error ) if ( $error );
121
121
122
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
123
my $patron         = Koha::Patrons->find( $borrowernumber );
122
my $patron         = Koha::Patrons->find( $borrowernumber );
124
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
123
my $userenv = C4::Context->userenv;
124
if ( $userenv and $userenv->{number} ) { # Allow DB user to create a superlibrarian patron
125
    my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
126
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
127
}
125
128
126
my $issues        = $patron->checkouts;
129
my $issues        = $patron->checkouts;
127
my $balance       = $patron->account->balance;
130
my $balance       = $patron->account->balance;
Lines 196-202 $bor{'borrowernumber'} = $borrowernumber; Link Here
196
# Converts the branchcode to the branch name
199
# Converts the branchcode to the branch name
197
my $samebranch;
200
my $samebranch;
198
if ( C4::Context->preference("IndependentBranches") ) {
201
if ( C4::Context->preference("IndependentBranches") ) {
199
    my $userenv = C4::Context->userenv;
200
    if ( C4::Context->IsSuperLibrarian() ) {
202
    if ( C4::Context->IsSuperLibrarian() ) {
201
        $samebranch = 1;
203
        $samebranch = 1;
202
    }
204
    }
203
- 

Return to bug 18403