Lines 1-4
Link Here
|
1 |
package Koha::REST::V1::Hold; |
1 |
package Koha::REST::V1::Holds; |
2 |
|
2 |
|
3 |
# This file is part of Koha. |
3 |
# This file is part of Koha. |
4 |
# |
4 |
# |
Lines 179-188
sub add {
Link Here
|
179 |
if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) { |
179 |
if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) { |
180 |
my $broken_fk = $_->broken_fk; |
180 |
my $broken_fk = $_->broken_fk; |
181 |
|
181 |
|
182 |
if ( grep { $_ eq $broken_fk } keys %{$Koha::REST::V1::Hold::to_api_mapping} ) { |
182 |
if ( grep { $_ eq $broken_fk } keys %{$Koha::REST::V1::Holds::to_api_mapping} ) { |
183 |
$c->render( |
183 |
$c->render( |
184 |
status => 404, |
184 |
status => 404, |
185 |
openapi => $Koha::REST::V1::Hold::to_api_mapping->{$broken_fk} . ' not found.' |
185 |
openapi => $Koha::REST::V1::Holds::to_api_mapping->{$broken_fk} . ' not found.' |
186 |
); |
186 |
); |
187 |
} |
187 |
} |
188 |
else { |
188 |
else { |
Lines 282-289
sub _to_api {
Link Here
|
282 |
my $hold = shift; |
282 |
my $hold = shift; |
283 |
|
283 |
|
284 |
# Rename attributes |
284 |
# Rename attributes |
285 |
foreach my $column ( keys %{ $Koha::REST::V1::Hold::to_api_mapping } ) { |
285 |
foreach my $column ( keys %{ $Koha::REST::V1::Holds::to_api_mapping } ) { |
286 |
my $mapped_column = $Koha::REST::V1::Hold::to_api_mapping->{$column}; |
286 |
my $mapped_column = $Koha::REST::V1::Holds::to_api_mapping->{$column}; |
287 |
if ( exists $hold->{ $column } |
287 |
if ( exists $hold->{ $column } |
288 |
&& defined $mapped_column ) |
288 |
&& defined $mapped_column ) |
289 |
{ |
289 |
{ |
Lines 311-318
attribute names.
Link Here
|
311 |
sub _to_model { |
311 |
sub _to_model { |
312 |
my $hold = shift; |
312 |
my $hold = shift; |
313 |
|
313 |
|
314 |
foreach my $attribute ( keys %{ $Koha::REST::V1::Hold::to_model_mapping } ) { |
314 |
foreach my $attribute ( keys %{ $Koha::REST::V1::Holds::to_model_mapping } ) { |
315 |
my $mapped_attribute = $Koha::REST::V1::Hold::to_model_mapping->{$attribute}; |
315 |
my $mapped_attribute = $Koha::REST::V1::Holds::to_model_mapping->{$attribute}; |
316 |
if ( exists $hold->{ $attribute } |
316 |
if ( exists $hold->{ $attribute } |
317 |
&& defined $mapped_attribute ) |
317 |
&& defined $mapped_attribute ) |
318 |
{ |
318 |
{ |