Bugzilla – Attachment 146474 Details for
Bug 30642
We should record the renewal type (automatic/manual)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30642: Make renewal_type an enum in spec and add test
Bug-30642-Make-renewaltype-an-enum-in-spec-and-add.patch (text/plain), 3.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-02-10 12:43:36 UTC
(
hide
)
Description:
Bug 30642: Make renewal_type an enum in spec and add test
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-02-10 12:43:36 UTC
Size:
3.04 KB
patch
obsolete
>From 3e0542f19fd4815ddfce2d75d44d059d2ad914af Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 10 Feb 2023 09:35:01 -0300 >Subject: [PATCH] Bug 30642: Make renewal_type an enum in spec and add test > >This patch makes the renewal_type an enum, to match the change on the >DB. A test is added to account the fact the API is always setting >'Manual' request type. > >Bonus: small portion of code gets a tidy, should've been asked by QA. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Circulation.pm | 11 +++++------ > api/v1/swagger/definitions/renewal.yaml | 3 +++ > t/db_dependent/api/v1/checkouts.t | 6 +++++- > 3 files changed, 13 insertions(+), 7 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 1421c7869b8..5d4ffa27ae0 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3207,12 +3207,11 @@ sub AddRenewal { > > # Add renewal record > my $renewal = Koha::Checkouts::Renewal->new( >- { >- checkout_id => $issue->issue_id, >- renewer_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, >- seen => $seen, >- interface => C4::Context->interface, >- renewal_type => $renewal_type >+ { checkout_id => $issue->issue_id, >+ interface => C4::Context->interface, >+ renewal_type => $renewal_type, >+ renewer_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, >+ seen => $seen, > } > )->store(); > >diff --git a/api/v1/swagger/definitions/renewal.yaml b/api/v1/swagger/definitions/renewal.yaml >index 895fe4811e3..0e27e238ce9 100644 >--- a/api/v1/swagger/definitions/renewal.yaml >+++ b/api/v1/swagger/definitions/renewal.yaml >@@ -32,6 +32,9 @@ properties: > type: > - string > - "null" >+ enum: >+ - Automatic >+ - Manual > renewer: > type: > - object >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index f95abf10f32..8c58dd217c3 100755 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 98; >+use Test::More tests => 99; > use Test::MockModule; > use Test::Mojo; > use t::lib::Mocks; >@@ -182,11 +182,15 @@ my $expected_datedue = $date_due > ->set_time_zone('local') > ->add(days => 7) > ->set(hour => 23, minute => 59, second => 0); >+ > $t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) > ->status_is(201) > ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) ) > ->header_is(Location => "/api/v1/checkouts/" . $issue1->issue_id . "/renewal"); > >+my $renewal = $issue1->renewals->last; >+is( $renewal->renewal_type, 'Manual', 'Manual renewal recorded' ); >+ > $t->get_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewals" ) > ->status_is(200) > ->json_is('/0/checkout_id' => $issue1->issue_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 30642
:
144451
|
144457
|
144463
|
144499
|
144504
|
144505
|
145518
|
145519
|
145520
|
146471
|
146472
|
146473
|
146474
|
146476
|
146614