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 1848-1854 subtest 'store() tests' => sub { Link Here
1848
1848
1849
subtest 'Recalls tests' => sub {
1849
subtest 'Recalls tests' => sub {
1850
1850
1851
    plan tests => 22;
1851
    plan tests => 23;
1852
1852
1853
    $schema->storage->txn_begin;
1853
    $schema->storage->txn_begin;
1854
1854
Lines 1889-1894 subtest 'Recalls tests' => sub { Link Here
1889
    )->store;
1889
    )->store;
1890
1890
1891
    is( $item1->recall->patron_id, $patron1->borrowernumber, 'Correctly returns most relevant recall' );
1891
    is( $item1->recall->patron_id, $patron1->borrowernumber, 'Correctly returns most relevant recall' );
1892
    is( $item2->recall, undef, 'Other items are not returned for item-level recalls' );
1892
1893
1893
    $recall2->set_cancelled;
1894
    $recall2->set_cancelled;
1894
1895
1895
- 

Return to bug 34722