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

(-)a/C4/Circulation.pm (+12 lines)
Lines 1774-1779 sub AddReturn { Link Here
1774
    }
1774
    }
1775
1775
1776
    my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed";
1776
    my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed";
1777
1778
    if ( $item->{'location'} eq 'PROC' ) {
1779
        if ( C4::Context->preference("InProcessingToShelvingCart") ) {
1780
            $item->{'location'} = 'CART';
1781
        }
1782
        else {
1783
            $item->{location} = $item->{permanent_location};
1784
        }
1785
1786
        ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
1787
    }
1788
1777
        # full item data, but no borrowernumber or checkout info (no issue)
1789
        # full item data, but no borrowernumber or checkout info (no issue)
1778
        # we know GetItem should work because GetItemnumberFromBarcode worked
1790
        # we know GetItem should work because GetItemnumberFromBarcode worked
1779
    my $hbr      = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch";
1791
    my $hbr      = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch";
(-)a/circ/returns.pl (-8 lines)
Lines 237-250 if ($barcode) { Link Here
237
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
237
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
238
    $itemnumber = GetItemnumberFromBarcode($barcode);
238
    $itemnumber = GetItemnumberFromBarcode($barcode);
239
239
240
    if ( C4::Context->preference("InProcessingToShelvingCart") ) {
241
        my $item = GetItem( $itemnumber );
242
        if ( $item->{'location'} eq 'PROC' ) {
243
            $item->{'location'} = 'CART';
244
            ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
245
        }
246
    }
247
248
#
240
#
249
# save the return
241
# save the return
250
#
242
#
(-)a/t/db_dependent/Circulation/Returns.t (-1 / +50 lines)
Line 0 Link Here
0
- 
1
use Modern::Perl;
2
use Test::More tests => 2;
3
4
use C4::Biblio;
5
use C4::Circulation;
6
use C4::Items;
7
use C4::Members;
8
use Koha::DateUtils;
9
10
use MARC::Record;
11
12
*C4::Context::userenv = \&Mock_userenv;
13
14
my $dbh = C4::Context->dbh;
15
$dbh->{AutoCommit} = 0;
16
$dbh->{RaiseError} = 1;
17
18
my $record = MARC::Record->new();
19
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' );
20
21
my ( undef, undef, $itemnumber ) = AddItem(
22
    {
23
        homebranch         => 'CPL',
24
        holdingbranch      => 'CPL',
25
        barcode            => 'i_dont_exist',
26
        location           => 'PROC',
27
        permanent_location => 'TEST'
28
    },
29
    $biblionumber
30
);
31
32
my $item;
33
34
C4::Context->set_preference( "InProcessingToShelvingCart", 1 );
35
AddReturn( 'i_dont_exist', 'CPL' );
36
$item = GetItem($itemnumber);
37
is( $item->{location}, 'CART', "InProcessingToShelvingCart functions as intended" );
38
39
$item->{location} = 'PROC';
40
ModItem( $item, undef, $itemnumber );
41
42
C4::Context->set_preference( "InProcessingToShelvingCart", 0 );
43
AddReturn( 'i_dont_exist', 'CPL' );
44
$item = GetItem($itemnumber);
45
is( $item->{location}, 'TEST', "InProcessingToShelvingCart functions as intended" );
46
47
# C4::Context->userenv
48
sub Mock_userenv {
49
    return { branch => 'CPL' };
50
}

Return to bug 13297