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

(-)a/C4/ImportBatch.pm (-33 / +25 lines)
Lines 701-707 sub BatchCommitRecords { Link Here
701
        } elsif ($record_result eq 'ignore') {
701
        } elsif ($record_result eq 'ignore') {
702
            $recordid = $record_match;
702
            $recordid = $record_match;
703
            $num_ignored++;
703
            $num_ignored++;
704
            $recordid = $record_match;
705
            if ($record_type eq 'biblio' and defined $recordid and ( $item_result eq 'create_new' || $item_result eq 'replace' ) ) {
704
            if ($record_type eq 'biblio' and defined $recordid and ( $item_result eq 'create_new' || $item_result eq 'replace' ) ) {
706
                my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result);
705
                my ($bib_items_added, $bib_items_replaced, $bib_items_errored) = BatchCommitItems($rowref->{'import_record_id'}, $recordid, $item_result);
707
                $num_items_added += $bib_items_added;
706
                $num_items_added += $bib_items_added;
Lines 1190-1195 sub GetBestRecordMatch { Link Here
1190
                             WHERE  import_record_matches.import_record_id = ? AND
1189
                             WHERE  import_record_matches.import_record_id = ? AND
1191
                             (  (import_records.record_type = 'biblio' AND biblio.biblionumber IS NOT NULL) OR
1190
                             (  (import_records.record_type = 'biblio' AND biblio.biblionumber IS NOT NULL) OR
1192
                                (import_records.record_type = 'auth' AND auth_header.authid IS NOT NULL) )
1191
                                (import_records.record_type = 'auth' AND auth_header.authid IS NOT NULL) )
1192
                             AND chosen = 1
1193
                             ORDER BY score DESC, candidate_match_id DESC");
1193
                             ORDER BY score DESC, candidate_match_id DESC");
1194
    $sth->execute($import_record_id);
1194
    $sth->execute($import_record_id);
1195
    my ($record_id) = $sth->fetchrow_array();
1195
    my ($record_id) = $sth->fetchrow_array();
Lines 1470-1481 sub GetImportRecordMatches { Link Here
1470
    my $dbh = C4::Context->dbh;
1470
    my $dbh = C4::Context->dbh;
1471
    # FIXME currently biblio only
1471
    # FIXME currently biblio only
1472
    my $sth = $dbh->prepare_cached("SELECT title, author, biblionumber,
1472
    my $sth = $dbh->prepare_cached("SELECT title, author, biblionumber,
1473
                                    candidate_match_id, score, record_type
1473
                                    candidate_match_id, score, record_type,
1474
                                    chosen
1474
                                    FROM import_records
1475
                                    FROM import_records
1475
                                    JOIN import_record_matches USING (import_record_id)
1476
                                    JOIN import_record_matches USING (import_record_id)
1476
                                    LEFT JOIN biblio ON (biblionumber = candidate_match_id)
1477
                                    LEFT JOIN biblio ON (biblionumber = candidate_match_id)
1477
                                    WHERE import_record_id = ?
1478
                                    WHERE import_record_id = ?
1478
                                    ORDER BY score DESC, biblionumber DESC");
1479
                                    ORDER BY score DESC, chosen DESC, biblionumber DESC");
1479
    $sth->bind_param(1, $import_record_id);
1480
    $sth->bind_param(1, $import_record_id);
1480
    my $results = [];
1481
    my $results = [];
1481
    $sth->execute();
1482
    $sth->execute();
Lines 1508-1517 sub SetImportRecordMatches { Link Here
1508
    $delsth->execute($import_record_id);
1509
    $delsth->execute($import_record_id);
1509
    $delsth->finish();
1510
    $delsth->finish();
1510
1511
1511
    my $sth = $dbh->prepare("INSERT INTO import_record_matches (import_record_id, candidate_match_id, score)
1512
    my $sth = $dbh->prepare("INSERT INTO import_record_matches (import_record_id, candidate_match_id, score, chosen)
1512
                                    VALUES (?, ?, ?)");
1513
                                    VALUES (?, ?, ?, ?)");
1514
    my $chosen = 1; #The first match is defaulted to be chosen
1513
    foreach my $match (@matches) {
1515
    foreach my $match (@matches) {
1514
        $sth->execute($import_record_id, $match->{'record_id'}, $match->{'score'});
1516
        $sth->execute($import_record_id, $match->{'record_id'}, $match->{'score'}, $chosen);
1517
        $chosen = 0; #After the first we do not default to other matches
1515
    }
1518
    }
1516
}
1519
}
1517
1520
Lines 1728-1768 sub _get_commit_action { Link Here
1728
    if ($record_type eq 'biblio') {
1731
    if ($record_type eq 'biblio') {
1729
        my ($bib_result, $bib_match, $item_result);
1732
        my ($bib_result, $bib_match, $item_result);
1730
1733
1731
        if ($overlay_status ne 'no_match') {
1734
        $bib_match = GetBestRecordMatch($import_record_id);
1732
            $bib_match = GetBestRecordMatch($import_record_id);
1735
        if ($overlay_status ne 'no_match' && defined($bib_match)) {
1733
            if ($overlay_action eq 'replace') {
1736
1734
                $bib_result  = defined($bib_match) ? 'replace' : 'create_new';
1737
            $bib_result = $overlay_action;
1735
            } elsif ($overlay_action eq 'create_new') {
1738
1736
                $bib_result  = 'create_new';
1739
            if($item_action eq 'always_add' or $item_action eq 'add_only_for_matches'){
1737
            } elsif ($overlay_action eq 'ignore') {
1738
                $bib_result  = 'ignore';
1739
            }
1740
         if($item_action eq 'always_add' or $item_action eq 'add_only_for_matches'){
1741
                $item_result = 'create_new';
1740
                $item_result = 'create_new';
1742
       }
1741
            } elsif($item_action eq 'replace'){
1743
      elsif($item_action eq 'replace'){
1742
                $item_result = 'replace';
1744
          $item_result = 'replace';
1743
            } else {
1745
          }
1744
                $item_result = 'ignore';
1746
      else {
1745
            }
1747
             $item_result = 'ignore';
1746
1748
           }
1749
        } else {
1747
        } else {
1750
            $bib_result = $nomatch_action;
1748
            $bib_result = $nomatch_action;
1751
            $item_result = ($item_action eq 'always_add' or $item_action eq 'add_only_for_new')     ? 'create_new' : 'ignore';
1749
            $item_result = ($item_action eq 'always_add' or $item_action eq 'add_only_for_new') ? 'create_new' : 'ignore';
1752
        }
1750
        }
1753
        return ($bib_result, $item_result, $bib_match);
1751
        return ($bib_result, $item_result, $bib_match);
1754
    } else { # must be auths
1752
    } else { # must be auths
1755
        my ($auth_result, $auth_match);
1753
        my ($auth_result, $auth_match);
1756
1754
1757
        if ($overlay_status ne 'no_match') {
1755
        $auth_match = GetBestRecordMatch($import_record_id);
1758
            $auth_match = GetBestRecordMatch($import_record_id);
1756
        if ($overlay_status ne 'no_match' && defined($auth_match)) {
1759
            if ($overlay_action eq 'replace') {
1757
            $auth_result = $overlay_action;
1760
                $auth_result  = defined($auth_match) ? 'replace' : 'create_new';
1761
            } elsif ($overlay_action eq 'create_new') {
1762
                $auth_result  = 'create_new';
1763
            } elsif ($overlay_action eq 'ignore') {
1764
                $auth_result  = 'ignore';
1765
            }
1766
        } else {
1758
        } else {
1767
            $auth_result = $nomatch_action;
1759
            $auth_result = $nomatch_action;
1768
        }
1760
        }
(-)a/api/v1/swagger/definitions.json (+3 lines)
Lines 47-52 Link Here
47
  "import_batch_profiles": {
47
  "import_batch_profiles": {
48
    "$ref": "definitions/import_batch_profiles.json"
48
    "$ref": "definitions/import_batch_profiles.json"
49
  },
49
  },
50
  "import_record_match": {
51
    "$ref": "definitions/import_record_match.json"
52
  },
50
  "library": {
53
  "library": {
51
    "$ref": "definitions/library.json"
54
    "$ref": "definitions/library.json"
52
  },
55
  },
(-)a/api/v1/swagger/parameters.json (+3 lines)
Lines 23-28 Link Here
23
  "hold_id_pp": {
23
  "hold_id_pp": {
24
    "$ref": "parameters/hold.json#/hold_id_pp"
24
    "$ref": "parameters/hold.json#/hold_id_pp"
25
  },
25
  },
26
  "import_record_id_pp": {
27
    "$ref": "parameters/import_record_match.json#/import_record_id_pp"
28
  },
26
  "club_id_pp": {
29
  "club_id_pp": {
27
    "$ref": "parameters/club.json#/club_id_pp"
30
    "$ref": "parameters/club.json#/club_id_pp"
28
  },
31
  },
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 80-85 Link Here
80
  "/holds/{hold_id}/pickup_location": {
80
  "/holds/{hold_id}/pickup_location": {
81
    "$ref": "paths/holds.json#/~1holds~1{hold_id}~1pickup_location"
81
    "$ref": "paths/holds.json#/~1holds~1{hold_id}~1pickup_location"
82
  },
82
  },
83
  "/import/{import_batch_id}/records/{import_record_id}/matches/chosen": {
84
    "$ref": "paths/import_record_matches.json#/~1import~1{import_batch_id}~1records~1{import_record_id}~1matches~1chosen"
85
  },
83
  "/items": {
86
  "/items": {
84
    "$ref": "paths/items.json#/~1items"
87
    "$ref": "paths/items.json#/~1items"
85
  },
88
  },
(-)a/api/v1/swagger/x-primitives.json (+8 lines)
Lines 3-8 Link Here
3
    "type": "integer",
3
    "type": "integer",
4
    "description": "Internal biblio identifier"
4
    "description": "Internal biblio identifier"
5
  },
5
  },
6
  "import_record_id": {
7
    "type": "integer",
8
    "description": "Internal import record identifier"
9
  },
10
  "candidate_match_id": {
11
    "type": "integer",
12
    "description": "Internal import record match identifier"
13
  },
6
  "advancededitormacro_id": {
14
  "advancededitormacro_id": {
7
    "type": "integer",
15
    "type": "integer",
8
    "description": "Internal advanced editor macro identifier",
16
    "description": "Internal advanced editor macro identifier",
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2901-2906 CREATE TABLE `import_record_matches` ( Link Here
2901
  `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
2901
  `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
2902
  `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
2902
  `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
2903
  `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
2903
  `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
2904
  `chosen` tinyint(1) NULL DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
2904
  PRIMARY KEY (`import_record_id`,`candidate_match_id`),
2905
  PRIMARY KEY (`import_record_id`,`candidate_match_id`),
2905
  KEY `record_score` (`import_record_id`,`score`),
2906
  KEY `record_score` (`import_record_id`,`score`),
2906
  CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
2907
  CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-13 / +56 lines)
Lines 13-18 Link Here
13
<style>
13
<style>
14
    #jobpanel,#jobstatus,#jobfailed { display : none; }
14
    #jobpanel,#jobstatus,#jobfailed { display : none; }
15
    span.change-status { font-style:italic; color:#666; display:none; }
15
    span.change-status { font-style:italic; color:#666; display:none; }
16
    ul.matches li { list-style-type:none; }
16
</style>
17
</style>
17
</head>
18
</head>
18
19
Lines 485-492 Link Here
485
                        { "mDataProp": "citation" },
486
                        { "mDataProp": "citation" },
486
                        { "mDataProp": "status" },
487
                        { "mDataProp": "status" },
487
                        { "mDataProp": "overlay_status" },
488
                        { "mDataProp": "overlay_status" },
488
                        { "mDataProp": "match_citation" },
489
                        { "mDataProp": "" },
489
                        { "mDataProp": "diff_url" },
490
                        { "mDataProp": "" },
490
                        { "mDataProp": "matched" }
491
                        { "mDataProp": "matched" }
491
                    ],
492
                    ],
492
                    "fnServerData": function(sSource, aoData, fnCallback) {
493
                    "fnServerData": function(sSource, aoData, fnCallback) {
Lines 547-563 Link Here
547
                            aData['overlay_status']
548
                            aData['overlay_status']
548
                        );
549
                        );
549
550
550
                        if (aData['match_id']) {
551
                        if ( aData['matches'].length > 0 ) {
551
                            [% IF(record_type == 'auth') -%]
552
552
                                var matching_msg = _("Matches authority %s (score=%s):%s");
553
                            var any_checked = 0;
553
                            [%- ELSE -%]
554
                            $('td:eq(4)', nRow).html('<ul class="matches"></ul>');
554
                                var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
555
                            $('td:eq(5)', nRow).html('<ul class="matches"></ul>');
555
                            [%- END %]
556
                            var checked = "";
556
                            $('td:eq(4)', nRow).html(
557
                            var disabled = "";
557
                                matching_msg.format(aData['match_id'], aData['score'],
558
                            if( aData['status'] == "imported" || aData['status'] == "ignored" ){
558
                                    '<a target="_blank" href="' + record_details_url
559
                                disabled = ' disabled ';
559
                                    + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
560
                            }
560
                            );
561
                            aData['matches'].forEach(function(item,index){
562
                                if( item.chosen == 1 ){
563
                                    checked = 'checked="checked"';
564
                                    any_checked = 1;
565
                                }
566
                                [% IF(item.record_type == 'auth') -%]
567
                                    var matching_msg = _("Matches authority %s (score=%s):%s");
568
                                [%- ELSE -%]
569
                                    var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
570
                                [%- END %]
571
                                    var match_option = "";
572
                                    match_option = '<input type="radio" data-import_record_id="'+aData['import_record_id']+'" class="chosen" name="import_record_id_'+aData['import_record_id']+'_match" value="'+item.candidate_match_id+'" ' + checked + disabled + '> ';
573
574
                                    var diff_url = '/cgi-bin/koha/tools/showdiffmarc.pl?batchid=%s&importid=%s&id=%s&type=%s';
575
                                    var match_citation = '';
576
                                    if( item.title  ){ match_citation += item.title + ' ' }
577
                                    if( item.author ){ match_citation += item.author }
578
                                $('td:eq(4) ul', nRow).append('<li><label for="import_record_id_'+aData['import_record_id']+'_match_'+index+'">'+match_option+
579
                                    matching_msg.format(item.candidate_match_id, item.score,
580
                                        '<a target="_blank" href="' + record_details_url
581
                                        + item.candidate_match_id + '">' + match_citation + '</a></label></li>')
582
                                );
583
                                $('td:eq(5) ul', nRow).append('<li><a href="'
584
                                        + diff_url.format( [% import_batch_id | html %], aData['import_record_id'], item.candidate_match_id, item.record_type) + '">' + _("View") + '</a></li>');
585
                            });
586
                            checked = "";
587
                            if( !any_checked ){ checked = 'checked="checked"'; }
588
                            $('td:eq(4) ul', nRow).prepend('<li><label><input type="radio" data-import_record_id="'+aData['import_record_id']+'" class="chosen" name="import_record_id_'+aData['import_record_id']+'_match" value="none" ' + checked + disabled + ' > Ignore matches</label></li>');
589
                            $('td:eq(5) ul', nRow).prepend('<li>&nbsp;</li>');
561
                        }
590
                        }
562
                        if (aData['diff_url']) {
591
                        if (aData['diff_url']) {
563
                            $('td:eq(5)', nRow).html(
592
                            $('td:eq(5)', nRow).html(
Lines 584-589 Link Here
584
                });
613
                });
585
            [% END %]
614
            [% END %]
586
615
616
            $("body").on("change", ".chosen", function(e) {
617
                let apimethod = "DELETE";
618
                let apidata ="";
619
                if( $(this).val() != 'none' ){
620
                    apimethod = 'PUT';
621
                    apidata = JSON.stringify({ candidate_match_id: $(this).val() });
622
                }
623
                $.ajax({
624
                    url: '/api/v1/import/[% import_batch_id | html %]/records/'+$(this).data('import_record_id')+'/matches/chosen',
625
                    method: apimethod,
626
                    data: apidata
627
                }).fail(function(){ alert("Unable to update match choices"); return false; });
628
            });
629
587
            $("body").on("click", ".previewMARC", function(e) {
630
            $("body").on("click", ".previewMARC", function(e) {
588
                e.preventDefault();
631
                e.preventDefault();
589
                var ltitle = $(this).text();
632
                var ltitle = $(this).text();
(-)a/reports/acquisitions_stats.pl (+1 lines)
Lines 494-499 sub calculate { Link Here
494
      if ( @$filters[10] );
494
      if ( @$filters[10] );
495
495
496
    $strcalc .= " GROUP BY $linefield, $colfield ORDER BY $linefield,$colfield";
496
    $strcalc .= " GROUP BY $linefield, $colfield ORDER BY $linefield,$colfield";
497
    warn $strcalc;
497
    my $dbcalc = $dbh->prepare($strcalc);
498
    my $dbcalc = $dbh->prepare($strcalc);
498
    $dbcalc->execute;
499
    $dbcalc->execute;
499
500
(-)a/t/db_dependent/ImportBatch.t (+29 lines)
Lines 213-216 subtest "RecordsFromMarcPlugin" => sub { Link Here
213
        'Checked one field in second record' );
213
        'Checked one field in second record' );
214
};
214
};
215
215
216
subtest "_get_commit_action" => sub {
217
    plan tests => 24;
218
    my $mock_import = Test::MockModule->new("C4::ImportBatch");
219
220
    $mock_import->mock( GetBestRecordMatch => sub { return 5; } );
221
    foreach my $record_type ( ('biblio','authority') ){
222
        foreach my $match_action ( ('replace','create_new','ignore') ){
223
            foreach my $no_match_action ( ('create_new','ignore') ){
224
                my ($result, $match, $item_result) =
225
                    C4::ImportBatch::_get_commit_action($match_action, $no_match_action, 'always_add', 'auto_match', 42, $record_type);
226
                is( $result, $match_action, "When match found amd chosen we return the match_action for $record_type records with match action $match_action and no match action $no_match_action");
227
            }
228
        }
229
    }
230
231
    $mock_import->mock( GetBestRecordMatch => sub { my $matches = undef; return $matches; } );
232
    foreach my $record_type ( ('biblio','authority') ){
233
        foreach my $match_action ( ('replace','create_new','ignore') ){
234
            foreach my $no_match_action ( ('create_new','ignore') ){
235
                my ($result, $match, $item_result) =
236
                    C4::ImportBatch::_get_commit_action($match_action, $no_match_action, 'always_add', 'auto_match', 42, $record_type);
237
                is( $result, $no_match_action, "When no match found or chosen we return the match_action for $record_type records with match action $match_action and no match action $no_match_action");
238
            }
239
        }
240
    }
241
242
};
243
244
216
$schema->storage->txn_rollback;
245
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Koha/Import/Record/Matches.t (-3 / +11 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 5;
22
use Test::More tests => 7;
23
23
24
use Koha::Import::Record::Matches;
24
use Koha::Import::Record::Matches;
25
use Koha::Database;
25
use Koha::Database;
Lines 31-45 $schema->storage->txn_begin; Link Here
31
31
32
my $builder = t::lib::TestBuilder->new;
32
my $builder = t::lib::TestBuilder->new;
33
my $nb_of_matches = Koha::Import::Record::Matches->search->count;
33
my $nb_of_matches = Koha::Import::Record::Matches->search->count;
34
my $nb_of_chosen_matches = Koha::Import::Record::Matches->search({ chosen => 1 })->count;
34
35
35
my $match_1 = $builder->build({ source => 'ImportRecordMatch', });
36
my $match_1 = $builder->build({ source => 'ImportRecordMatch', value => { chosen => 1 } });
36
my $match_2 = $builder->build({ source => 'ImportRecordMatch', value => { import_record_id => $match_1->{import_record_id} } });
37
my $match_2 = $builder->build({ source => 'ImportRecordMatch', value => { chosen => 1, import_record_id => $match_1->{import_record_id} } });
37
38
38
is( Koha::Import::Record::Matches->search->count, $nb_of_matches + 2, 'The 2 matches should have been added' );
39
is( Koha::Import::Record::Matches->search->count, $nb_of_matches + 2, 'The 2 matches should have been added' );
39
40
41
is( Koha::Import::Record::Matches->search({chosen => 1 })->count, $nb_of_chosen_matches + 2, 'The 2 chosen matches should have been added' );
42
40
my $retrieved_match_1 = Koha::Import::Record::Matches->search({ import_record_id => $match_1->{import_record_id}, candidate_match_id => $match_1->{candidate_match_id} })->next;
43
my $retrieved_match_1 = Koha::Import::Record::Matches->search({ import_record_id => $match_1->{import_record_id}, candidate_match_id => $match_1->{candidate_match_id} })->next;
41
is_deeply( $retrieved_match_1->unblessed, $match_1, 'Find a match by import record id and candidate should return the correct match' );
44
is_deeply( $retrieved_match_1->unblessed, $match_1, 'Find a match by import record id and candidate should return the correct match' );
42
45
46
my $added_chose = Koha::Import::Record::Matches->search({ import_record_id => $match_1->{import_record_id} });
47
$added_chose->unset_chosen();
48
49
is( Koha::Import::Record::Matches->search({chosen => 1 })->count, $nb_of_chosen_matches, 'The 2 added chosen matches should have been unchosen' );
50
43
$retrieved_match_1->delete;
51
$retrieved_match_1->delete;
44
is( Koha::Import::Record::Matches->search->count, $nb_of_matches + 1, 'Delete should have deleted the match' );
52
is( Koha::Import::Record::Matches->search->count, $nb_of_matches + 1, 'Delete should have deleted the match' );
45
53
(-)a/tools/batch_records_ajax.pl (-18 / +18 lines)
Lines 68-88 my @list = (); Link Here
68
foreach my $record (@$records) {
68
foreach my $record (@$records) {
69
    my $citation = $record->{'title'} || $record->{'authorized_heading'};
69
    my $citation = $record->{'title'} || $record->{'authorized_heading'};
70
70
71
    my $match = GetImportRecordMatches( $record->{'import_record_id'}, 1 );
71
    my $matches = GetImportRecordMatches( $record->{'import_record_id'} );
72
    my $match_citation = '';
73
    my $match_id;
72
    my $match_id;
74
    if ( $#$match > -1 ) {
73
    if ( scalar @$matches > 0 ) {
75
        if ( $match->[0]->{'record_type'} eq 'biblio' ) {
74
        foreach my $match (@$matches){
76
            $match_citation .= $match->[0]->{'title'}
75
        my $match_citation = '';
77
              if defined( $match->[0]->{'title'} );
76
            if ( $match->{'record_type'} eq 'biblio' ) {
78
            $match_citation .= ' ' . $match->[0]->{'author'}
77
                $match_citation .= $match->{'title'}
79
              if defined( $match->[0]->{'author'} );
78
                  if defined( $match->{'title'} );
80
            $match_id = $match->[0]->{'biblionumber'};
79
                $match_citation .= ' ' . $match->{'author'}
81
        }
80
                  if defined( $match->{'author'} );
82
        elsif ( $match->[0]->{'record_type'} eq 'auth' ) {
81
                $match->{'match_citation'} = $match_citation;
83
            if ( defined( $match->[0]->{'authorized_heading'} ) ) {
82
            }
84
                $match_citation .= $match->[0]->{'authorized_heading'};
83
            elsif ( $match->{'record_type'} eq 'auth' ) {
85
                $match_id = $match->[0]->{'candidate_match_id'};
84
                if ( defined( $match->{'authorized_heading'} ) ) {
85
                    $match_citation .= $match->{'authorized_heading'};
86
                    $match->{'match_citation'} = $match_citation;
87
                }
86
            }
88
            }
87
        }
89
        }
88
    }
90
    }
Lines 97-108 foreach my $record (@$records) { Link Here
97
        isbn            => $record->{'isbn'},
99
        isbn            => $record->{'isbn'},
98
        status          => $record->{'status'},
100
        status          => $record->{'status'},
99
        overlay_status  => $record->{'overlay_status'},
101
        overlay_status  => $record->{'overlay_status'},
100
        match_citation  => $match_citation,
101
        matched         => $record->{'matched_biblionumber'}
102
        matched         => $record->{'matched_biblionumber'}
102
          || $record->{'matched_authid'}
103
          || $record->{'matched_authid'}
103
          || q{},
104
          || q{},
104
        score => $#$match > -1 ? $match->[0]->{'score'} : 0,
105
        score => scalar @$matches > 0 ? $matches->[0]->{'score'} : 0,
105
        match_id => $match_id,
106
        matches => $matches,
106
        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
107
        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
107
      };
108
      };
108
}
109
}
109
- 

Return to bug 22785