Lines 2238-2266
sub add_extended_attribute {
Link Here
|
2238 |
my ( $self, $attribute ) = @_; |
2238 |
my ( $self, $attribute ) = @_; |
2239 |
|
2239 |
|
2240 |
my $change; |
2240 |
my $change; |
2241 |
if (C4::Context->preference("BorrowersLog")) { |
2241 |
if ( C4::Context->preference("BorrowersLog") ) { |
2242 |
my @attribute_values_before = map { $_->attribute } |
2242 |
my @attribute_values_before = |
2243 |
$self->extended_attributes->search({ 'me.code' => $attribute->{code} })->as_list; |
2243 |
map { $_->attribute } $self->extended_attributes->search( { 'me.code' => $attribute->{code} } )->as_list; |
2244 |
my @attribute_values_after = sort ($attribute->{attribute}, @attribute_values_before); |
2244 |
my @attribute_values_after = sort ( $attribute->{attribute}, @attribute_values_before ); |
2245 |
$change = { |
2245 |
$change = { |
2246 |
before => \@attribute_values_before, |
2246 |
before => \@attribute_values_before, |
2247 |
after => \@attribute_values_after |
2247 |
after => \@attribute_values_after |
2248 |
} |
2248 |
}; |
2249 |
} |
2249 |
} |
2250 |
|
2250 |
|
2251 |
my $added_attribute = Koha::Patron::Attribute->new( |
2251 |
my $added_attribute = Koha::Patron::Attribute->new( |
2252 |
{ |
2252 |
{ |
2253 |
%{$attribute}, |
2253 |
%{$attribute}, |
2254 |
( borrowernumber => $self->borrowernumber ), |
2254 |
( borrowernumber => $self->borrowernumber ), |
2255 |
} |
2255 |
} |
2256 |
)->store; |
2256 |
)->store; |
2257 |
|
2257 |
|
2258 |
if (C4::Context->preference("BorrowersLog")) { |
2258 |
if ( C4::Context->preference("BorrowersLog") ) { |
2259 |
logaction( |
2259 |
logaction( |
2260 |
"MEMBERS", |
2260 |
"MEMBERS", |
2261 |
"MODIFY", |
2261 |
"MODIFY", |
2262 |
$self->borrowernumber, |
2262 |
$self->borrowernumber, |
2263 |
"Patron attribute " . $attribute->{code} . ": " . to_json($change, { pretty => 1, canonical => 1 }) |
2263 |
"Patron attribute " . $attribute->{code} . ": " . to_json( $change, { pretty => 1, canonical => 1 } ) |
2264 |
); |
2264 |
); |
2265 |
} |
2265 |
} |
2266 |
|
2266 |
|