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

(-)a/C4/ImportBatch.pm (-41 lines)
Lines 1530-1575 sub SetImportRecordStatus { Link Here
1530
1530
1531
}
1531
}
1532
1532
1533
=head2 GetImportRecordMatches
1534
1535
  my $results = GetImportRecordMatches($import_record_id, $best_only);
1536
1537
=cut
1538
1539
sub GetImportRecordMatches {
1540
    my $import_record_id = shift;
1541
    my $best_only        = @_ ? shift : 0;
1542
1543
    my $dbh = C4::Context->dbh;
1544
1545
    # FIXME currently biblio only
1546
    my $sth = $dbh->prepare_cached(
1547
        "SELECT title, author, biblionumber,
1548
                                    candidate_match_id, score, record_type,
1549
                                    chosen
1550
                                    FROM import_records
1551
                                    JOIN import_record_matches USING (import_record_id)
1552
                                    LEFT JOIN biblio ON (biblionumber = candidate_match_id)
1553
                                    WHERE import_record_id = ?
1554
                                    ORDER BY score DESC, biblionumber DESC"
1555
    );
1556
    $sth->bind_param( 1, $import_record_id );
1557
    my $results = [];
1558
    $sth->execute();
1559
    while ( my $row = $sth->fetchrow_hashref ) {
1560
        if ( $row->{'record_type'} eq 'auth' ) {
1561
            $row->{'authorized_heading'} = GetAuthorizedHeading( { authid => $row->{'candidate_match_id'} } );
1562
        }
1563
        next if ( $row->{'record_type'} eq 'biblio' && not $row->{'biblionumber'} );
1564
        push @$results, $row;
1565
        last if $best_only;
1566
    }
1567
    $sth->finish();
1568
1569
    return $results;
1570
1571
}
1572
1573
=head2 SetImportRecordMatches
1533
=head2 SetImportRecordMatches
1574
1534
1575
  SetImportRecordMatches($import_record_id, @matches);
1535
  SetImportRecordMatches($import_record_id, @matches);
1576
- 

Return to bug 32055