Bugzilla – Attachment 118821 Details for
Bug 12362
Branch transfer records orphaned on cancelled holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12362: Cancel transfer with hold cancelation
Bug-12362-Cancel-transfer-with-hold-cancelation.patch (text/plain), 3.70 KB, created by
Peter Vashchuk
on 2021-03-25 15:09:45 UTC
(
hide
)
Description:
Bug 12362: Cancel transfer with hold cancelation
Filename:
MIME Type:
Creator:
Peter Vashchuk
Created:
2021-03-25 15:09:45 UTC
Size:
3.70 KB
patch
obsolete
>From 1bfe93e323c83c3cc0e995e64f4f14f162dc6aab Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 22 Mar 2021 14:57:06 +0000 >Subject: [PATCH] Bug 12362: Cancel transfer with hold cancelation > >This patch adds a transfer cancellation when a hold is cancelled. > >Test plan >1/ Check an item out from it's homebranch >2/ Place a hold on that item for another user at a different branch >3/ Check the item in at it's homebranch and accept the transfer >4/ Cancel the hold >5/ Change to the second branch and check the item in >6/ Note that a transfer is triggered with the reason 'Transfer was >cancelled whilst in transit' > >Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com> >--- > Koha/Hold.pm | 7 ++++++ > Koha/Item/Transfer.pm | 24 +++++++++++++++---- > .../prog/en/modules/circ/returns.tt | 2 ++ > 3 files changed, 29 insertions(+), 4 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 892fb20cd5..6f2580d725 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -497,8 +497,15 @@ Cancel a hold: > > sub cancel { > my ( $self, $params ) = @_; >+ > $self->_result->result_source->schema->txn_do( > sub { >+ if ( $self->is_in_transit ) { >+ my $transfer = $self->item->get_transfer; >+ if ( $transfer->in_transit ) { >+ $transfer->cancel({ reason => 'CancelReserve', force => 1 }); >+ } >+ } > $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) ); > $self->priority(0); > $self->cancellation_reason( $params->{cancellation_reason} ); >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index aded4e23a5..4112b3fab9 100644 >--- a/Koha/Item/Transfer.pm >+++ b/Koha/Item/Transfer.pm >@@ -52,6 +52,20 @@ sub item { > return Koha::Item->_new_from_dbic($item_rs); > } > >+=head3 from_library >+ >+ my $from_library = $transfer->from_library; >+ >+Returns the associated from_library for this transfer. >+ >+=cut >+ >+sub from_library { >+ my ($self) = @_; >+ my $from_library_rs = $self->_result->frombranch; >+ return Koha::Library->_new_from_dbic($from_library_rs); >+} >+ > =head3 transit > > Set the transfer as in transit by updating the datesent time. >@@ -147,10 +161,12 @@ sub cancel { > # Set up return transfer if transfer was force cancelled whilst in transit > # NOTE: We don't catch here, as we're happy to fail if there are already > # other transfers in the queue. >- try { >- $self->item->request_transfer( >- { to => $self->frombranch, reason => 'TransferCancellation' } ); >- }; >+ if ($in_transit) { >+ try { >+ $self->item->request_transfer( >+ { to => $self->from_library, reason => 'TransferCancellation' } ); >+ }; >+ } > > return $self; > } >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 5f08a81308..e9bc85e61c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -120,6 +120,8 @@ > [%- CASE 'Reserve' -%]Reserve > [%- CASE 'LostReserve' -%]Lost reserve > [%- CASE 'CancelReserve' -%]Cancelled reserve >+ [%- CASE 'TransferCancellation' -%]Transfer was cancelled whilst in transit >+ [%- CASE -%][% trigger | html %] > [%- END -%] > </p> > </div> >-- >2.28.0
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 12362
:
118607
|
118608
|
118609
|
118611
|
118819
|
118820
|
118821
|
119762
|
119763
|
119764
|
119898
|
119899
|
119900
|
119901
|
119902