|
Lines 2256-2266
sub add_extended_attribute {
Link Here
|
| 2256 |
)->store; |
2256 |
)->store; |
| 2257 |
|
2257 |
|
| 2258 |
if ( C4::Context->preference("BorrowersLog") ) { |
2258 |
if ( C4::Context->preference("BorrowersLog") ) { |
|
|
2259 |
my $code = $attribute->{code}; |
| 2259 |
logaction( |
2260 |
logaction( |
| 2260 |
"MEMBERS", |
2261 |
"MEMBERS", |
| 2261 |
"MODIFY", |
2262 |
"MODIFY", |
| 2262 |
$self->borrowernumber, |
2263 |
$self->borrowernumber, |
| 2263 |
"Patron attribute " . $attribute->{code} . ": " . to_json( $change, { pretty => 1, canonical => 1 } ) |
2264 |
to_json( { "attribute.$code" => $change }, { pretty => 1, canonical => 1 } ) |
| 2264 |
); |
2265 |
); |
| 2265 |
} |
2266 |
} |
| 2266 |
|
2267 |
|
|
Lines 2325-2330
sub extended_attributes {
Link Here
|
| 2325 |
my $schema = $self->_result->result_source->schema; |
2326 |
my $schema = $self->_result->result_source->schema; |
| 2326 |
$schema->txn_do( |
2327 |
$schema->txn_do( |
| 2327 |
sub { |
2328 |
sub { |
|
|
2329 |
my $all_changes = {}; |
| 2328 |
while ( my ( $repeatable, $changes ) = each %attribute_changes ) { |
2330 |
while ( my ( $repeatable, $changes ) = each %attribute_changes ) { |
| 2329 |
while ( my ( $code, $change ) = each %{$changes} ) { |
2331 |
while ( my ( $code, $change ) = each %{$changes} ) { |
| 2330 |
$change->{before} //= []; |
2332 |
$change->{before} //= []; |
|
Lines 2348-2361
sub extended_attributes {
Link Here
|
| 2348 |
$attribute->store() if ( $attribute->code eq $code ); |
2350 |
$attribute->store() if ( $attribute->code eq $code ); |
| 2349 |
} |
2351 |
} |
| 2350 |
if ( C4::Context->preference("BorrowersLog") ) { |
2352 |
if ( C4::Context->preference("BorrowersLog") ) { |
| 2351 |
logaction( |
2353 |
$all_changes->{"attribute.$code"} = $change; |
| 2352 |
"MEMBERS", |
|
|
| 2353 |
"MODIFY", |
| 2354 |
$self->borrowernumber, |
| 2355 |
"Patron attribute " |
| 2356 |
. $code . ": " |
| 2357 |
. to_json( $change, { pretty => 1, canonical => 1 } ) |
| 2358 |
); |
| 2359 |
} |
2354 |
} |
| 2360 |
} |
2355 |
} |
| 2361 |
} |
2356 |
} |
|
Lines 2386-2391
sub extended_attributes {
Link Here
|
| 2386 |
type => $type, |
2381 |
type => $type, |
| 2387 |
) if !$new_types->{$type}; |
2382 |
) if !$new_types->{$type}; |
| 2388 |
} |
2383 |
} |
|
|
2384 |
if ( %{$all_changes} ) { |
| 2385 |
logaction( |
| 2386 |
"MEMBERS", |
| 2387 |
"MODIFY", |
| 2388 |
$self->borrowernumber, |
| 2389 |
to_json( $all_changes, { pretty => 1, canonical => 1 } ) |
| 2390 |
); |
| 2391 |
} |
| 2389 |
} |
2392 |
} |
| 2390 |
); |
2393 |
); |
| 2391 |
} |
2394 |
} |