From 9a58291a70feffeac19c03cf40f4a8373b748fe6 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 22 Apr 2025 22:24:23 +0000 Subject: [PATCH] Bug 23010: Update pref name to PreventWithdrawingItemsStatus --- Koha/Item.pm | 2 +- .../bug_23010_add_PreventWithdrawingItemsStatus.pl | 6 +++--- t/db_dependent/Koha/Item.t | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 833bb2cebe9..9b45ce15b18 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -188,7 +188,7 @@ sub store { } } - my $prevent_withdrawing_of = C4::Context->preference('PreventWithDrawingItemsStatus'); + my $prevent_withdrawing_of = C4::Context->preference('PreventWithdrawingItemsStatus'); my @statuses_to_prevent = defined $prevent_withdrawing_of ? split( ',', $prevent_withdrawing_of ) : (); my $prevent_onloan = grep { $_ eq 'checkedout' } @statuses_to_prevent; my $prevent_intransit = grep { $_ eq 'intransit' } @statuses_to_prevent; diff --git a/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl b/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl index ecfcb789c17..1fa805b3e73 100755 --- a/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl +++ b/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl @@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_success say_info); return { bug_number => "23010", - description => "Add new PreventWithDrawingItemsStatus system preference", + description => "Add new PreventWithdrawingItemsStatus system preference", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; @@ -11,10 +11,10 @@ return { $dbh->do( q{ INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) - VALUES ('PreventWithDrawingItemsStatus',NULL,'','Prevent the withdrawing of items based on statuses','Choice') + VALUES ('PreventWithdrawingItemsStatus',NULL,'','Prevent the withdrawing of items based on statuses','Choice') } ); - say $out "Added new system preference 'PreventWithDrawingItemsStatus'"; + say $out "Added new system preference 'PreventWithdrawingItemsStatus'"; }, }; diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index ed48ce7dded..74924851aa3 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -46,11 +46,11 @@ use t::lib::Dates; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; -subtest 'store PreventWithDrawingItemsStatus' => sub { +subtest 'store PreventWithdrawingItemsStatus' => sub { plan tests => 2; $schema->storage->txn_begin; - t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', 'intransit,checkedout' ); + t::lib::Mocks::mock_preference( 'PreventWithdrawingItemsStatus', 'intransit,checkedout' ); my $library_1 = $builder->build( { source => 'Branch' } ); my $library_2 = $builder->build( { source => 'Branch' } ); @@ -93,7 +93,7 @@ subtest 'store PreventWithDrawingItemsStatus' => sub { 'Koha::Exceptions::Item::Transfer::InTransit', 'Exception thrown when trying to withdraw item in transit'; - t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', '' ); + t::lib::Mocks::mock_preference( 'PreventWithdrawingItemsStatus', '' ); $schema->storage->txn_rollback; }; -- 2.39.5