View | Details | Raw Unified | Return to bug 23010
Collapse All | Expand All

(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 188-194 sub store { Link Here
188
            }
188
            }
189
        }
189
        }
190
190
191
        my $prevent_withdrawing_of = C4::Context->preference('PreventWithDrawingItemsStatus');
191
        my $prevent_withdrawing_of = C4::Context->preference('PreventWithdrawingItemsStatus');
192
        my @statuses_to_prevent    = defined $prevent_withdrawing_of ? split( ',', $prevent_withdrawing_of ) : ();
192
        my @statuses_to_prevent    = defined $prevent_withdrawing_of ? split( ',', $prevent_withdrawing_of ) : ();
193
        my $prevent_onloan         = grep { $_ eq 'checkedout' } @statuses_to_prevent;
193
        my $prevent_onloan         = grep { $_ eq 'checkedout' } @statuses_to_prevent;
194
        my $prevent_intransit      = grep { $_ eq 'intransit' } @statuses_to_prevent;
194
        my $prevent_intransit      = grep { $_ eq 'intransit' } @statuses_to_prevent;
(-)a/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl (-3 / +3 lines)
Lines 3-9 use Koha::Installer::Output qw(say_warning say_success say_info); Link Here
3
3
4
return {
4
return {
5
    bug_number  => "23010",
5
    bug_number  => "23010",
6
    description => "Add new PreventWithDrawingItemsStatus system preference",
6
    description => "Add new PreventWithdrawingItemsStatus system preference",
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
Lines 11-20 return { Link Here
11
        $dbh->do(
11
        $dbh->do(
12
            q{
12
            q{
13
            INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
13
            INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
14
            VALUES ('PreventWithDrawingItemsStatus',NULL,'','Prevent the withdrawing of items based on statuses','Choice')
14
            VALUES ('PreventWithdrawingItemsStatus',NULL,'','Prevent the withdrawing of items based on statuses','Choice')
15
        }
15
        }
16
        );
16
        );
17
17
18
        say $out "Added new system preference 'PreventWithDrawingItemsStatus'";
18
        say $out "Added new system preference 'PreventWithdrawingItemsStatus'";
19
    },
19
    },
20
};
20
};
(-)a/t/db_dependent/Koha/Item.t (-4 / +3 lines)
Lines 46-56 use t::lib::Dates; Link Here
46
my $schema  = Koha::Database->new->schema;
46
my $schema  = Koha::Database->new->schema;
47
my $builder = t::lib::TestBuilder->new;
47
my $builder = t::lib::TestBuilder->new;
48
48
49
subtest 'store PreventWithDrawingItemsStatus' => sub {
49
subtest 'store PreventWithdrawingItemsStatus' => sub {
50
    plan tests => 2;
50
    plan tests => 2;
51
    $schema->storage->txn_begin;
51
    $schema->storage->txn_begin;
52
52
53
    t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', 'intransit,checkedout' );
53
    t::lib::Mocks::mock_preference( 'PreventWithdrawingItemsStatus', 'intransit,checkedout' );
54
    my $library_1 = $builder->build( { source => 'Branch' } );
54
    my $library_1 = $builder->build( { source => 'Branch' } );
55
    my $library_2 = $builder->build( { source => 'Branch' } );
55
    my $library_2 = $builder->build( { source => 'Branch' } );
56
56
Lines 93-99 subtest 'store PreventWithDrawingItemsStatus' => sub { Link Here
93
    'Koha::Exceptions::Item::Transfer::InTransit',
93
    'Koha::Exceptions::Item::Transfer::InTransit',
94
        'Exception thrown when trying to withdraw item in transit';
94
        'Exception thrown when trying to withdraw item in transit';
95
95
96
    t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', '' );
96
    t::lib::Mocks::mock_preference( 'PreventWithdrawingItemsStatus', '' );
97
97
98
    $schema->storage->txn_rollback;
98
    $schema->storage->txn_rollback;
99
};
99
};
100
- 

Return to bug 23010