|
Lines 22-27
use Modern::Perl;
Link Here
|
| 22 |
use base qw(Koha::Object); |
22 |
use base qw(Koha::Object); |
| 23 |
|
23 |
|
| 24 |
use Koha::Checkouts; |
24 |
use Koha::Checkouts; |
|
|
25 |
use Koha::Exceptions; |
| 25 |
use Koha::Exceptions::Checkouts::ReturnClaims; |
26 |
use Koha::Exceptions::Checkouts::ReturnClaims; |
| 26 |
use Koha::Old::Checkouts; |
27 |
use Koha::Old::Checkouts; |
| 27 |
use Koha::Patrons; |
28 |
use Koha::Patrons; |
|
Lines 79-84
sub patron {
Link Here
|
| 79 |
return Koha::Patron->_new_from_dbic( $borrower ) if $borrower; |
80 |
return Koha::Patron->_new_from_dbic( $borrower ) if $borrower; |
| 80 |
} |
81 |
} |
| 81 |
|
82 |
|
|
|
83 |
=head3 resolve |
| 84 |
|
| 85 |
$claim->resolve( |
| 86 |
{ |
| 87 |
resolution => $resolution, |
| 88 |
resolved_by => $patron_id, |
| 89 |
[ resolved_on => $dt |
| 90 |
new_lost_status => $status, ] |
| 91 |
} |
| 92 |
); |
| 93 |
|
| 94 |
Resolve the claim. |
| 95 |
|
| 96 |
=cut |
| 97 |
|
| 98 |
sub resolve { |
| 99 |
my ( $self, $params ) = @_; |
| 100 |
|
| 101 |
my @mandatory = ( 'resolution', 'resolved_by' ); |
| 102 |
for my $param (@mandatory) { |
| 103 |
unless ( defined( $params->{$param} ) ) { |
| 104 |
Koha::Exceptions::MissingParameter->throw( error => "The $param parameter is mandatory" ); |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
$self->_result->result_source->schema->txn_do( |
| 109 |
sub { |
| 110 |
$self->set( |
| 111 |
{ resolution => $params->{resolution}, |
| 112 |
resolved_by => $params->{resolved_by}, |
| 113 |
resolved_on => $params->{resolved_on} // \'NOW()', |
| 114 |
updated_by => $params->{resolved_by} |
| 115 |
} |
| 116 |
)->store; |
| 117 |
|
| 118 |
if ( defined $params->{new_lost_status} ) { |
| 119 |
$self->checkout->item->itemlost( $params->{new_lost_status} )->store; |
| 120 |
} |
| 121 |
} |
| 122 |
); |
| 123 |
|
| 124 |
return $self; |
| 125 |
} |
| 126 |
|
| 82 |
=head3 to_api_mapping |
127 |
=head3 to_api_mapping |
| 83 |
|
128 |
|
| 84 |
This method returns the mapping for representing a Koha::Checkouts::ReturnClaim object |
129 |
This method returns the mapping for representing a Koha::Checkouts::ReturnClaim object |
| 85 |
- |
|
|