From deb61b43021bc66b21dee778c863c802e18851a7 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 20 Jan 2025 13:34:22 +0000 Subject: [PATCH] Bug 38928: Handle rft_id or id If a semicolon exists, the key should be what's before the semicolon, and its value, whats the after. Otherwise, default to 'doi' as it was before. To test: 1) Enable ILLModule. 2) Visit the following URLs http://localhost:8080/cgi-bin/koha/opac-illrequests.pl?op=create&backend=Standard&openurl=1&genre=article&id=10.1016/j.cognition.2024.105913 http://localhost:8080/cgi-bin/koha/opac-illrequests.pl?op=create&backend=Standard&openurl=1&genre=article&id=doi:10.1016/j.cognition.2024.105913 3) Notice that in both cases, only the doi value '10.1016/j.cognition.2024.105913' should be present in the input. --- Koha/ILL/Backend/Standard.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm index a063f50885b..cdf6dbee3ff 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -1058,8 +1058,6 @@ sub _openurl_to_ill { volume => 'volume', isbn => 'isbn', issn => 'issn', - rft_id => 'doi', - id => 'doi', doi => 'doi', year => 'year', title => 'title', @@ -1097,8 +1095,19 @@ sub _openurl_to_ill { # Otherwise, pass it through untransformed and maybe move it # to our custom parameters array if ( !exists $ignore->{$meta_key} ) { - push @{$custom_key}, $meta_key; - push @{$custom_value}, $params->{other}->{$meta_key}; + if ($meta_key eq 'id' || $meta_key eq 'rft_id') { + if ( $params->{other}->{$meta_key} =~ /:/ ) { + my ( $k, $v ) = split /:/, $params->{other}->{$meta_key}, 2; + if ( defined $k && defined $v ) { + $return->{ lc $k } = $v; + } + } else { + $return->{doi} = $params->{other}->{$meta_key}; + } + }else{ + push @{$custom_key}, $meta_key; + push @{$custom_value}, $params->{other}->{$meta_key}; + } } else { $return->{$meta_key} = $params->{other}->{$meta_key}; } -- 2.39.5