From abe31370fc8ba198be9fe0e060816e95285af437 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 30 May 2025 08:27:12 +0200 Subject: [PATCH] Bug 39145: (follow-up) Tidy files Content-Type: text/plain; charset=utf-8 No test plan (just result of perltidy). Signed-off-by: Marcel de Rooy --- Koha/Virtualshelves.pm | 4 ++-- installer/data/mysql/atomicupdate/bug_39145.pl | 6 ++++-- t/db_dependent/Koha/Virtualshelves.t | 11 +++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Koha/Virtualshelves.pm b/Koha/Virtualshelves.pm index e1687b1d73..d32776b5f6 100644 --- a/Koha/Virtualshelves.pm +++ b/Koha/Virtualshelves.pm @@ -48,7 +48,7 @@ sub disown_or_delete { my $list_pref = C4::Context->preference('ListOwnershipUponPatronDeletion'); $self->_resultset->result_source->schema->txn_do( sub { - if ( $list_pref ne 'delete' ) { # transfer or transfer_public + if ( $list_pref ne 'delete' ) { # transfer or transfer_public my $new_owner; $new_owner = C4::Context->preference('ListOwnerDesignated') @@ -64,7 +64,7 @@ sub disown_or_delete { $list->transfer_ownership($new_owner); } elsif ( $new_owner && $list->is_shared && $list_pref eq 'transfer' ) { $list->transfer_ownership($new_owner); - } else { # private list, or shared list with transfer_public + } else { # private list, or shared list with transfer_public $list->delete; } } diff --git a/installer/data/mysql/atomicupdate/bug_39145.pl b/installer/data/mysql/atomicupdate/bug_39145.pl index 943636a1b0..73a19cc102 100755 --- a/installer/data/mysql/atomicupdate/bug_39145.pl +++ b/installer/data/mysql/atomicupdate/bug_39145.pl @@ -8,9 +8,11 @@ return { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - $dbh->do(q{ + $dbh->do( + q{ UPDATE systempreferences SET options='delete|transfer|transfer_public' WHERE variable = 'ListOwnershipUponPatronDeletion' - }); + } + ); say $out "Updated system preference 'ListOwnershipUponPatronDeletion'"; }, }; diff --git a/t/db_dependent/Koha/Virtualshelves.t b/t/db_dependent/Koha/Virtualshelves.t index 6f6caae1bc..1c8ca1275c 100755 --- a/t/db_dependent/Koha/Virtualshelves.t +++ b/t/db_dependent/Koha/Virtualshelves.t @@ -175,9 +175,9 @@ subtest 'disown_or_delete() tests' => sub { subtest 'ListOwnershipUponPatronDeletion set to transfer_public' => sub { plan tests => 2; $schema->storage->txn_begin; - my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); - my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); - my $patron_3 = $builder->build_object( { class => 'Koha::Patrons' } ); + my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); + my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); + my $patron_3 = $builder->build_object( { class => 'Koha::Patrons' } ); my $public_list = $builder->build_object( { class => "Koha::Virtualshelves", @@ -201,13 +201,12 @@ subtest 'disown_or_delete() tests' => sub { t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer_public' ); t::lib::Mocks::mock_preference( 'ListOwnerDesignated', $patron_3->id ); - my $rs = Koha::Virtualshelves->search( - { shelfnumber => [ $public_list->id, $private_list_shared->id ] } ); + my $rs = Koha::Virtualshelves->search( { shelfnumber => [ $public_list->id, $private_list_shared->id ] } ); my $result = $rs->disown_or_delete; $rs->reset; - is( $rs->count, 1, 'Only public list should be transferred' ); + is( $rs->count, 1, 'Only public list should be transferred' ); is( $rs->next->id, $public_list->id, 'Check id too' ); $schema->storage->txn_rollback; -- 2.39.5