@@ -, +, @@ - Fixes a bug caused by the refactoring in - Changes the tests to use the new Koha::CirculationRule objects instead of directly using issuingrules DB table --- Koha/REST/V1/Checkouts.pm | 3 ++- t/db_dependent/api/v1/checkouts.t | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) --- a/Koha/REST/V1/Checkouts.pm +++ a/Koha/REST/V1/Checkouts.pm @@ -213,13 +213,14 @@ sub allows_renewal { categorycode => $checkout->patron->categorycode, itemtype => $checkout->item->effective_itemtype, branchcode => $checkout->branchcode, + rule_name => 'renewalsallowed', } ); return $c->render( status => 200, openapi => { allows_renewal => $renewable, - max_renewals => $rule->renewalsallowed, + max_renewals => $rule->rule_value, current_renewals => $checkout->renewals, error => $error } --- a/t/db_dependent/api/v1/checkouts.t +++ a/t/db_dependent/api/v1/checkouts.t @@ -71,11 +71,18 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$notexisting_patron ->status_is(200) ->json_is([]); -$dbh->do('DELETE FROM issuingrules'); -$dbh->do(q{ - INSERT INTO issuingrules (categorycode, branchcode, itemtype, renewalperiod, renewalsallowed, issuelength) - VALUES (?, ?, ?, ?, ?, ?) -}, {}, '*', '*', '*', 7, 1, 5); +Koha::CirculationRules->set_rules( + { + categorycode => undef, + itemtype => undef, + branchcode => undef, + rules => { + renewalperiod => 7, + renewalsallowed => 1, + issuelength => 5, + } + } +); my $item1 = $builder->build_sample_item; my $item2 = $builder->build_sample_item; @@ -173,7 +180,6 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id) ->status_is(200) ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 }) ); - my $expected_datedue = $date_due ->set_time_zone('local') ->add(days => 7) --