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