|
Lines 18-24
Link Here
|
| 18 |
# along with Koha; if not, see <https://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <https://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use JSON qw( to_json ); |
21 |
use JSON qw( encode_json from_json ); |
| 22 |
|
22 |
|
| 23 |
use Test::NoWarnings; |
23 |
use Test::NoWarnings; |
| 24 |
use Test::More tests => 5; |
24 |
use Test::More tests => 5; |
|
Lines 531-550
subtest 'action log tests' => sub {
Link Here
|
| 531 |
|
531 |
|
| 532 |
my $get_info = sub { |
532 |
my $get_info = sub { |
| 533 |
my ( $before, $after, $code, $repeatable ) = @_; |
533 |
my ( $before, $after, $code, $repeatable ) = @_; |
| 534 |
my $change = { |
|
|
| 535 |
before => $before, |
| 536 |
after => $after |
| 537 |
}; |
| 538 |
if ($repeatable) { |
534 |
if ($repeatable) { |
| 539 |
while ( my ( $k, $v ) = each %{$change} ) { |
535 |
$after = ref $after eq 'ARRAY' ? [ sort @{$after} ] : ( $after ? [$after] : [] ); |
| 540 |
if ( ref $v eq 'ARRAY' ) { |
|
|
| 541 |
$change->{$k} = [ sort @{$v} ]; |
| 542 |
} else { |
| 543 |
$change->{$k} = $v ? [$v] : []; |
| 544 |
} |
| 545 |
} |
| 546 |
} |
536 |
} |
| 547 |
return to_json( { "attribute.$code" => $change }, { pretty => 1, canonical => 1 } ); |
537 |
return encode_json( { "attribute.$code" => $after } ); |
| 548 |
}; |
538 |
}; |
| 549 |
|
539 |
|
| 550 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
540 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
|
Lines 689-697
subtest 'action log tests' => sub {
Link Here
|
| 689 |
]; |
679 |
]; |
| 690 |
$patron->extended_attributes($attributes); |
680 |
$patron->extended_attributes($attributes); |
| 691 |
|
681 |
|
| 692 |
$info = $get_info->( [], [ 'Foo', 'Bar' ], $attribute_type->code, 1 ); |
682 |
$info = $get_info->( [], [ 'Foo', 'Bar' ], $attribute_type->code, 1 ); |
| 693 |
use Data::Dumper; |
|
|
| 694 |
print Dumper($info); |
| 695 |
$action_logs = Koha::ActionLogs->search( |
683 |
$action_logs = Koha::ActionLogs->search( |
| 696 |
{ |
684 |
{ |
| 697 |
module => "MEMBERS", |
685 |
module => "MEMBERS", |
| 698 |
- |
|
|