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

(-)a/Koha/PseudonymizedTransaction.pm (-8 / +14 lines)
Lines 98-112 sub create_from_statistic { Link Here
98
98
99
    $self->store();
99
    $self->store();
100
100
101
    if ( $patron && Koha::Patron::Attribute::Types->search( { keep_for_pseudonymization => 1 } )->count > 0 ) {
101
    if ($patron) {
102
        my $extended_attributes = $patron->extended_attributes->unblessed;
102
        my @kept_types = Koha::Patron::Attribute::Types->search(
103
        for my $attribute (@$extended_attributes) {
103
            { keep_for_pseudonymization => 1 },
104
            next unless Koha::Patron::Attribute::Types->find( $attribute->{code} )->keep_for_pseudonymization;
104
            { columns                   => ['code'] }
105
        )->get_column('code');
106
107
        if (@kept_types) {
108
            my $extended_attributes =
109
                $patron->extended_attributes->search( { code => { -in => \@kept_types } } )->unblessed;
105
110
106
            delete $attribute->{id};
111
            for my $attribute (@$extended_attributes) {
107
            delete $attribute->{borrowernumber};
112
                delete $attribute->{id};
113
                delete $attribute->{borrowernumber};
108
114
109
            $self->_result->create_related( 'pseudonymized_borrower_attributes', $attribute );
115
                $self->_result->create_related( 'pseudonymized_borrower_attributes', $attribute );
116
            }
110
        }
117
        }
111
    }
118
    }
112
119
113
- 

Return to bug 39322