Bug 32875: Fix cataloguing/value_builder/unimarc_leader_authorities.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Julian Maurice 2023-02-03 11:58:55 +01:00 committed by Tomas Cohen Arazi
parent 16bd0d658e
commit 634c23f699
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 5 additions and 4 deletions

View File

@ -30,15 +30,16 @@ sub plugin_javascript {
my ( $dbh, $record, $tagslib, $field_number ) = @_;
my $res = "
<script type='text/javascript'>
function Clic$field_number(i) {
function Clic$field_number(event) {
event.preventDefault();
var defaultvalue;
try {
defaultvalue = document.getElementById(i).value;
defaultvalue = document.getElementById(event.data.id).value;
} catch(e) {
alert('error when getting '+i);
alert('error when getting '+event.data.id);
return;
}
window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_leader_authorities.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc_field_000\",'width=1000,height=600,toolbar=false,scrollbars=yes');
window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_leader_authorities.pl&index=\" + event.data.id + \"&result=\"+defaultvalue,\"unimarc_field_000\",'width=1000,height=600,toolbar=false,scrollbars=yes');
}
</script>
";