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

(-)a/C4/Members.pm (-17 / +1 lines)
Lines 150-161 with a true value. Link Here
150
150
151
See patronflags for more details.
151
See patronflags for more details.
152
152
153
C<$borrower-E<gt>{authflags}> is a hash giving more detailed information
154
about the top-level permissions flags set for the borrower.  For example,
155
if a user has the "editcatalogue" permission,
156
C<$borrower-E<gt>{authflags}-E<gt>{editcatalogue}> will exist and have
157
the value "1".
158
159
=cut
153
=cut
160
154
161
sub GetMemberDetails {
155
sub GetMemberDetails {
Lines 198-214 sub GetMemberDetails { Link Here
198
    $borrower->{'amountoutstanding'} = $amount;
192
    $borrower->{'amountoutstanding'} = $amount;
199
    # FIXME - patronflags calls GetMemberAccountRecords... just have patronflags return $amount
193
    # FIXME - patronflags calls GetMemberAccountRecords... just have patronflags return $amount
200
    my $flags = patronflags( $borrower);
194
    my $flags = patronflags( $borrower);
201
    my $accessflagshash;
202
203
    $sth = $dbh->prepare("select bit,flag from userflags");
204
    $sth->execute;
205
    while ( my ( $bit, $flag ) = $sth->fetchrow ) {
206
        if ( $borrower->{'flags'} && $borrower->{'flags'} & 2**$bit ) {
207
            $accessflagshash->{$flag} = 1;
208
        }
209
    }
210
    $borrower->{'flags'}     = $flags;
195
    $borrower->{'flags'}     = $flags;
211
    $borrower->{'authflags'} = $accessflagshash;
212
196
213
    $borrower->{'is_expired'} = 0;
197
    $borrower->{'is_expired'} = 0;
214
    $borrower->{'is_expired'} = 1 if
198
    $borrower->{'is_expired'} = 1 if
Lines 217-223 sub GetMemberDetails { Link Here
217
      Date_to_Days( Today() ) >
201
      Date_to_Days( Today() ) >
218
      Date_to_Days( split /-/, $borrower->{'dateexpiry'} );
202
      Date_to_Days( split /-/, $borrower->{'dateexpiry'} );
219
203
220
    return ($borrower);    #, $flags, $accessflagshash);
204
    return ($borrower);
221
}
205
}
222
206
223
=head2 patronflags
207
=head2 patronflags
(-)a/members/member-flags.pl (-6 / +15 lines)
Lines 24-30 my $input = new CGI; Link Here
24
24
25
my $flagsrequired = { permissions => 1 };
25
my $flagsrequired = { permissions => 1 };
26
my $member=$input->param('member');
26
my $member=$input->param('member');
27
my $bor = GetMemberDetails( $member,'');
27
my $bor = GetMember( borrowernumber => $member );
28
if( $bor->{'category_type'} eq 'S' )  {
28
if( $bor->{'category_type'} eq 'S' )  {
29
	$flagsrequired->{'staffaccess'} = 1;
29
	$flagsrequired->{'staffaccess'} = 1;
30
}
30
}
Lines 85-99 if ($input->param('newflags')) { Link Here
85
    
85
    
86
    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
86
    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
87
} else {
87
} else {
88
#     my ($bor,$flags,$accessflags)=GetMemberDetails($member,'');
88
89
    my $flags = $bor->{'flags'};
89
    my $flags = $bor->{'flags'};
90
    my $accessflags = $bor->{'authflags'};
90
    my $accessflags;
91
    my $dbh=C4::Context->dbh();
91
    my $dbh = C4::Context->dbh();
92
    # FIXME This needs to be improved to avoid doing the same query
93
    my $sth = $dbh->prepare("select bit,flag from userflags");
94
    $sth->execute;
95
    while ( my ( $bit, $flag ) = $sth->fetchrow ) {
96
        if ( $bor->{flags} && $bor->{flags} & 2**$bit ) {
97
            $accessflags->{$flag} = 1;
98
        }
99
    }
100
92
    my $all_perms  = get_all_subpermissions();
101
    my $all_perms  = get_all_subpermissions();
93
    my $user_perms = get_user_subpermissions($bor->{'userid'});
102
    my $user_perms = get_user_subpermissions($bor->{'userid'});
94
    my $sth=$dbh->prepare("SELECT bit, flag FROM userflags ORDER BY bit");
103
    $sth = $dbh->prepare("SELECT bit, flag FROM userflags ORDER BY bit");
95
    $sth->execute;
104
    $sth->execute;
96
    my @loop;
105
    my @loop;
106
97
    while (my ($bit, $flag) = $sth->fetchrow) {
107
    while (my ($bit, $flag) = $sth->fetchrow) {
98
	    my $checked='';
108
	    my $checked='';
99
	    if ($accessflags->{$flag}) {
109
	    if ($accessflags->{$flag}) {
100
- 

Return to bug 17578