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

(-)a/C4/Circulation.pm (-3 lines)
Lines 1806-1814 sub AddReturn { Link Here
1806
    unless ($item) {
1806
    unless ($item) {
1807
        return ( 0, { BadBarcode => $barcode } );    # no barcode means no item or borrower.  bail out.
1807
        return ( 0, { BadBarcode => $barcode } );    # no barcode means no item or borrower.  bail out.
1808
    }
1808
    }
1809
    if ($item->{deleted_on}) {
1810
        return ( 0, { BadBarcode => $barcode } );
1811
    }
1812
1809
1813
    my $itemnumber = $item->{ itemnumber };
1810
    my $itemnumber = $item->{ itemnumber };
1814
    my $itemtype = $item->{itype}; # GetItem called effective_itemtype
1811
    my $itemtype = $item->{itype}; # GetItem called effective_itemtype
(-)a/C4/Items.pm (+3 lines)
Lines 146-151 Return item information, for a given itemnumber or barcode. Link Here
146
The return value is a hashref mapping item column
146
The return value is a hashref mapping item column
147
names to values.  If C<$serial> is true, include serial publication data.
147
names to values.  If C<$serial> is true, include serial publication data.
148
148
149
This accessor will not return deleted items.
150
149
=cut
151
=cut
150
152
151
sub GetItem {
153
sub GetItem {
Lines 160-165 sub GetItem { Link Here
160
    }
162
    }
161
163
162
    return unless ( $item );
164
    return unless ( $item );
165
    return if ( $item->deleted_on );
163
166
164
    my $data = $item->unblessed();
167
    my $data = $item->unblessed();
165
    $data->{itype} = $item->effective_itemtype(); # set the correct itype
168
    $data->{itype} = $item->effective_itemtype(); # set the correct itype
(-)a/t/db_dependent/Items.t (-3 / +4 lines)
Lines 45-51 my $location = 'My Location'; Link Here
45
45
46
subtest 'General Add, Get and Del tests' => sub {
46
subtest 'General Add, Get and Del tests' => sub {
47
47
48
    plan tests => 16;
48
    plan tests => 17;
49
49
50
    $schema->storage->txn_begin;
50
    $schema->storage->txn_begin;
51
51
Lines 80-87 subtest 'General Add, Get and Del tests' => sub { Link Here
80
80
81
    # Delete item.
81
    # Delete item.
82
    DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber });
82
    DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber });
83
    my $deletedItem = Koha::Items->find({ itemnumber => $itemnumber });
84
    isnt($deletedItem->deleted_on, undef, "Item marked deleted as expected.");
83
    my $getdeleted = GetItem($itemnumber);
85
    my $getdeleted = GetItem($itemnumber);
84
    isnt($getdeleted->{'deleted_on'}, undef, "Item deleted as expected.");
86
    is($getdeleted->{'itemnumber'}, undef, "Item not returned by GetItem as expected.");
85
87
86
    ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location', itype => $itemtype->{itemtype} } , $bibnum);
88
    ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location', itype => $itemtype->{itemtype} } , $bibnum);
87
    $getitem = GetItem($itemnumber);
89
    $getitem = GetItem($itemnumber);
88
- 

Return to bug 20271