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

(-)a/C4/ImportBatch.pm (-38 lines)
Lines 1478-1520 sub SetImportRecordStatus { Link Here
1478
1478
1479
}
1479
}
1480
1480
1481
=head2 GetImportRecordMatches
1482
1483
  my $results = GetImportRecordMatches($import_record_id, $best_only);
1484
1485
=cut
1486
1487
sub GetImportRecordMatches {
1488
    my $import_record_id = shift;
1489
    my $best_only = @_ ? shift : 0;
1490
1491
    my $dbh = C4::Context->dbh;
1492
    # FIXME currently biblio only
1493
    my $sth = $dbh->prepare_cached("SELECT title, author, biblionumber,
1494
                                    candidate_match_id, score, record_type,
1495
                                    chosen
1496
                                    FROM import_records
1497
                                    JOIN import_record_matches USING (import_record_id)
1498
                                    LEFT JOIN biblio ON (biblionumber = candidate_match_id)
1499
                                    WHERE import_record_id = ?
1500
                                    ORDER BY score DESC, biblionumber DESC");
1501
    $sth->bind_param(1, $import_record_id);
1502
    my $results = [];
1503
    $sth->execute();
1504
    while (my $row = $sth->fetchrow_hashref) {
1505
        if ($row->{'record_type'} eq 'auth') {
1506
            $row->{'authorized_heading'} = GetAuthorizedHeading( { authid => $row->{'candidate_match_id'} } );
1507
        }
1508
        next if ($row->{'record_type'} eq 'biblio' && not $row->{'biblionumber'});
1509
        push @$results, $row;
1510
        last if $best_only;
1511
    }
1512
    $sth->finish();
1513
1514
    return $results;
1515
    
1516
}
1517
1518
=head2 SetImportRecordMatches
1481
=head2 SetImportRecordMatches
1519
1482
1520
  SetImportRecordMatches($import_record_id, @matches);
1483
  SetImportRecordMatches($import_record_id, @matches);
1521
- 

Return to bug 32055