|
Lines 349-354
sub resume {
Link Here
|
| 349 |
}; |
349 |
}; |
| 350 |
} |
350 |
} |
| 351 |
|
351 |
|
|
|
352 |
=head3 update_priority |
| 353 |
|
| 354 |
Method that handles modifying a Koha::Hold object |
| 355 |
|
| 356 |
=cut |
| 357 |
|
| 358 |
sub update_priority { |
| 359 |
my $c = shift->openapi->valid_input or return; |
| 360 |
|
| 361 |
my $hold_id = $c->validation->param('hold_id'); |
| 362 |
my $hold = Koha::Holds->find($hold_id); |
| 363 |
|
| 364 |
unless ($hold) { |
| 365 |
return $c->render( |
| 366 |
status => 404, |
| 367 |
openapi => { error => "Hold not found" } |
| 368 |
); |
| 369 |
} |
| 370 |
|
| 371 |
return try { |
| 372 |
my $priority = $c->req->json; |
| 373 |
C4::Reserves::_FixPriority( |
| 374 |
{ |
| 375 |
reserve_id => $hold_id, |
| 376 |
rank => $priority |
| 377 |
} |
| 378 |
); |
| 379 |
|
| 380 |
return $c->render( status => 200, openapi => $priority ); |
| 381 |
} |
| 382 |
catch { |
| 383 |
return $c->render( |
| 384 |
status => 500, |
| 385 |
openapi => { error => "Something went wrong. check the logs." } |
| 386 |
); |
| 387 |
}; |
| 388 |
} |
| 389 |
|
| 390 |
=head2 Internal methods |
| 391 |
|
| 352 |
=head3 _to_api |
392 |
=head3 _to_api |
| 353 |
|
393 |
|
| 354 |
Helper function that maps unblessed Koha::Hold objects into REST api |
394 |
Helper function that maps unblessed Koha::Hold objects into REST api |
| 355 |
- |
|
|