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

(-)a/C4/Circulation.pm (+4 lines)
Lines 2171-2176 sub AddReturn { Link Here
2171
            if ( $transfer->tobranch eq $branch ) {
2171
            if ( $transfer->tobranch eq $branch ) {
2172
                $transfer->receive;
2172
                $transfer->receive;
2173
                $messages->{'TransferArrived'} = $transfer->frombranch;
2173
                $messages->{'TransferArrived'} = $transfer->frombranch;
2174
                # validTransfer=1 allows us returning the item back if the reserve is cancelled
2175
                $validTransfer = 1 if $transfer->reason eq 'Reserve';
2174
            }
2176
            }
2175
            else {
2177
            else {
2176
                $messages->{'WrongTransfer'}     = $transfer->tobranch;
2178
                $messages->{'WrongTransfer'}     = $transfer->tobranch;
Lines 2181-2186 sub AddReturn { Link Here
2181
            if ( $transfer->tobranch eq $branch ) {
2183
            if ( $transfer->tobranch eq $branch ) {
2182
                $transfer->receive;
2184
                $transfer->receive;
2183
                $messages->{'TransferArrived'} = $transfer->frombranch;
2185
                $messages->{'TransferArrived'} = $transfer->frombranch;
2186
                # validTransfer=1 allows us returning the item back if the reserve is cancelled
2187
                $validTransfer = 1 if $transfer->reason eq 'Reserve';
2184
            }
2188
            }
2185
            else {
2189
            else {
2186
                $messages->{'WasTransfered'}   = $transfer->tobranch;
2190
                $messages->{'WasTransfered'}   = $transfer->tobranch;
(-)a/t/db_dependent/Circulation/Branch.t (-3 / +8 lines)
Lines 25-31 use Koha::CirculationRules; Link Here
25
25
26
use Koha::Patrons;
26
use Koha::Patrons;
27
27
28
use Test::More tests => 15;
28
use Test::More tests => 16;
29
use t::lib::Mocks;
29
use t::lib::Mocks;
30
use t::lib::TestBuilder;
30
use t::lib::TestBuilder;
31
31
Lines 307-313 is( $messages->{NeedsTransfer}, $samplebranch1->{branchcode}, "AddReturn respect Link Here
307
ModItemTransfer($item_id2, $samplebranch2->{branchcode}, $samplebranch1->{branchcode}, "ReturnToHolding");
307
ModItemTransfer($item_id2, $samplebranch2->{branchcode}, $samplebranch1->{branchcode}, "ReturnToHolding");
308
# Fulfill it
308
# Fulfill it
309
($doreturn, $messages, $iteminformation, $borrower) = AddReturn('barcode_2',$samplebranch1->{branchcode});
309
($doreturn, $messages, $iteminformation, $borrower) = AddReturn('barcode_2',$samplebranch1->{branchcode});
310
is( $messages->{NeedsTransfer}, undef, "AddReturn does not generate a new transfer for return policy when resolving an existing transfer" );
310
is( $messages->{NeedsTransfer}, undef, "AddReturn does not generate a new transfer for return policy when resolving an existing non-Reserve transfer" );
311
312
# Generate a hold caused transfer which doesn't have a hold i.e. is the hold is cancelled
313
ModItemTransfer($item_id2, $samplebranch2->{branchcode}, $samplebranch1->{branchcode}, "Reserve");
314
# Fulfill it
315
($doreturn, $messages, $iteminformation, $borrower) = AddReturn('barcode_2',$samplebranch1->{branchcode});
316
is( $messages->{NeedsTransfer}, $samplebranch2->{branchcode}, "AddReturn generates a new transfer for hold transfer if the hold was cancelled" );
311
317
312
# item3 should not trigger transfer - floating collection
318
# item3 should not trigger transfer - floating collection
313
$query =
319
$query =
314
- 

Return to bug 28520