View | Details | Raw Unified | Return to bug 24434
Collapse All | Expand All

(-)a/C4/Circulation.pm (-13 / +19 lines)
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
(-)a/circ/returns.pl (-1 / +2 lines)
Lines 134-140 foreach ( $query->param ) { Link Here
134
# Deal with the requests....
134
# Deal with the requests....
135
135
136
if ($query->param('WT-itemNumber')){
136
if ($query->param('WT-itemNumber')){
137
	updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From'));
137
	updateWrongTransfer (scalar $query->param('WT-itemNumber'),scalar $query->param('WT-waitingAt'), scalar $query->param('WT-From'));
138
}
138
}
139
139
140
my $itemnumber = $query->param('itemnumber');
140
my $itemnumber = $query->param('itemnumber');
Lines 393-398 if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) { Link Here
393
        WrongTransfer  => 1,
393
        WrongTransfer  => 1,
394
        TransferWaitingAt => $messages->{'WrongTransfer'},
394
        TransferWaitingAt => $messages->{'WrongTransfer'},
395
        WrongTransferItem => $messages->{'WrongTransferItem'},
395
        WrongTransferItem => $messages->{'WrongTransferItem'},
396
        trigger           => $messages->{'TransferTrigger'},
396
    );
397
    );
397
398
398
    my $reserve    = $messages->{'ResFound'};
399
    my $reserve    = $messages->{'ResFound'};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-3 / +15 lines)
Lines 432-438 Link Here
432
                                        <div class="modal-content">
432
                                        <div class="modal-content">
433
                                            <div class="modal-header">
433
                                            <div class="modal-header">
434
                                                <h3>
434
                                                <h3>
435
                                                    Please return item to: [% Branches.GetName( TransferWaitingAt ) | html %]
435
                                                    Wrong transfer detected, please return item to: [% Branches.GetName( TransferWaitingAt ) | html %]
436
                                                </h3>
436
                                                </h3>
437
                                            </div>
437
                                            </div>
438
                                            <div class="modal-body">
438
                                            <div class="modal-body">
Lines 445-451 Link Here
445
                                            </div>
445
                                            </div>
446
                                            <div class="modal-footer">
446
                                            <div class="modal-footer">
447
                                                <!-- CONFIRM -->
447
                                                <!-- CONFIRM -->
448
                                                <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
448
                                                <form method="post" action="returns.pl" name="mainform">
449
                                                    <button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> OK</button>
450
                                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
451
                                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
452
                                                    <input type="hidden" name="WT-itemNumber" value="[% WrongTransferItem | html %]" />
453
                                                    <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt | html %]" />
454
                                                    <input type="hidden" name="WT-From" value="[% wtransfertFrom | html %]" />
455
                                                    [% FOREACH inputloo IN inputloop %]
456
                                                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
457
                                                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
458
                                                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
459
                                                    [% END %]
460
                                                </form> <!-- /mainform -->
461
449
                                                <!-- PRINT SLIP -->
462
                                                <!-- PRINT SLIP -->
450
                                                <button type="button" data-dismiss="modal" class="btn btn-default openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&amp;&amp;branchcode=[% TransferWaitingAt | uri %]&amp;op=slip"><i class="fa fa-print"></i> Print transfer slip</button>
463
                                                <button type="button" data-dismiss="modal" class="btn btn-default openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&amp;&amp;branchcode=[% TransferWaitingAt | uri %]&amp;op=slip"><i class="fa fa-print"></i> Print transfer slip</button>
451
                                                <!-- CANCEL TRANSFER -->
464
                                                <!-- CANCEL TRANSFER -->
452
- 

Return to bug 24434