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

(-)a/Koha/Item.pm (-2 / +12 lines)
Lines 1842-1852 sub recall { Link Here
1842
        },
1842
        },
1843
        { order_by => { -asc => 'created_date' } }
1843
        { order_by => { -asc => 'created_date' } }
1844
    )->as_list;
1844
    )->as_list;
1845
1846
    my $item_level_recall;
1845
    foreach my $recall (@recalls) {
1847
    foreach my $recall (@recalls) {
1846
        if ( $recall->item_level and $recall->item_id == $self->itemnumber ){
1848
        if ( $recall->item_level ) {
1847
            return $recall;
1849
            $item_level_recall = 1;
1850
            if ( $recall->item_id == $self->itemnumber ){
1851
                return $recall;
1852
            }
1848
        }
1853
        }
1849
    }
1854
    }
1855
    if ( $item_level_recall ) {
1856
        # recall needs to be filled be a specific item only
1857
        # no other item is relevant to return
1858
        return;
1859
    }
1850
    # no item-level recall to return, so return earliest biblio-level
1860
    # no item-level recall to return, so return earliest biblio-level
1851
    # FIXME: eventually this will be based on priority
1861
    # FIXME: eventually this will be based on priority
1852
    return $recalls[0];
1862
    return $recalls[0];
(-)a/t/db_dependent/Koha/Item.t (-2 / +2 lines)
Lines 1915-1921 subtest 'store() tests' => sub { Link Here
1915
1915
1916
subtest 'Recalls tests' => sub {
1916
subtest 'Recalls tests' => sub {
1917
1917
1918
    plan tests => 22;
1918
    plan tests => 23;
1919
1919
1920
    $schema->storage->txn_begin;
1920
    $schema->storage->txn_begin;
1921
1921
Lines 1956-1961 subtest 'Recalls tests' => sub { Link Here
1956
    )->store;
1956
    )->store;
1957
1957
1958
    is( $item1->recall->patron_id, $patron1->borrowernumber, 'Correctly returns most relevant recall' );
1958
    is( $item1->recall->patron_id, $patron1->borrowernumber, 'Correctly returns most relevant recall' );
1959
    is( $item2->recall, undef, 'Other items are not returned for item-level recalls' );
1959
1960
1960
    $recall2->set_cancelled;
1961
    $recall2->set_cancelled;
1961
1962
1962
- 

Return to bug 34722