Bug 29105: Add effective_itemtype handling to items api
This patch adds effective_item_type_id to the items api.
We overload the to_api method to append the effective_item_type_id field
with that of the effective itemtype code.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit dc75b5d5cd
)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
5974ff87c7
commit
f00a28b576
2 changed files with 22 additions and 0 deletions
17
Koha/Item.pm
17
Koha/Item.pm
|
@ -1269,6 +1269,23 @@ sub public_read_list {
|
|||
];
|
||||
}
|
||||
|
||||
=head3 to_api
|
||||
|
||||
Overloaded to_api method to ensure item-level itypes is adhered to.
|
||||
|
||||
=cut
|
||||
|
||||
sub to_api {
|
||||
my ($self, $params) = @_;
|
||||
|
||||
my $response = $self->SUPER::to_api($params);
|
||||
my $overrides = {};
|
||||
|
||||
$overrides->{effective_item_type_id} = $self->effective_itemtype;
|
||||
|
||||
return { %$response, %$overrides };
|
||||
}
|
||||
|
||||
=head3 to_api_mapping
|
||||
|
||||
This method returns the mapping for representing a Koha::Item object
|
||||
|
|
|
@ -183,6 +183,11 @@ properties:
|
|||
- string
|
||||
- "null"
|
||||
description: Itemtype defining the type for this item
|
||||
effective_item_type_id:
|
||||
type:
|
||||
- string
|
||||
- "null"
|
||||
description: Effective itemtype defining the type for this item_id
|
||||
extended_subfields:
|
||||
type:
|
||||
- string
|
||||
|
|
Loading…
Reference in a new issue