Skip to content

Commit 15e2509

Browse files
committed
Add ILL batches compatibility
1 parent dbc492c commit 15e2509

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

Koha/Plugin/Com/PTFSEurope/IncDocs.pm

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,11 @@ sub capabilities {
11591159

11601160
unmediated_ill => sub { $self->unmediated_confirm(@_); },
11611161

1162-
opac_unauthenticated_ill_requests => sub { return 1; }
1162+
opac_unauthenticated_ill_requests => sub { return 1; },
1163+
1164+
provides_batch_requests => sub { return 1; },
1165+
1166+
create_api => sub { $self->create_api(@_) }
11631167
};
11641168

11651169
return $capabilities->{$name};
@@ -1370,6 +1374,28 @@ sub _openurl_to_incdocs {
13701374
return $params;
13711375
}
13721376

1377+
sub create_api {
1378+
my ( $self, $body, $request ) = @_;
1379+
1380+
foreach my $attr ( @{ $body->{extended_attributes} } ) {
1381+
my $prop = $attr->{type};
1382+
my $rd_prop = find_core_to_incdocs($prop);
1383+
if ($rd_prop) {
1384+
my @value = map { $_->{type} eq $rd_prop ? $_->{value} : () } @{ $body->{extended_attributes} };
1385+
$body->{$rd_prop} = $value[0];
1386+
}
1387+
}
1388+
1389+
delete $body->{extended_attributes};
1390+
my $submission = $self->create_submission(
1391+
{
1392+
request => $request,
1393+
other => $body
1394+
}
1395+
);
1396+
return $submission;
1397+
}
1398+
13731399
=head3 find_core_to_incdocs
13741400
13751401
Given a core metadata property, find the element

0 commit comments

Comments
 (0)