Bugzilla – Attachment 121741 Details for
Bug 28527
Transfers that are cancelled whilst in transit should still appear as 'in transit' until they are received
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28527: Deal with cancelled in transfer transfers when enqueueing
Bug-28527-Deal-with-cancelled-in-transfer-transfer.patch (text/plain), 2.55 KB, created by
Martin Renvoize (ashimema)
on 2021-06-09 13:33:43 UTC
(
hide
)
Description:
Bug 28527: Deal with cancelled in transfer transfers when enqueueing
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-06-09 13:33:43 UTC
Size:
2.55 KB
patch
obsolete
>From f4316b8ce450e999769c6a395cdd9beaff5ff740 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 9 Jun 2021 11:30:18 +0100 >Subject: [PATCH] Bug 28527: Deal with cancelled in transfer transfers when > enqueueing > >Addeding to the queue should be allowed when the active transfer >(in_transit) has been cancelled. >--- > Koha/Item.pm | 21 +++++++++++++++++---- > Koha/Item/Transfer.pm | 12 ++++++++++++ > 2 files changed, 29 insertions(+), 4 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index bd0ddd5f9a..d72c2065fb 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -452,13 +452,20 @@ sub request_transfer { > unless ( $params->{ignore_limits} > || $self->can_be_transferred( { to => $params->{to} } ) ); > >- my $request = $self->get_transfer; >+ # check for active, uncancelled transfers >+ my $requests = $self->get_transfers; >+ my $request = $requests->next; >+ while ( $request && $request->is_cancelled ) { >+ $request = $requests->next; >+ } > Koha::Exceptions::Item::Transfer::InQueue->throw( transfer => $request ) > if ( $request && !$params->{enqueue} && !$params->{replace} ); > >+ # cancel next transfer in the queue if we're replacing it > $request->cancel( { reason => $params->{reason}, force => 1 } ) >- if ( defined($request) && $params->{replace} ); >+ if ( $request && $params->{replace} ); > >+ # add transfer to the queue > my $transfer = Koha::Item::Transfer->new( > { > itemnumber => $self->itemnumber, >@@ -493,8 +500,14 @@ sub get_transfer { > my ($self) = @_; > my $transfer_rs = $self->_result->branchtransfers->search( > { >- datearrived => undef, >- datecancelled => undef >+ datearrived => undef, >+ [ >+ { datesent => undef, datecancelled => { '!=' => undef } }, >+ { >+ datesent => { '!=' => undef }, >+ datecancelled => { '!=' => undef } >+ } >+ ] > }, > { > order_by => >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index 32cbec7bfa..1c538b8d50 100644 >--- a/Koha/Item/Transfer.pm >+++ b/Koha/Item/Transfer.pm >@@ -126,6 +126,18 @@ sub in_transit { > && !defined( $self->datearrived ) ); > } > >+=head3 is_cancelled >+ >+Boolean returning whether the transfer was cancelled or not >+ >+=cut >+ >+sub is_cancelled { >+ my ($self) = @_; >+ >+ return defined($self->datecancelled); >+} >+ > =head3 receive > > Receive the transfer by setting the datearrived time. >-- >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 28527
:
121739
|
121740
| 121741 |
121742