|
Lines 176-181
sub cancel {
Link Here
|
| 176 |
return $self; |
176 |
return $self; |
| 177 |
} |
177 |
} |
| 178 |
|
178 |
|
|
|
179 |
=head3 remedy |
| 180 |
|
| 181 |
my $new_transfer = $transfer->remedy( |
| 182 |
{ |
| 183 |
to => $to_library, |
| 184 |
reason => $reason, |
| 185 |
[ ignore_limits => 0, force => 0 ] |
| 186 |
} |
| 187 |
); |
| 188 |
|
| 189 |
Used when a transfer has arrived at the wrong destination. Replaces this transfer by |
| 190 |
cancelling it with the 'WrongTransfer' reason and sets up a new transfer. |
| 191 |
|
| 192 |
FIXME: remedy or rectify |
| 193 |
|
| 194 |
=cut |
| 195 |
|
| 196 |
sub remedy { |
| 197 |
my ( $self, $params ) = @_; |
| 198 |
|
| 199 |
# FIXME: Should we remedy a transfer if it's just gone back to the originating branch, or just leave it in transit as is. |
| 200 |
|
| 201 |
# Cancel the existing wrong transfer |
| 202 |
$self->set( |
| 203 |
{ |
| 204 |
datecancelled => dt_from_string, |
| 205 |
cancellation_reason => 'WrongTransfer' |
| 206 |
} |
| 207 |
)->store(); |
| 208 |
|
| 209 |
# Add a new transfer and immediately set to in transit (ignoring limits) |
| 210 |
my $new_transfer = Koha::Item::Transfer->new( |
| 211 |
{ |
| 212 |
itemnumber => $self->itemnumber, |
| 213 |
daterequested => dt_from_string, |
| 214 |
datesent => undef, |
| 215 |
frombranch => $self->item->holdingbranch, |
| 216 |
tobranch => $self->tobranch, |
| 217 |
reason => $self->reason, |
| 218 |
comments => $self->comments |
| 219 |
} |
| 220 |
)->store(); |
| 221 |
|
| 222 |
return $new_transfer; |
| 223 |
} |
| 224 |
|
| 179 |
=head3 type |
225 |
=head3 type |
| 180 |
|
226 |
|
| 181 |
=cut |
227 |
=cut |
| 182 |
- |
|
|