Lines 2175-2180
sub AddReturn {
Link Here
|
2175 |
else { |
2175 |
else { |
2176 |
$messages->{'WrongTransfer'} = $transfer->tobranch; |
2176 |
$messages->{'WrongTransfer'} = $transfer->tobranch; |
2177 |
$messages->{'WrongTransferItem'} = $item->itemnumber; |
2177 |
$messages->{'WrongTransferItem'} = $item->itemnumber; |
|
|
2178 |
$messages->{'TransferTrigger'} = $transfer->reason; |
2178 |
} |
2179 |
} |
2179 |
} |
2180 |
} |
2180 |
else { |
2181 |
else { |
Lines 3589-3607
This function validate the line of brachtransfer but with the wrong destination
Link Here
|
3589 |
|
3590 |
|
3590 |
sub updateWrongTransfer { |
3591 |
sub updateWrongTransfer { |
3591 |
my ( $itemNumber,$waitingAtLibrary,$FromLibrary ) = @_; |
3592 |
my ( $itemNumber,$waitingAtLibrary,$FromLibrary ) = @_; |
3592 |
my $dbh = C4::Context->dbh; |
3593 |
|
3593 |
# first step validate the actual line of transfert . |
3594 |
# first step: cancel the original transfer |
3594 |
my $sth = |
3595 |
my $item = Koha::Items->find($itemNumber); |
3595 |
$dbh->prepare( |
3596 |
my $transfer = $item->get_transfer; |
3596 |
"update branchtransfers set datearrived = now(),tobranch=?,comments='wrongtransfer' where itemnumber= ? AND datearrived IS NULL" |
3597 |
$transfer->set({ datecancelled => dt_from_string, cancellation_reason => 'WrongTransfer' }); |
3597 |
); |
3598 |
|
3598 |
$sth->execute($FromLibrary,$itemNumber); |
3599 |
# second step: create a new transfer to the right location |
3599 |
|
3600 |
my $new_transfer = Koha::Item::Transfer->new( |
3600 |
# second step create a new line of branchtransfer to the right location . |
3601 |
{ |
3601 |
ModItemTransfer($itemNumber, $FromLibrary, $waitingAtLibrary); |
3602 |
itemnumber => $itemNumber, |
3602 |
|
3603 |
daterequested => dt_from_string, |
3603 |
#third step changing holdingbranch of item |
3604 |
datesent => dt_from_string, |
3604 |
my $item = Koha::Items->find($itemNumber)->holdingbranch($FromLibrary)->store; |
3605 |
frombranch => $FromLibrary, |
|
|
3606 |
tobranch => $transfer->tobranch, |
3607 |
reason => $transfer->reason, |
3608 |
comments => $transfer->comments |
3609 |
} |
3610 |
)->store(); |
3605 |
} |
3611 |
} |
3606 |
|
3612 |
|
3607 |
=head2 CalcDateDue |
3613 |
=head2 CalcDateDue |