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

(-)a/C4/ImportBatch.pm (-38 lines)
Lines 1460-1502 sub SetImportRecordStatus { Link Here
1460
1460
1461
}
1461
}
1462
1462
1463
=head2 GetImportRecordMatches
1464
1465
  my $results = GetImportRecordMatches($import_record_id, $best_only);
1466
1467
=cut
1468
1469
sub GetImportRecordMatches {
1470
    my $import_record_id = shift;
1471
    my $best_only = @_ ? shift : 0;
1472
1473
    my $dbh = C4::Context->dbh;
1474
    # FIXME currently biblio only
1475
    my $sth = $dbh->prepare_cached("SELECT title, author, biblionumber,
1476
                                    candidate_match_id, score, record_type,
1477
                                    chosen
1478
                                    FROM import_records
1479
                                    JOIN import_record_matches USING (import_record_id)
1480
                                    LEFT JOIN biblio ON (biblionumber = candidate_match_id)
1481
                                    WHERE import_record_id = ?
1482
                                    ORDER BY score DESC, biblionumber DESC");
1483
    $sth->bind_param(1, $import_record_id);
1484
    my $results = [];
1485
    $sth->execute();
1486
    while (my $row = $sth->fetchrow_hashref) {
1487
        if ($row->{'record_type'} eq 'auth') {
1488
            $row->{'authorized_heading'} = GetAuthorizedHeading( { authid => $row->{'candidate_match_id'} } );
1489
        }
1490
        next if ($row->{'record_type'} eq 'biblio' && not $row->{'biblionumber'});
1491
        push @$results, $row;
1492
        last if $best_only;
1493
    }
1494
    $sth->finish();
1495
1496
    return $results;
1497
    
1498
}
1499
1500
=head2 SetImportRecordMatches
1463
=head2 SetImportRecordMatches
1501
1464
1502
  SetImportRecordMatches($import_record_id, @matches);
1465
  SetImportRecordMatches($import_record_id, @matches);
1503
- 

Return to bug 32055