View | Details | Raw Unified | Return to bug 18936
Collapse All | Expand All

(-)a/Koha/REST/V1/Checkouts.pm (-1 / +2 lines)
Lines 213-225 sub allows_renewal { Link Here
213
            categorycode => $checkout->patron->categorycode,
213
            categorycode => $checkout->patron->categorycode,
214
            itemtype     => $checkout->item->effective_itemtype,
214
            itemtype     => $checkout->item->effective_itemtype,
215
            branchcode   => $checkout->branchcode,
215
            branchcode   => $checkout->branchcode,
216
            rule_name    => 'renewalsallowed',
216
        }
217
        }
217
    );
218
    );
218
    return $c->render(
219
    return $c->render(
219
        status => 200,
220
        status => 200,
220
        openapi => {
221
        openapi => {
221
            allows_renewal => $renewable,
222
            allows_renewal => $renewable,
222
            max_renewals => $rule->renewalsallowed,
223
            max_renewals => $rule->rule_value,
223
            current_renewals => $checkout->renewals,
224
            current_renewals => $checkout->renewals,
224
            error => $error
225
            error => $error
225
        }
226
        }
(-)a/t/db_dependent/api/v1/checkouts.t (-7 / +12 lines)
Lines 71-81 $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$notexisting_patron Link Here
71
  ->status_is(200)
71
  ->status_is(200)
72
  ->json_is([]);
72
  ->json_is([]);
73
73
74
$dbh->do('DELETE FROM issuingrules');
74
Koha::CirculationRules->set_rules(
75
$dbh->do(q{
75
    {
76
    INSERT INTO issuingrules (categorycode, branchcode, itemtype, renewalperiod, renewalsallowed, issuelength)
76
        categorycode => undef,
77
    VALUES (?, ?, ?, ?, ?, ?)
77
        itemtype     => undef,
78
}, {}, '*', '*', '*', 7, 1, 5);
78
        branchcode   => undef,
79
        rules        => {
80
            renewalperiod => 7,
81
            renewalsallowed => 1,
82
            issuelength => 5,
83
        }
84
    }
85
);
79
86
80
my $item1 = $builder->build_sample_item;
87
my $item1 = $builder->build_sample_item;
81
my $item2 = $builder->build_sample_item;
88
my $item2 = $builder->build_sample_item;
Lines 173-179 $t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id) Link Here
173
  ->status_is(200)
180
  ->status_is(200)
174
  ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 }) );
181
  ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 }) );
175
182
176
177
my $expected_datedue = $date_due
183
my $expected_datedue = $date_due
178
    ->set_time_zone('local')
184
    ->set_time_zone('local')
179
    ->add(days => 7)
185
    ->add(days => 7)
180
- 

Return to bug 18936