|
Lines 182-187
sub allows_renewal {
Link Here
|
| 182 |
); |
182 |
); |
| 183 |
} |
183 |
} |
| 184 |
|
184 |
|
|
|
185 |
=head3 delete_history |
| 186 |
|
| 187 |
Anonymize patron's checkout history. |
| 188 |
|
| 189 |
=cut |
| 190 |
|
| 191 |
sub delete_history { |
| 192 |
my $c = shift->openapi->valid_input or return; |
| 193 |
|
| 194 |
my $patron_id = $c->validation->param('patron_id'); |
| 195 |
|
| 196 |
my $patrons = Koha::Patrons->search({ |
| 197 |
'me.borrowernumber' => $patron_id |
| 198 |
}); |
| 199 |
|
| 200 |
$patrons->anonymise_issue_history; |
| 201 |
|
| 202 |
unless ($patrons->count) { |
| 203 |
return $c->render( status => 404, openapi => { |
| 204 |
error => "Patron doesn't exist" |
| 205 |
}); |
| 206 |
} |
| 207 |
|
| 208 |
return $c->render( status => 204, openapi => "" ); |
| 209 |
} |
| 210 |
|
| 185 |
=head3 _to_api |
211 |
=head3 _to_api |
| 186 |
|
212 |
|
| 187 |
Helper function that maps a hashref of Koha::Checkout attributes into REST api |
213 |
Helper function that maps a hashref of Koha::Checkout attributes into REST api |