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

(-)a/C4/Circulation.pm (-1 / +4 lines)
Lines 1939-1946 sub AddReturn { Link Here
1939
            }
1939
            }
1940
1940
1941
            eval {
1941
            eval {
1942
                MarkIssueReturned( $borrowernumber, $item->{'itemnumber'},
1942
                my $issue_id = MarkIssueReturned( $borrowernumber, $item->{'itemnumber'},
1943
                    $circControlBranch, $return_date, $borrower->{'privacy'} );
1943
                    $circControlBranch, $return_date, $borrower->{'privacy'} );
1944
                $issue->{issue_id} = $issue_id;
1944
            };
1945
            };
1945
            if ( $@ ) {
1946
            if ( $@ ) {
1946
                $messages->{'Wrongbranch'} = {
1947
                $messages->{'Wrongbranch'} = {
Lines 2205-2210 sub MarkIssueReturned { Link Here
2205
            $item->last_returned_by( $patron );
2206
            $item->last_returned_by( $patron );
2206
        }
2207
        }
2207
    });
2208
    });
2209
2210
    return $issue_id;
2208
}
2211
}
2209
2212
2210
=head2 _debar_user_on_return
2213
=head2 _debar_user_on_return
(-)a/t/db_dependent/Circulation/Returns.t (-3 / +4 lines)
Lines 263-269 subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub { Link Here
263
};
263
};
264
264
265
subtest 'Handle ids duplication' => sub {
265
subtest 'Handle ids duplication' => sub {
266
    plan tests => 1;
266
    plan tests => 2;
267
267
268
    my $biblio = $builder->build( { source => 'Biblio' } );
268
    my $biblio = $builder->build( { source => 'Biblio' } );
269
    my $item = $builder->build(
269
    my $item = $builder->build(
Lines 283-290 subtest 'Handle ids duplication' => sub { Link Here
283
    my $checkout = AddIssue( $patron, $item->{barcode} );
283
    my $checkout = AddIssue( $patron, $item->{barcode} );
284
    $builder->build({ source => 'OldIssue', value => { issue_id => $checkout->issue_id } });
284
    $builder->build({ source => 'OldIssue', value => { issue_id => $checkout->issue_id } });
285
285
286
    my @a = AddReturn( $item->{barcode} );
286
    my ($doreturn, $messages, $issue, $borrower) = AddReturn( $item->{barcode} );
287
    my $old_checkout = Koha::Old::Checkouts->find( $checkout->issue_id );
287
    my $old_checkout = Koha::Old::Checkouts->find( $checkout->issue_id );
288
289
    isnt( $checkout->issue_id, $issue->{issue_id}, 'AddReturn should return the issue with the new issue_id' );
288
    isnt( $old_checkout->itemnumber, $item->{itemnumber}, 'If an item is checked-in, it should be moved to old_issues even if the issue_id already existed in the table' );
290
    isnt( $old_checkout->itemnumber, $item->{itemnumber}, 'If an item is checked-in, it should be moved to old_issues even if the issue_id already existed in the table' );
289
};
291
};
290
292
291
- 

Return to bug 18651