Bugzilla – Attachment 132213 Details for
Bug 28294
C4::Circulation::updateWrongTransfer should be moved into Koha::
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28294: Add Koha::Item::Transfer->remedy method and use in updateWrongTransfer
Bug-28294-Add-KohaItemTransfer-remedy-method-and-u.patch (text/plain), 3.27 KB, created by
Marcel de Rooy
on 2022-03-25 09:41:05 UTC
(
hide
)
Description:
Bug 28294: Add Koha::Item::Transfer->remedy method and use in updateWrongTransfer
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-03-25 09:41:05 UTC
Size:
3.27 KB
patch
obsolete
>From effa61eb9bad956e04735dea8d79f72a9861c177 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 17 May 2021 17:14:16 +0100 >Subject: [PATCH] Bug 28294: Add Koha::Item::Transfer->remedy method and use in > updateWrongTransfer >Content-Type: text/plain; charset=utf-8 > >This patch is an interim patch to prove that the new remedy method >achieves the same as updateWrongTransfer. > >Test plan >1/ Run t/db_dependant/Circulation.t before and after applying this >patch. > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > C4/Circulation.pm | 18 ++--------------- > Koha/Item/Transfer.pm | 46 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 48 insertions(+), 16 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index c6baf4892f..eb1a773cc8 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3652,22 +3652,8 @@ This function validate the line of brachtransfer but with the wrong destination > sub updateWrongTransfer { > my ( $itemNumber,$waitingAtLibrary,$FromLibrary ) = @_; > >- # 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' })->store(); >- >- # second step: create a new transfer to the right location >- my $new_transfer = $item->request_transfer( >- { >- to => $transfer->to_library, >- reason => $transfer->reason, >- comment => $transfer->comments, >- ignore_limits => 1, >- enqueue => 1 >- } >- ); >- >+ my $transfer = Koha::Items->find($itemNumber)->get_transfer; >+ my $new_transfer = $transfer->remedy(); > return $new_transfer; > } > >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index 286e0fd276..5c49e4fda1 100644 >--- a/Koha/Item/Transfer.pm >+++ b/Koha/Item/Transfer.pm >@@ -171,6 +171,52 @@ sub cancel { > return $self; > } > >+=head3 remedy >+ >+ my $new_transfer = $transfer->remedy( >+ { >+ to => $to_library, >+ reason => $reason, >+ [ ignore_limits => 0, force => 0 ] >+ } >+ ); >+ >+Used when a transfer has arrived at the wrong destination. Replaces this transfer by >+cancelling it with the 'WrongTransfer' reason and sets up a new transfer. >+ >+FIXME: remedy or rectify >+ >+=cut >+ >+sub remedy { >+ my ( $self, $params ) = @_; >+ >+ # FIXME: Should we remedy a transfer if it's just gone back to the originating branch, or just leave it in transit as is. >+ >+ # Cancel the existing wrong transfer >+ $self->set( >+ { >+ datecancelled => dt_from_string, >+ cancellation_reason => 'WrongTransfer' >+ } >+ )->store(); >+ >+ # Add a new transfer and immediately set to in transit (ignoring limits) >+ my $new_transfer = Koha::Item::Transfer->new( >+ { >+ itemnumber => $self->itemnumber, >+ daterequested => dt_from_string, >+ datesent => undef, >+ frombranch => $self->item->holdingbranch, >+ tobranch => $self->tobranch, >+ reason => $self->reason, >+ comments => $self->comments >+ } >+ )->store(); >+ >+ return $new_transfer; >+} >+ > =head3 type > > =cut >-- >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 28294
:
120637
|
121062
|
121063
|
121064
|
121077
|
121078
|
121079
|
121095
|
121096
|
121097
|
121714
|
121715
|
121716
|
130082
|
130083
|
130084
|
130085
|
130086
|
130087
|
132212
|
132213
|
132214
|
132215
|
132216
|
132217
|
160516
|
160517
|
160518
|
160519
|
160520
|
160521
|
160536
|
160692
|
168281
|
172778
|
172781
|
173856
|
174805