Bug 32685: Correct authority match display on import

Bug 22785 updated the import records table, but mixed javascript variables and template toolkit, this means all matches are treated as biblios

To test:
1 - Export some authority records form Koha
2 - Create a matching rule based on 'Local-number' and field 001
3 - Stage the records for import using above rule
4 - Note the match links point to authorities, but the citations point to biblios
5 - Apply patch
6 - Reload the page
7 - Confirm the links have the correct text

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-01-19 20:47:31 +00:00 committed by Tomas Cohen Arazi
parent d599694ef5
commit 9d7cca8b4d
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -545,18 +545,20 @@
checked = 'checked="checked"';
any_checked = 1;
}
[% IF(item.record_type == 'auth') -%]
var matching_msg = _("Matches authority %s (score=%s):%s");
[%- ELSE -%]
var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
[%- END %]
var match_option = "";
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 + '> ';
var diff_url = '/cgi-bin/koha/tools/showdiffmarc.pl?batchid=%s&importid=%s&id=%s&type=%s';
var match_citation = '';
if( item.title ){ match_citation += item.title + ' ' }
if( item.author ){ match_citation += item.author }
var matching_msg = '';
if ( item.record_type == 'auth' ){
matching_msg = _("Matches authority %s (score=%s):%s");
if( item.authorized_heading ){ match_citation += item.authorized_heading }
} else {
matching_msg = _("Matches bibliographic record %s (score=%s):%s");
if( item.title ){ match_citation += item.title + ' ' }
if( item.author ){ match_citation += item.author }
}
$('td:eq(4) ul', nRow).append('<li><label for="import_record_id_'+aData['import_record_id']+'_match_'+index+'">'+match_option+
matching_msg.format(item.candidate_match_id, item.score,
'<a target="_blank" href="' + record_details_url