Lines 36-42
use JSON qw( to_json );
Link Here
|
36 |
|
36 |
|
37 |
use C4::Context; |
37 |
use C4::Context; |
38 |
use C4::Auth qw( check_cookie_auth ); |
38 |
use C4::Auth qw( check_cookie_auth ); |
39 |
use C4::ImportBatch qw( GetImportBatch GetImportRecordsRange GetImportRecordMatches ); |
39 |
use C4::ImportBatch qw( GetImportBatch GetImportRecordsRange ); |
|
|
40 |
use Koha::Import::Records; |
41 |
use Koha::Biblios; |
42 |
use Koha::MetadataRecord::Authority; |
40 |
|
43 |
|
41 |
my $input = CGI->new; |
44 |
my $input = CGI->new; |
42 |
|
45 |
|
Lines 66-95
my $records =
Link Here
|
66 |
GetImportRecordsRange( $import_batch_id, $offset, $results_per_page, undef, |
69 |
GetImportRecordsRange( $import_batch_id, $offset, $results_per_page, undef, |
67 |
{ order_by => $sorting_column, order_by_direction => $sorting_direction } ); |
70 |
{ order_by => $sorting_column, order_by_direction => $sorting_direction } ); |
68 |
my @list = (); |
71 |
my @list = (); |
|
|
72 |
|
69 |
foreach my $record (@$records) { |
73 |
foreach my $record (@$records) { |
70 |
my $citation = $record->{'title'} || $record->{'authorized_heading'}; |
74 |
my $citation = $record->{'title'} || $record->{'authorized_heading'}; |
71 |
|
75 |
my $import_record_obj = Koha::Import::Records->find($record->{'import_record_id'}); |
72 |
my $matches = GetImportRecordMatches( $record->{'import_record_id'} ); |
76 |
my $matches = $import_record_obj->get_import_record_matches(); |
73 |
my $match_id; |
77 |
my $match_id; |
74 |
if ( scalar @$matches > 0 ) { |
78 |
my @matches_arr = (); |
75 |
foreach my $match (@$matches){ |
79 |
if ( $matches->count > 0 ) { |
|
|
80 |
while ( my $match = $matches->next ){ |
76 |
my $match_citation = ''; |
81 |
my $match_citation = ''; |
77 |
if ( $match->{'record_type'} eq 'biblio' ) { |
82 |
if ( $import_record_obj->record_type eq 'biblio' ) { |
78 |
$match_citation .= $match->{'title'} |
83 |
my $biblio = Koha::Biblios->find($match->candidate_match_id); |
79 |
if defined( $match->{'title'} ); |
84 |
$match = $match->unblessed; |
80 |
$match_citation .= ' ' . $match->{'author'} |
85 |
$match->{'record_type'} = 'biblio'; |
81 |
if defined( $match->{'author'} ); |
86 |
$match->{'title'} = $biblio->title |
82 |
$match->{'match_citation'} = $match_citation; |
87 |
if defined( $biblio->title ); |
|
|
88 |
$match->{'author'} = $biblio->author |
89 |
if defined( $biblio->author ); |
83 |
} |
90 |
} |
84 |
elsif ( $match->{'record_type'} eq 'auth' ) { |
91 |
elsif ( $import_record_obj->record_type eq 'auth' ) { |
85 |
if ( defined( $match->{'authorized_heading'} ) ) { |
92 |
my $auth = Koha::MetadataRecord::Authority->get_from_authid($match->candidate_match_id); |
86 |
$match_citation .= $match->{'authorized_heading'}; |
93 |
$match = $match->unblessed; |
87 |
$match->{'match_citation'} = $match_citation; |
94 |
$match->{'record_type'} = 'auth'; |
|
|
95 |
if ( defined( $auth->authorized_heading ) ) { |
96 |
$match->{'authorized_heading'} = $auth->authorized_heading; |
88 |
} |
97 |
} |
89 |
} |
98 |
} |
|
|
99 |
push @matches_arr, $match; |
100 |
|
90 |
} |
101 |
} |
91 |
} |
102 |
} |
92 |
|
|
|
93 |
push @list, |
103 |
push @list, |
94 |
{ |
104 |
{ |
95 |
DT_RowId => $record->{'import_record_id'}, |
105 |
DT_RowId => $record->{'import_record_id'}, |
Lines 103-110
foreach my $record (@$records) {
Link Here
|
103 |
matched => $record->{'matched_biblionumber'} |
113 |
matched => $record->{'matched_biblionumber'} |
104 |
|| $record->{'matched_authid'} |
114 |
|| $record->{'matched_authid'} |
105 |
|| q{}, |
115 |
|| q{}, |
106 |
score => scalar @$matches > 0 ? $matches->[0]->{'score'} : 0, |
116 |
matches => \@matches_arr, |
107 |
matches => $matches, |
|
|
108 |
diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id&type=$record->{record_type}" : undef |
117 |
diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id&type=$record->{record_type}" : undef |
109 |
}; |
118 |
}; |
110 |
} |
119 |
} |
111 |
- |
|
|