|
Lines 310-330
sub add_item {
Link Here
|
| 310 |
$item->barcode($barcode); |
310 |
$item->barcode($barcode); |
| 311 |
} |
311 |
} |
| 312 |
|
312 |
|
| 313 |
if ( defined $item->barcode |
313 |
my $stored_item = $item->store; |
| 314 |
&& Koha::Items->search( { barcode => $item->barcode } )->count ) |
314 |
$stored_item->discard_changes; |
| 315 |
{ |
|
|
| 316 |
return $c->render( |
| 317 |
status => 400, |
| 318 |
openapi => { error => "Barcode not unique" } |
| 319 |
); |
| 320 |
} |
| 321 |
|
| 322 |
my $storedItem = $item->store; |
| 323 |
$storedItem->discard_changes; |
| 324 |
|
315 |
|
| 325 |
$c->render( |
316 |
$c->render( |
| 326 |
status => 201, |
317 |
status => 201, |
| 327 |
openapi => $storedItem->to_api |
318 |
openapi => $stored_item->to_api |
| 328 |
); |
319 |
); |
| 329 |
} |
320 |
} |
| 330 |
catch { |
321 |
catch { |
| 331 |
- |
|
|