Bugzilla – Attachment 84458 Details for
Bug 21478
Koha::Hold->suspend_hold allows suspending in transit holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21478: Make Koha::Hold->suspend reject found holds
Bug-21478-Make-KohaHold-suspend-reject-found-holds.patch (text/plain), 1.92 KB, created by
Katrin Fischer
on 2019-01-27 10:45:24 UTC
(
hide
)
Description:
Bug 21478: Make Koha::Hold->suspend reject found holds
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-01-27 10:45:24 UTC
Size:
1.92 KB
patch
obsolete
>From 657419fb5c37be31fd161606223c6bf5849e9df4 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 25 Jan 2019 13:49:37 -0300 >Subject: [PATCH] Bug 21478: Make Koha::Hold->suspend reject found holds > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Hold.pm | 24 +++++++++++++++++++----- > 1 file changed, 19 insertions(+), 5 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 23d5d447a5..a1ef5aafa5 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -34,6 +34,8 @@ use Koha::Libraries; > use Koha::Old::Holds; > use Koha::Calendar; > >+use Koha::Exceptions::Hold; >+ > use base qw(Koha::Object); > > =head1 NAME >@@ -85,16 +87,28 @@ sub suspend_hold { > > my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; > >- if ( $self->is_waiting ) { # We can't suspend waiting holds >- carp "Unable to suspend waiting hold!"; >- return $self; >+ if ( $self->is_found ) { # We can't suspend found holds >+ if ( $self->is_waiting ) { >+ Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'W' ); >+ } >+ elsif ( $self->is_in_transit ) { >+ Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'T' ); >+ } >+ else { >+ Koha::Exceptions::Hold::CannotSuspendFound->throw( >+ 'Unhandled data exception on found hold (id=' >+ . $self->id >+ . ', found=' >+ . $self->found >+ . ')' ); >+ } > } > > $self->suspend(1); >- $self->suspend_until( $date ); >+ $self->suspend_until($date); > $self->store(); > >- logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper($self->unblessed) ) >+ logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper( $self->unblessed ) ) > if C4::Context->preference('HoldsLog'); > > return $self; >-- >2.11.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 21478
:
84409
|
84410
|
84411
|
84432
|
84433
|
84434
|
84456
|
84457
| 84458 |
84487