Bugzilla – Attachment 120625 Details for
Bug 24434
C4::Circulation::updateWrongTransfer is never called but should be
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24434: Reinstate updateWrongTransfer
Bug-24434-Reinstate-updateWrongTransfer.patch (text/plain), 7.51 KB, created by
Martin Renvoize
on 2021-05-06 13:01:16 UTC
(
hide
)
Description:
Bug 24434: Reinstate updateWrongTransfer
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2021-05-06 13:01:16 UTC
Size:
7.51 KB
patch
obsolete
>From db4fca24b8ae6bfc188175385adb54028d217f18 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 6 May 2021 13:53:51 +0100 >Subject: [PATCH] Bug 24434: Reinstate updateWrongTransfer > >This patch re-instates the call to updateWrongTransfer to ensure the >transfer line it updated to reflect the new frombranch. > >Test plan >1/ Check an item out from it's home library >2/ Check the item in at another library (with the return to home branch >system preferences enabled) >2a/ Accept the transfer and note we now have a transfer present from the >items check-in library to it's home library >3/ Check the item in at a third library >3a/ Note you are asked to return the item to it's home library. >3b/ With the patch applied, the modal title should highlight that a >'Wrong transfer' was detected. >4/ Go to the item record and note the holding library has been updated >to reflect where the item was most recently checked in. >4a/ With the patch applied the item status should reflect the last >checked in branch as the 'from' branch of the transfer. >--- > C4/Circulation.pm | 32 +++++++++++-------- > circ/returns.pl | 3 +- > .../prog/en/modules/circ/returns.tt | 17 ++++++++-- > 3 files changed, 36 insertions(+), 16 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 10db0d226a..79109cdd13 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2175,6 +2175,7 @@ sub AddReturn { > else { > $messages->{'WrongTransfer'} = $transfer->tobranch; > $messages->{'WrongTransferItem'} = $item->itemnumber; >+ $messages->{'TransferTrigger'} = $transfer->reason; > } > } > else { >@@ -3589,19 +3590,24 @@ This function validate the line of brachtransfer but with the wrong destination > > sub updateWrongTransfer { > my ( $itemNumber,$waitingAtLibrary,$FromLibrary ) = @_; >- my $dbh = C4::Context->dbh; >-# first step validate the actual line of transfert . >- my $sth = >- $dbh->prepare( >- "update branchtransfers set datearrived = now(),tobranch=?,comments='wrongtransfer' where itemnumber= ? AND datearrived IS NULL" >- ); >- $sth->execute($FromLibrary,$itemNumber); >- >-# second step create a new line of branchtransfer to the right location . >- ModItemTransfer($itemNumber, $FromLibrary, $waitingAtLibrary); >- >-#third step changing holdingbranch of item >- my $item = Koha::Items->find($itemNumber)->holdingbranch($FromLibrary)->store; >+ >+ # first step: cancel the original transfer >+ my $item = Koha::Items->find($itemNumber); >+ my $transfer = $item->get_transfer; >+ $transfer->set({ datecancelled => dt_from_string, cancellation_reason => 'WrongTransfer' }); >+ >+ # second step: create a new transfer to the right location >+ my $new_transfer = Koha::Item::Transfer->new( >+ { >+ itemnumber => $itemNumber, >+ daterequested => dt_from_string, >+ datesent => dt_from_string, >+ frombranch => $FromLibrary, >+ tobranch => $transfer->tobranch, >+ reason => $transfer->reason, >+ comments => $transfer->comments >+ } >+ )->store(); > } > > =head2 CalcDateDue >diff --git a/circ/returns.pl b/circ/returns.pl >index 94e4b5e287..86d78c7658 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -134,7 +134,7 @@ foreach ( $query->param ) { > # Deal with the requests.... > > if ($query->param('WT-itemNumber')){ >- updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From')); >+ updateWrongTransfer (scalar $query->param('WT-itemNumber'),scalar $query->param('WT-waitingAt'), scalar $query->param('WT-From')); > } > > my $itemnumber = $query->param('itemnumber'); >@@ -393,6 +393,7 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) { > WrongTransfer => 1, > TransferWaitingAt => $messages->{'WrongTransfer'}, > WrongTransferItem => $messages->{'WrongTransferItem'}, >+ trigger => $messages->{'TransferTrigger'}, > ); > > my $reserve = $messages->{'ResFound'}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 0fdb3fd6c6..a3348ac504 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -432,7 +432,7 @@ > <div class="modal-content"> > <div class="modal-header"> > <h3> >- Please return item to: [% Branches.GetName( TransferWaitingAt ) | html %] >+ Wrong transfer detected, please return item to: [% Branches.GetName( TransferWaitingAt ) | html %] > </h3> > </div> > <div class="modal-body"> >@@ -445,7 +445,20 @@ > </div> > <div class="modal-footer"> > <!-- CONFIRM --> >- <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button> >+ <form method="post" action="returns.pl" name="mainform"> >+ <button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> OK</button> >+ <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" /> >+ <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" /> >+ <input type="hidden" name="WT-itemNumber" value="[% WrongTransferItem | html %]" /> >+ <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt | html %]" /> >+ <input type="hidden" name="WT-From" value="[% wtransfertFrom | html %]" /> >+ [% FOREACH inputloo IN inputloop %] >+ <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> >+ <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> >+ <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> >+ [% END %] >+ </form> <!-- /mainform --> >+ > <!-- PRINT SLIP --> > <button type="button" data-dismiss="modal" class="btn btn-default openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&&branchcode=[% TransferWaitingAt | uri %]&op=slip"><i class="fa fa-print"></i> Print transfer slip</button> > <!-- CANCEL TRANSFER --> >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24434
:
97449
|
97550
|
99829
|
120625
|
120631
|
120632
|
120657
|
120658
|
120683
|
120684
|
120757
|
120758
|
121029
|
121030
|
121031
|
121032
|
121033
|
121034
|
121057
|
121058
|
121059
|
121060
|
121061
|
121071
|
121072
|
121073
|
121074
|
121075
|
121515
|
121702
|
121703
|
121704
|
121705
|
121706
|
121707
|
121798
|
121799
|
121800
|
121801
|
121802
|
121803
|
121804