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

(-)a/Koha/Patron.pm (-5 / +9 lines)
Lines 1671-1677 sub anonymize { Link Here
1671
        split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') };
1671
        split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') };
1672
    $mandatory->{userid} = 1; # needed since sub store does not clear field
1672
    $mandatory->{userid} = 1; # needed since sub store does not clear field
1673
    my @columns = $self->_result->result_source->columns;
1673
    my @columns = $self->_result->result_source->columns;
1674
    @columns = grep { !/borrowernumber|branchcode|categorycode|^date|password|flags|updated_on|lastseen|lang|login_attempts|anonymized/ } @columns;
1674
    @columns = grep { !/borrowernumber|branchcode|categorycode|^date|password|updated_on|lastseen|lang|login_attempts|anonymized/ } @columns;
1675
    push @columns, 'dateofbirth'; # add this date back in
1675
    push @columns, 'dateofbirth'; # add this date back in
1676
    foreach my $col (@columns) {
1676
    foreach my $col (@columns) {
1677
        $self->_anonymize_column($col, $mandatory->{lc $col} );
1677
        $self->_anonymize_column($col, $mandatory->{lc $col} );
Lines 1796-1802 sub to_api_mapping { Link Here
1796
        debarred            => undef,                     # replaced by 'restricted'
1796
        debarred            => undef,                     # replaced by 'restricted'
1797
        debarredcomment     => undef,    # calculated, API consumers will use /restrictions instead
1797
        debarredcomment     => undef,    # calculated, API consumers will use /restrictions instead
1798
        emailpro            => 'secondary_email',
1798
        emailpro            => 'secondary_email',
1799
        flags               => undef,    # permissions manipulation handled in /permissions
1800
        gonenoaddress       => 'incorrect_address',
1799
        gonenoaddress       => 'incorrect_address',
1801
        guarantorid         => 'guarantor_id',
1800
        guarantorid         => 'guarantor_id',
1802
        lastseen            => 'last_seen',
1801
        lastseen            => 'last_seen',
Lines 1913-1918 sub queue_notice { Link Here
1913
1912
1914
=head3 has_permission
1913
=head3 has_permission
1915
1914
1915
my $bool = $patron->has_permission( { $top_level_perm => $sub_perm } );
1916
my $bool = $patron->has_permission( $permission_code );
1916
my $bool = $patron->has_permission( $permission_code );
1917
1917
1918
=cut
1918
=cut
Lines 1920-1931 my $bool = $patron->has_permission( $permission_code ); Link Here
1920
sub has_permission {
1920
sub has_permission {
1921
    my ( $self, $code ) = @_;
1921
    my ( $self, $code ) = @_;
1922
1922
1923
    return Koha::Patron::Permissions->find(
1923
    if ( ref $code eq 'HASH' ) {
1924
        my ( $pri, $sec ) = %$code;
1925
        $code = $sec eq '1' ? $pri : { '-in' => [ $pri, $sec ] };
1926
    }
1927
1928
    return Koha::Patron::Permissions->search(
1924
        {
1929
        {
1925
            borrowernumber => $self->id,
1930
            borrowernumber => $self->id,
1926
            code           => $code,
1931
            code           => $code,
1927
        }
1932
        }
1928
    ) ? 1 : 0;
1933
    )->count;
1929
}
1934
}
1930
1935
1931
=head3 set_permissions
1936
=head3 set_permissions
1932
- 

Return to bug 20813