Bugzilla – Attachment 156597 Details for
Bug 30708
Creation of a new 'Preservation' module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30708: Remove c->validation in API controllers
Bug-30708-Remove-c-validation-in-API-controllers.patch (text/plain), 9.23 KB, created by
Jonathan Druart
on 2023-10-06 10:45:57 UTC
(
hide
)
Description:
Bug 30708: Remove c->validation in API controllers
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-06 10:45:57 UTC
Size:
9.23 KB
patch
obsolete
>From 4ed36934696038426069c9649e29ca5013cd5b05 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 6 Oct 2023 12:45:19 +0200 >Subject: [PATCH] Bug 30708: Remove c->validation in API controllers > >Fixed conflict with bug 33556 >--- > Koha/REST/V1/Preservation/Processings.pm | 10 +++---- > Koha/REST/V1/Preservation/Trains.pm | 38 ++++++++++++------------ > Koha/REST/V1/Preservation/WaitingList.pm | 4 +-- > 3 files changed, 26 insertions(+), 26 deletions(-) > >diff --git a/Koha/REST/V1/Preservation/Processings.pm b/Koha/REST/V1/Preservation/Processings.pm >index 98a924b68a0..1c0b4f385f3 100644 >--- a/Koha/REST/V1/Preservation/Processings.pm >+++ b/Koha/REST/V1/Preservation/Processings.pm >@@ -54,7 +54,7 @@ sub get { > my $c = shift->openapi->valid_input or return; > > return try { >- my $processing_id = $c->validation->param('processing_id'); >+ my $processing_id = $c->param('processing_id'); > my $processing = $c->objects->find( Koha::Preservation::Processings->search, $processing_id ); > > unless ($processing) { >@@ -87,7 +87,7 @@ sub add { > Koha::Database->new->schema->txn_do( > sub { > >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > > my $attributes = delete $body->{attributes} // []; > >@@ -154,7 +154,7 @@ Controller function that handles updating a Koha::Preservation::Processing objec > sub update { > my $c = shift->openapi->valid_input or return; > >- my $processing_id = $c->validation->param('processing_id'); >+ my $processing_id = $c->param('processing_id'); > my $processing = Koha::Preservation::Processings->find( $processing_id ); > > unless ($processing) { >@@ -168,7 +168,7 @@ sub update { > Koha::Database->new->schema->txn_do( > sub { > >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > > my $attributes = delete $body->{attributes} // []; > >@@ -227,7 +227,7 @@ sub update { > sub delete { > my $c = shift->openapi->valid_input or return; > >- my $processing_id = $c->validation->param('processing_id'); >+ my $processing_id = $c->param('processing_id'); > my $processing = Koha::Preservation::Processings->find( $processing_id ); > unless ($processing) { > return $c->render( >diff --git a/Koha/REST/V1/Preservation/Trains.pm b/Koha/REST/V1/Preservation/Trains.pm >index 8c79bf4cfff..45b03716b31 100644 >--- a/Koha/REST/V1/Preservation/Trains.pm >+++ b/Koha/REST/V1/Preservation/Trains.pm >@@ -58,7 +58,7 @@ sub get { > my $c = shift->openapi->valid_input or return; > > return try { >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = $c->objects->find( Koha::Preservation::Trains->search, $train_id ); > > unless ($train) { >@@ -91,7 +91,7 @@ sub add { > Koha::Database->new->schema->txn_do( > sub { > >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > > my $train = Koha::Preservation::Train->new_from_api($body)->store; > >@@ -155,7 +155,7 @@ Controller function that handles updating a Koha::Preservation::Train object > sub update { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -169,7 +169,7 @@ sub update { > Koha::Database->new->schema->txn_do( > sub { > >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > > $train->set_from_api($body)->store; > >@@ -226,7 +226,7 @@ Controller function that handles deleting a Koha::Preservation::Train object > sub delete { > my $c = shift->openapi->valid_input or return; > >- my $train = Koha::Preservation::Trains->find( $c->validation->param('train_id') ); >+ my $train = Koha::Preservation::Trains->find( $c->param('train_id') ); > unless ($train) { > return $c->render( > status => 404, >@@ -255,7 +255,7 @@ Controller function that handles getting an item from a train > sub get_item { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -265,7 +265,7 @@ sub get_item { > ); > } > >- my $train_item_id = $c->validation->param('train_item_id'); >+ my $train_item_id = $c->param('train_item_id'); > > my $train_item = $c->objects->find(Koha::Preservation::Train::Items->search, { train_item_id => $train_item_id, train_id => $train_id }); > >@@ -297,7 +297,7 @@ Controller function that handles adding items in batch to a train > sub add_items { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -307,7 +307,7 @@ sub add_items { > ); > } > >- my $body = $c->validation->every_param('body'); >+ my $body = $c->req->json; > return try { > Koha::Database->new->schema->txn_do( > sub { >@@ -339,7 +339,7 @@ Controller function that handles adding a new item to a train > sub add_item { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -349,7 +349,7 @@ sub add_item { > ); > } > >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > return try { > Koha::Database->new->schema->txn_do( > sub { >@@ -408,7 +408,7 @@ Controller function that handles copying an item from a train to an other > sub copy_item { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -418,7 +418,7 @@ sub copy_item { > ); > } > >- my $train_item_id = $c->validation->param('train_item_id'); >+ my $train_item_id = $c->param('train_item_id'); > > my $train_item = Koha::Preservation::Train::Items->search({ train_item_id => $train_item_id, train_id => $train_id })->single; > >@@ -429,7 +429,7 @@ sub copy_item { > ); > } > >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > return try { > Koha::Database->new->schema->txn_do( > sub { >@@ -512,7 +512,7 @@ Controller function that handles updating an item from a train > sub update_item { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -522,7 +522,7 @@ sub update_item { > ); > } > >- my $train_item_id = $c->validation->param('train_item_id'); >+ my $train_item_id = $c->param('train_item_id'); > > my $train_item = Koha::Preservation::Train::Items->search({ train_item_id => $train_item_id, train_id => $train_id })->single; > >@@ -536,7 +536,7 @@ sub update_item { > return try { > Koha::Database->new->schema->txn_do( > sub { >- my $body = $c->validation->param('body'); >+ my $body = $c->req->json; > my $attributes = delete $body->{attributes} // []; > > $train_item->set_from_api($body)->store; >@@ -560,7 +560,7 @@ Controller function that handles removing an item from a train > sub remove_item { > my $c = shift->openapi->valid_input or return; > >- my $train_id = $c->validation->param('train_id'); >+ my $train_id = $c->param('train_id'); > my $train = Koha::Preservation::Trains->find( $train_id ); > > unless ($train) { >@@ -570,7 +570,7 @@ sub remove_item { > ); > } > >- my $train_item_id = $c->validation->param('train_item_id'); >+ my $train_item_id = $c->param('train_item_id'); > > my $train_item = $train->items->find($train_item_id); > >diff --git a/Koha/REST/V1/Preservation/WaitingList.pm b/Koha/REST/V1/Preservation/WaitingList.pm >index cc2c335e271..e43eab3ed9e 100644 >--- a/Koha/REST/V1/Preservation/WaitingList.pm >+++ b/Koha/REST/V1/Preservation/WaitingList.pm >@@ -74,7 +74,7 @@ sub add_items { > my $c = shift->openapi->valid_input or return; > > return try { >- my $body = $c->validation->every_param('body'); >+ my $body = $c->req->json; > my $new_not_for_loan = C4::Context->preference('PreservationNotForLoanWaitingListIn'); > > Koha::Exceptions::Preservation::MissingSettings->throw( parameter => 'PreservationNotForLoanWaitingListIn' ) unless $new_not_for_loan; >@@ -126,7 +126,7 @@ sub remove_item { > my $c = shift->openapi->valid_input or return; > > return try { >- my $item_id = $c->validation->param('item_id'); >+ my $item_id = $c->param('item_id'); > > my $item = Koha::Items->find($item_id); > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30708
:
134715
|
134716
|
134732
|
134733
|
134734
|
134736
|
134737
|
134738
|
134782
|
134783
|
134784
|
134785
|
152939
|
152940
|
152941
|
152942
|
152943
|
152944
|
152945
|
152946
|
152947
|
152948
|
152949
|
152950
|
152951
|
152952
|
152953
|
152954
|
152955
|
152956
|
152957
|
152958
|
152959
|
152960
|
152961
|
152962
|
152963
|
152964
|
152965
|
152966
|
152967
|
152968
|
152969
|
152970
|
153102
|
153576
|
154167
|
154168
|
154169
|
154170
|
154171
|
154172
|
154173
|
154174
|
154175
|
154176
|
154177
|
154178
|
154179
|
154180
|
154181
|
154182
|
154183
|
154184
|
154185
|
154186
|
154187
|
154188
|
154189
|
154190
|
154191
|
154192
|
154193
|
154194
|
154195
|
154196
|
154197
|
154198
|
154199
|
154200
|
154201
|
154202
|
154203
|
156592
|
156596
|
156597
|
156636
|
156637
|
156638
|
156639
|
156640
|
156641
|
156642
|
156643
|
156644
|
156645
|
156646
|
156647
|
156648
|
156649
|
156650
|
156651
|
156652
|
156653
|
156654
|
156655
|
156656
|
156657
|
156658
|
156659
|
156660
|
156661
|
156662
|
156663
|
156664
|
156665
|
156666
|
156667
|
156668
|
156669
|
156670
|
156671
|
156672
|
156673
|
156674
|
156675
|
157502
|
157503
|
157506
|
157508
|
157512
|
157514
|
157557