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

(-)a/C4/Circulation.pm (-4 / +4 lines)
Lines 898-907 sub CanBookBeIssued { Link Here
898
    }
898
    }
899
899
900
    # Additional Materials Check
900
    # Additional Materials Check
901
    if ( C4::Context->preference("CircConfirmItemParts") ) {
901
    if ( C4::Context->preference("CircConfirmItemParts")
902
        if ( $item_object->materials ) {
902
        && $item_object->materials )
903
            $needsconfirmation{additional_materials} = $item_object->materials;
903
    {
904
        }
904
        $needsconfirmation{additional_materials} = $item_object->materials;
905
    }
905
    }
906
906
907
    #
907
    #
(-)a/circ/returns.pl (-7 / +5 lines)
Lines 296-312 if ($barcode) { Link Here
296
    my $return_date = $dropboxmode ? $dropboxdate : $return_date_override_dt;
296
    my $return_date = $dropboxmode ? $dropboxdate : $return_date_override_dt;
297
297
298
    # Block return if multi-part and confirm has not been received
298
    # Block return if multi-part and confirm has not been received
299
    my $needs_confirm = 0;
299
    my $needs_confirm =
300
    if ( C4::Context->preference("CircConfirmItemParts") ) {
300
         C4::Context->preference("CircConfirmItemParts")
301
        if ( $item->materials && !$query->param('multiple_confirm') ) {
301
      && $item->materials
302
                $needs_confirm = 1;
302
      && !$query->param('multiple_confirm');
303
        }
304
    }
305
303
306
    # do the return
304
    # do the return
307
    ( $returned, $messages, $issue, $borrower ) =
305
    ( $returned, $messages, $issue, $borrower ) =
308
      AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date )
306
      AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date )
309
      unless $needs_confirm;
307
          unless $needs_confirm;
310
308
311
    if ($returned) {
309
    if ($returned) {
312
        my $time_now = dt_from_string()->truncate( to => 'minute');
310
        my $time_now = dt_from_string()->truncate( to => 'minute');
(-)a/t/db_dependent/Circulation.t (-33 / +5 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 51;
21
use Test::More tests => 49;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 3543-3550 subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { Link Here
3543
3543
3544
    t::lib::Mocks::mock_preference('CircConfirmItemParts', 1);
3544
    t::lib::Mocks::mock_preference('CircConfirmItemParts', 1);
3545
3545
3546
    my $library =
3547
      $builder->build_object( { class => 'Koha::Libraries' } )->store;
3548
    my $patron = $builder->build_object(
3546
    my $patron = $builder->build_object(
3549
        {
3547
        {
3550
            class => 'Koha::Patrons',
3548
            class => 'Koha::Patrons',
Lines 3552-3591 subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { Link Here
3552
        }
3550
        }
3553
    )->store;
3551
    )->store;
3554
3552
3555
    my $itemtype = $builder->build_object(
3553
    my $item = $builder->build_sample_item(
3556
        {
3557
            class => 'Koha::ItemTypes',
3558
            value => {
3559
                notforloan         => 0,
3560
                rentalcharge       => 0,
3561
                rentalcharge_daily => 0
3562
            }
3563
        }
3564
    );
3565
3566
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
3567
    my $item = $builder->build_object(
3568
        {
3554
        {
3569
            class => 'Koha::Items',
3555
            materials => 'includes DVD',
3570
            value => {
3571
                homebranch       => $library->id,
3572
                holdingbranch    => $library->id,
3573
                notforloan       => 0,
3574
                itemlost         => 0,
3575
                withdrawn        => 0,
3576
                itype            => $itemtype->id,
3577
                biblionumber     => $biblioitem->{biblionumber},
3578
                biblioitemnumber => $biblioitem->{biblioitemnumber},
3579
                materials        => 'includes DVD',
3580
            }
3581
        }
3556
        }
3582
    )->store;
3557
    )->store;
3583
3558
3584
    my ( $issuingimpossible, $needsconfirmation );
3559
    my $dt_due = dt_from_string->add( days => 3 );
3585
    my $dt_from = dt_from_string();
3586
    my $dt_due = $dt_from->clone->add( days => 3 );
3587
3560
3588
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
3561
    my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
3589
    is_deeply( $needsconfirmation, { additional_materials => 'includes DVD' }, 'Item needs confirmation of additional parts' );
3562
    is_deeply( $needsconfirmation, { additional_materials => 'includes DVD' }, 'Item needs confirmation of additional parts' );
3590
};
3563
};
3591
3564
3592
- 

Return to bug 25261