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

(-)a/C4/Circulation.pm (-4 / +4 lines)
Lines 844-853 sub CanBookBeIssued { Link Here
844
    }
844
    }
845
845
846
    # Additional Materials Check
846
    # Additional Materials Check
847
    if ( C4::Context->preference("CircConfirmItemParts") ) {
847
    if ( C4::Context->preference("CircConfirmItemParts")
848
        if ( $item_object->materials ) {
848
        && $item_object->materials )
849
            $needsconfirmation{additional_materials} = $item_object->materials;
849
    {
850
        }
850
        $needsconfirmation{additional_materials} = $item_object->materials;
851
    }
851
    }
852
852
853
    #
853
    #
(-)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 (-32 / +4 lines)
Lines 3986-3993 subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { Link Here
3986
3986
3987
    t::lib::Mocks::mock_preference('CircConfirmItemParts', 1);
3987
    t::lib::Mocks::mock_preference('CircConfirmItemParts', 1);
3988
3988
3989
    my $library =
3990
      $builder->build_object( { class => 'Koha::Libraries' } )->store;
3991
    my $patron = $builder->build_object(
3989
    my $patron = $builder->build_object(
3992
        {
3990
        {
3993
            class => 'Koha::Patrons',
3991
            class => 'Koha::Patrons',
Lines 3995-4034 subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { Link Here
3995
        }
3993
        }
3996
    )->store;
3994
    )->store;
3997
3995
3998
    my $itemtype = $builder->build_object(
3996
    my $item = $builder->build_sample_item(
3999
        {
4000
            class => 'Koha::ItemTypes',
4001
            value => {
4002
                notforloan         => 0,
4003
                rentalcharge       => 0,
4004
                rentalcharge_daily => 0
4005
            }
4006
        }
4007
    );
4008
4009
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
4010
    my $item = $builder->build_object(
4011
        {
3997
        {
4012
            class => 'Koha::Items',
3998
            materials => 'includes DVD',
4013
            value => {
4014
                homebranch       => $library->id,
4015
                holdingbranch    => $library->id,
4016
                notforloan       => 0,
4017
                itemlost         => 0,
4018
                withdrawn        => 0,
4019
                itype            => $itemtype->id,
4020
                biblionumber     => $biblioitem->{biblionumber},
4021
                biblioitemnumber => $biblioitem->{biblioitemnumber},
4022
                materials        => 'includes DVD',
4023
            }
4024
        }
3999
        }
4025
    )->store;
4000
    )->store;
4026
4001
4027
    my ( $issuingimpossible, $needsconfirmation );
4002
    my $dt_due = dt_from_string->add( days => 3 );
4028
    my $dt_from = dt_from_string();
4029
    my $dt_due = $dt_from->clone->add( days => 3 );
4030
4003
4031
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
4004
    my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
4032
    is_deeply( $needsconfirmation, { additional_materials => 'includes DVD' }, 'Item needs confirmation of additional parts' );
4005
    is_deeply( $needsconfirmation, { additional_materials => 'includes DVD' }, 'Item needs confirmation of additional parts' );
4033
};
4006
};
4034
4007
4035
- 

Return to bug 25261