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

(-)a/C4/SIP/ILS/Transaction/Checkin.pm (-3 / +7 lines)
Lines 76-82 sub do_checkin { Link Here
76
    }
76
    }
77
77
78
    my ( $return, $messages, $issue, $borrower );
78
    my ( $return, $messages, $issue, $borrower );
79
79
    my $item = Koha::Items->find( { barcode => $barcode } );
80
    my $item = Koha::Items->find( { barcode => $barcode } );
81
80
    my $human_required = 0;
82
    my $human_required = 0;
81
    if (   C4::Context->preference("CircConfirmItemParts")
83
    if (   C4::Context->preference("CircConfirmItemParts")
82
        && defined($item)
84
        && defined($item)
Lines 86-95 sub do_checkin { Link Here
86
        $messages->{additional_materials} = 1;
88
        $messages->{additional_materials} = 1;
87
    }
89
    }
88
90
91
    my $checkin_blocked_by_holds = $holds_block_checkin && $item->biblio->holds->count;
92
89
    $debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
93
    $debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
90
    ( $return, $messages, $issue, $borrower ) =
94
    ( $return, $messages, $issue, $borrower ) =
91
      AddReturn( $barcode, $branch, undef, $return_date )
95
      AddReturn( $barcode, $branch, undef, $return_date )
92
      unless $human_required;
96
      unless $human_required || $checkin_blocked_by_holds;
93
97
94
    if ( $checked_in_ok ) {
98
    if ( $checked_in_ok ) {
95
        delete $messages->{ItemLocationUpdated};
99
        delete $messages->{ItemLocationUpdated};
Lines 132-139 sub do_checkin { Link Here
132
        $self->{item}->destination_loc($issue->item->homebranch);
136
        $self->{item}->destination_loc($issue->item->homebranch);
133
        $self->alert_type('04');            # send to other branch
137
        $self->alert_type('04');            # send to other branch
134
    }
138
    }
135
    if ($messages->{ResFound}) {
139
    if ($messages->{ResFound} || $checkin_blocked_by_holds ) {
136
        if ($holds_block_checkin) {
140
        if ($checkin_blocked_by_holds) {
137
            $self->alert_type('99');
141
            $self->alert_type('99');
138
            $return = 0;
142
            $return = 0;
139
        } elsif ($branch eq $messages->{ResFound}->{branchcode}) {
143
        } elsif ($branch eq $messages->{ResFound}->{branchcode}) {
(-)a/t/db_dependent/SIP/Message.t (-2 / +4 lines)
Lines 69-75 subtest 'Testing Patron Info Request V2' => sub { Link Here
69
subtest 'Checkin V2' => sub {
69
subtest 'Checkin V2' => sub {
70
    my $schema = Koha::Database->new->schema;
70
    my $schema = Koha::Database->new->schema;
71
    $schema->storage->txn_begin;
71
    $schema->storage->txn_begin;
72
    plan tests => 33;
72
    plan tests => 35;
73
    $C4::SIP::Sip::protocol_version = 2;
73
    $C4::SIP::Sip::protocol_version = 2;
74
    test_checkin_v2();
74
    test_checkin_v2();
75
    $schema->storage->txn_rollback;
75
    $schema->storage->txn_rollback;
Lines 657-662 sub test_checkin_v2 { Link Here
657
        'Issue record is gone now' );
657
        'Issue record is gone now' );
658
658
659
    # Test account option no_holds_check that prevents items on hold from being checked in via SIP
659
    # Test account option no_holds_check that prevents items on hold from being checked in via SIP
660
    $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object->itemnumber })->store;
661
    is( Koha::Checkouts->search({ itemnumber => $item_object->id })->count, 1, "Item is checked out");
660
    Koha::Old::Checkouts->search({ issue_id => $issue->issue_id })->delete;
662
    Koha::Old::Checkouts->search({ issue_id => $issue->issue_id })->delete;
661
    $server->{account}->{holds_block_checkin} = 1;
663
    $server->{account}->{holds_block_checkin} = 1;
662
    my $reserve_id = AddReserve({
664
    my $reserve_id = AddReserve({
Lines 673-678 sub test_checkin_v2 { Link Here
673
    is( substr($response,2,1), '0', 'OK flag is false when we check in an item on hold and we do not allow it' );
675
    is( substr($response,2,1), '0', 'OK flag is false when we check in an item on hold and we do not allow it' );
674
    is( substr($response,5,1), 'Y', 'Alert flag is set' );
676
    is( substr($response,5,1), 'Y', 'Alert flag is set' );
675
    check_field( $respcode, $response, FID_SCREEN_MSG, 'Item is on hold, please return to circulation desk', 'Screen message is correct' );
677
    check_field( $respcode, $response, FID_SCREEN_MSG, 'Item is on hold, please return to circulation desk', 'Screen message is correct' );
678
    is( Koha::Checkouts->search({ itemnumber => $item_object->id })->count, 1, "Item was not checked in");
676
    $hold->delete();
679
    $hold->delete();
677
    $server->{account}->{holds_block_checkin} = 0;
680
    $server->{account}->{holds_block_checkin} = 0;
678
681
679
- 

Return to bug 26896