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

(-)a/Koha/Patron.pm (-1 / +1 lines)
Lines 828-834 Return 1 if Koha needs to perform PrevIssue checking, else 0. Link Here
828
=cut
828
=cut
829
829
830
sub wants_check_for_previous_checkout {
830
sub wants_check_for_previous_checkout {
831
    my ($self, $item) = @_;
831
    my ( $self, $item ) = @_;
832
    my $syspref = C4::Context->preference("checkPrevCheckout");
832
    my $syspref = C4::Context->preference("checkPrevCheckout");
833
833
834
    # Simple cases
834
    # Simple cases
(-)a/admin/itemtypes.pl (-1 lines)
Lines 99-105 if ( $op eq 'add_form' ) { Link Here
99
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
99
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
100
    my $automatic_checkin            = $input->param('automatic_checkin')            // 0;
100
    my $automatic_checkin            = $input->param('automatic_checkin')            // 0;
101
    my $bookable                     = $input->param('bookable')                     // 0;
101
    my $bookable                     = $input->param('bookable')                     // 0;
102
    my $automatic_checkin = $input->param('automatic_checkin') // 0;
103
    my $checkprevcheckout            = $input->param('checkprevcheckout');
102
    my $checkprevcheckout            = $input->param('checkprevcheckout');
104
103
105
    if ( $itemtype and $is_a_modif ) {    # it's a modification
104
    if ( $itemtype and $is_a_modif ) {    # it's a modification
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-9 / +9 lines)
Lines 362-378 Link Here
362
                            <label for="checkprevcheckout">Check for previous checkouts: </label>
362
                            <label for="checkprevcheckout">Check for previous checkouts: </label>
363
                            <select name="checkprevcheckout" id="checkprevcheckout">
363
                            <select name="checkprevcheckout" id="checkprevcheckout">
364
                                [% IF itemtype.checkprevcheckout == 'yes' %]
364
                                [% IF itemtype.checkprevcheckout == 'yes' %]
365
                                <option value="yes" selected="selected">Yes and override system preferences</option>
365
                                    <option value="yes" selected="selected">Yes and override system preferences</option>
366
                                <option value="no">No and override system preferences</option>
366
                                    <option value="no">No and override system preferences</option>
367
                                <option value="inherit">Inherit from system preferences</option>
367
                                    <option value="inherit">Inherit from system preferences</option>
368
                                [% ELSIF itemtype.checkprevcheckout == 'no' %]
368
                                [% ELSIF itemtype.checkprevcheckout == 'no' %]
369
                                <option value="yes">Yes and override system preferences</option>
369
                                    <option value="yes">Yes and override system preferences</option>
370
                                <option value="no" selected="selected">No and override system preferences</option>
370
                                    <option value="no" selected="selected">No and override system preferences</option>
371
                                <option value="inherit">Inherit from system preferences</option>
371
                                    <option value="inherit">Inherit from system preferences</option>
372
                                [% ELSE %]
372
                                [% ELSE %]
373
                                <option value="yes">Yes and override system preferences</option>
373
                                    <option value="yes">Yes and override system preferences</option>
374
                                <option value="no">No and override system preferences</option>
374
                                    <option value="no">No and override system preferences</option>
375
                                <option value="inherit" selected="selected">Inherit from system preferences</option>
375
                                    <option value="inherit" selected="selected">Inherit from system preferences</option>
376
                                [% END %]
376
                                [% END %]
377
                            </select>
377
                            </select>
378
                        </li>
378
                        </li>
(-)a/t/db_dependent/Patron/Borrower_PrevCheckout.t (-34 / +38 lines)
Lines 49-74 my $inheritCatCode = $builder->build( Link Here
49
    }
49
    }
50
);
50
);
51
51
52
my $yesItypeCode = $builder->build_object({
52
my $yesItypeCode = $builder->build_object(
53
    class => 'Koha::ItemTypes',
53
    {
54
    value => {
54
        class => 'Koha::ItemTypes',
55
        checkprevcheckout => 'yes',
55
        value => {
56
            checkprevcheckout => 'yes',
57
        }
56
    }
58
    }
57
});
59
);
58
60
59
my $noItypeCode = $builder->build_object({
61
my $noItypeCode = $builder->build_object(
60
    class => 'Koha::ItemTypes',
62
    {
61
    value  => {
63
        class => 'Koha::ItemTypes',
62
        checkprevcheckout => 'no',
64
        value => {
65
            checkprevcheckout => 'no',
66
        }
63
    }
67
    }
64
});
68
);
65
69
66
my $inheritItypeCode = $builder->build_object({
70
my $inheritItypeCode = $builder->build_object(
67
    class => 'Koha::ItemTypes',
71
    {
68
    value  => {
72
        class => 'Koha::ItemTypes',
69
        checkprevcheckout => 'inherit',
73
        value => {
74
            checkprevcheckout => 'inherit',
75
        }
70
    }
76
    }
71
});
77
);
72
78
73
# Create context for some tests late on in the file.
79
# Create context for some tests late on in the file.
74
my $library = $builder->build( { source => 'Branch' } );
80
my $library = $builder->build( { source => 'Branch' } );
Lines 235-241 map { Link Here
235
    } @{ $_->{categories} };
241
    } @{ $_->{categories} };
236
} @{$mappings};
242
} @{$mappings};
237
243
238
239
# wants_check_for_previous_checkout
244
# wants_check_for_previous_checkout
240
245
241
# We want to test the subroutine by passing the $item parameter
246
# We want to test the subroutine by passing the $item parameter
Lines 288-316 map { Link Here
288
# | Expected Result   | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
293
# | Expected Result   | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
289
294
290
my $itypeCode = {
295
my $itypeCode = {
291
    'yes' => $yesItypeCode->itemtype,
296
    'yes'     => $yesItypeCode->itemtype,
292
    'no' => $noItypeCode->itemtype,
297
    'no'      => $noItypeCode->itemtype,
293
    'inherit' => $inheritItypeCode->itemtype,
298
    'inherit' => $inheritItypeCode->itemtype,
294
};
299
};
295
300
296
foreach my $syspref ('hardyes','softyes','softno','hardno'){
301
foreach my $syspref ( 'hardyes', 'softyes', 'softno', 'hardno' ) {
297
    t::lib::Mocks::mock_preference( 'checkprevcheckout', $syspref );
302
    t::lib::Mocks::mock_preference( 'checkprevcheckout', $syspref );
298
    foreach my $itemtype_setting ('yes','no','inherit'){ #itemtype Setting
303
    foreach my $itemtype_setting ( 'yes', 'no', 'inherit' ) {    #itemtype Setting
299
        my $item      = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } );
304
        my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } );
300
        foreach my $categorie_settings('yes','no','inherit'){
305
        foreach my $categorie_settings ( 'yes', 'no', 'inherit' ) {
301
            my $catCode = $categorie_settings . 'Cat';
306
            my $catCode = $categorie_settings . 'Cat';
302
            foreach my $patron_setting('yes','no','inherit'){
307
            foreach my $patron_setting ( 'yes', 'no', 'inherit' ) {
303
                my $result = undef;
308
                my $result = undef;
304
                $result = 1 if($syspref eq 'hardyes');
309
                $result = 1 if ( $syspref eq 'hardyes' );
305
                $result = 0 if($syspref eq 'hardno');
310
                $result = 0 if ( $syspref eq 'hardno' );
306
                $result = 1 if(!defined $result && $itemtype_setting eq 'yes');
311
                $result = 1 if ( !defined $result && $itemtype_setting eq 'yes' );
307
                $result = 0 if(!defined $result && $itemtype_setting eq 'no');
312
                $result = 0 if ( !defined $result && $itemtype_setting eq 'no' );
308
                $result = 1 if(!defined $result && $patron_setting eq 'yes');
313
                $result = 1 if ( !defined $result && $patron_setting eq 'yes' );
309
                $result = 0 if(!defined $result && $patron_setting eq 'no');
314
                $result = 0 if ( !defined $result && $patron_setting eq 'no' );
310
                $result = 1 if(!defined $result && $categorie_settings eq 'yes');
315
                $result = 1 if ( !defined $result && $categorie_settings eq 'yes' );
311
                $result = 0 if(!defined $result && $categorie_settings eq 'no');
316
                $result = 0 if ( !defined $result && $categorie_settings eq 'no' );
312
                $result = 1 if(!defined $result && $syspref eq 'softyes');
317
                $result = 1 if ( !defined $result && $syspref eq 'softyes' );
313
                $result = 0 if(!defined $result && $syspref eq 'softno');
318
                $result = 0 if ( !defined $result && $syspref eq 'softno' );
314
                my $kpatron = $builder->build(
319
                my $kpatron = $builder->build(
315
                    {
320
                    {
316
                        source => 'Borrower',
321
                        source => 'Borrower',
317
- 

Return to bug 20644