Bug 26744: Cosolidate changes and change log format
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
d4c11de65d
commit
09801ed302
2 changed files with 13 additions and 10 deletions
|
@ -2256,11 +2256,12 @@ sub add_extended_attribute {
|
|||
)->store;
|
||||
|
||||
if ( C4::Context->preference("BorrowersLog") ) {
|
||||
my $code = $attribute->{code};
|
||||
logaction(
|
||||
"MEMBERS",
|
||||
"MODIFY",
|
||||
$self->borrowernumber,
|
||||
"Patron attribute " . $attribute->{code} . ": " . to_json( $change, { pretty => 1, canonical => 1 } )
|
||||
to_json( { "attribute.$code" => $change }, { pretty => 1, canonical => 1 } )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2325,6 +2326,7 @@ sub extended_attributes {
|
|||
my $schema = $self->_result->result_source->schema;
|
||||
$schema->txn_do(
|
||||
sub {
|
||||
my $all_changes = {};
|
||||
while ( my ( $repeatable, $changes ) = each %attribute_changes ) {
|
||||
while ( my ( $code, $change ) = each %{$changes} ) {
|
||||
$change->{before} //= [];
|
||||
|
@ -2348,14 +2350,7 @@ sub extended_attributes {
|
|||
$attribute->store() if ( $attribute->code eq $code );
|
||||
}
|
||||
if ( C4::Context->preference("BorrowersLog") ) {
|
||||
logaction(
|
||||
"MEMBERS",
|
||||
"MODIFY",
|
||||
$self->borrowernumber,
|
||||
"Patron attribute "
|
||||
. $code . ": "
|
||||
. to_json( $change, { pretty => 1, canonical => 1 } )
|
||||
);
|
||||
$all_changes->{"attribute.$code"} = $change;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2386,6 +2381,14 @@ sub extended_attributes {
|
|||
type => $type,
|
||||
) if !$new_types->{$type};
|
||||
}
|
||||
if ( %{$all_changes} ) {
|
||||
logaction(
|
||||
"MEMBERS",
|
||||
"MODIFY",
|
||||
$self->borrowernumber,
|
||||
to_json( $all_changes, { pretty => 1, canonical => 1 } )
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -543,7 +543,7 @@ subtest 'action log tests' => sub {
|
|||
}
|
||||
}
|
||||
}
|
||||
return "Patron attribute " . $code . ": " . to_json( $change, { pretty => 1, canonical => 1 } );
|
||||
return to_json( { "attribute.$code" => $change }, { pretty => 1, canonical => 1 } );
|
||||
};
|
||||
|
||||
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
|
|
Loading…
Reference in a new issue