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.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8b0e4d3c15)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Pedro Amorim 2025-01-20 13:34:22 +00:00 committed by Paul Derscheid
parent ef2c1c288c
commit 9c1de15a5f
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 13 additions and 4 deletions

View File

@ -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};
}