Bugzilla – Attachment 117611 Details for
Bug 26618
C4/RotatingCollections.pm should not use C4::Circulation::transferbook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26618: Improve Exception Class Names
Bug-26618-Improve-Exception-Class-Names.patch (text/plain), 7.33 KB, created by
Jonathan Druart
on 2021-03-03 14:33:30 UTC
(
hide
)
Description:
Bug 26618: Improve Exception Class Names
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-03-03 14:33:30 UTC
Size:
7.33 KB
patch
obsolete
>From 1866e8bdaee8ce87ca0c97b7082340870ac23985 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 18 Feb 2021 10:48:41 +0000 >Subject: [PATCH] Bug 26618: Improve Exception Class Names > >--- > C4/RotatingCollections.pm | 2 +- > Koha/Exceptions/Item/Transfer.pm | 12 ++++++------ > Koha/Item.pm | 2 +- > Koha/Item/Transfer.pm | 6 +++--- > Koha/StockRotationItem.pm | 2 +- > t/db_dependent/Koha/Item.t | 2 +- > t/db_dependent/Koha/Item/Transfer.t | 6 +++--- > 7 files changed, 16 insertions(+), 16 deletions(-) > >diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm >index b7a7bb3a74..5ee1982123 100644 >--- a/C4/RotatingCollections.pm >+++ b/C4/RotatingCollections.pm >@@ -457,7 +457,7 @@ sub TransferCollection { > ); # Request transfer > } > catch { >- if ( $_->isa('Koha::Exceptions::Item::Transfer::Found') ) { >+ if ( $_->isa('Koha::Exceptions::Item::Transfer::InQueue') ) { > my $exception = $_; > my $found_transfer = $_->transfer; > if ( $found_transfer->in_transit >diff --git a/Koha/Exceptions/Item/Transfer.pm b/Koha/Exceptions/Item/Transfer.pm >index 28429d9e01..a836714dbc 100644 >--- a/Koha/Exceptions/Item/Transfer.pm >+++ b/Koha/Exceptions/Item/Transfer.pm >@@ -22,7 +22,7 @@ use Exception::Class ( > 'Koha::Exceptions::Item::Transfer' => { > description => 'Something went wrong' > }, >- 'Koha::Exceptions::Item::Transfer::Found' => { >+ 'Koha::Exceptions::Item::Transfer::InQueue' => { > isa => 'Koha::Exceptions::Item::Transfer', > description => "Active item transfer already exists", > fields => ['transfer'] >@@ -31,11 +31,11 @@ use Exception::Class ( > isa => 'Koha::Exceptions::Item::Transfer', > description => "Transfer not allowed" > }, >- 'Koha::Exceptions::Item::Transfer::Out' => { >+ 'Koha::Exceptions::Item::Transfer::OnLoan' => { > isa => 'Koha::Exceptions::Item::Transfer', > description => "Transfer item is currently checked out" > }, >- 'Koha::Exceptions::Item::Transfer::Transit' => { >+ 'Koha::Exceptions::Item::Transfer::InTransit' => { > isa => 'Koha::Exceptions::Item::Transfer', > description => "Transfer item is currently in transit" > } >@@ -51,7 +51,7 @@ Koha::Exceptions::Item::Transfer - Base class for Transfer exceptions > > Generic Item::Transfer exception > >-=head2 Koha::Exceptions::Item::Transfer::Found >+=head2 Koha::Exceptions::Item::Transfer::InQueue > > Exception to be used when an active item transfer prevents a transfer action. > >@@ -59,11 +59,11 @@ Exception to be used when an active item transfer prevents a transfer action. > > Exception to be used when transfer limits prevent a transfer action. > >-=head2 Koha::Exceptions::Item::Transfer::Out >+=head2 Koha::Exceptions::Item::Transfer::OnLoan > > Exception to be used when an active checkout prevents a transfer action. > >-=head2 Koha::Exceptions::Item::Transfer::Transit >+=head2 Koha::Exceptions::Item::Transfer::InTransit > > Exception to be used when an in transit transfer prevents a transfer action. > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 0794974b1a..7bbc87b95b 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -444,7 +444,7 @@ sub request_transfer { > || $self->can_be_transferred( { to => $params->{to} } ) ); > > my $request = $self->get_transfer; >- Koha::Exceptions::Item::Transfer::Found->throw( transfer => $request ) >+ Koha::Exceptions::Item::Transfer::InQueue->throw( transfer => $request ) > if ( $request && !$params->{enqueue} && !$params->{replace} ); > > $request->cancel( { reason => $params->{reason}, force => 1 } ) >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index c9e3206b53..8f4284f53a 100644 >--- a/Koha/Item/Transfer.pm >+++ b/Koha/Item/Transfer.pm >@@ -63,7 +63,7 @@ sub transit { > my ($self) = @_; > > # Throw exception if item is still checked out >- Koha::Exceptions::Item::Transfer::Out->throw() if ( $self->item->checkout ); >+ Koha::Exceptions::Item::Transfer::OnLoan->throw() if ( $self->item->checkout ); > > # Remove the 'shelving cart' location status if it is being used (Bug 3701) > CartToShelf( $self->item->itemnumber ) >@@ -107,7 +107,7 @@ sub receive { > my ($self) = @_; > > # Throw exception if item is checked out >- Koha::Exceptions::Item::Transfer::Out->throw() if ($self->item->checkout); >+ Koha::Exceptions::Item::Transfer::OnLoan->throw() if ($self->item->checkout); > > # Update the arrived date > $self->set({ datearrived => dt_from_string })->store; >@@ -132,7 +132,7 @@ sub cancel { > unless defined($params->{reason}); > > # Throw exception if item is in transit already >- Koha::Exceptions::Item::Transfer::Transit->throw() if ( !$params->{force} && $self->in_transit ); >+ Koha::Exceptions::Item::Transfer::InTransit->throw() if ( !$params->{force} && $self->in_transit ); > > # Update the cancelled date > $self->set( >diff --git a/Koha/StockRotationItem.pm b/Koha/StockRotationItem.pm >index 6c6d99cd43..d2e91e828b 100644 >--- a/Koha/StockRotationItem.pm >+++ b/Koha/StockRotationItem.pm >@@ -242,7 +242,7 @@ sub advance { > ); # Add transfer > } > catch { >- if ( $_->isa('Koha::Exceptions::Item::Transfer::Found') ) { >+ if ( $_->isa('Koha::Exceptions::Item::Transfer::InQueue') ) { > my $exception = $_; > my $found_transfer = $_->transfer; > if ( $found_transfer->in_transit >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 8858e071fa..06a9a6ef52 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -483,7 +483,7 @@ subtest 'request_transfer' => sub { > > # Transfer already in progress > throws_ok { $item->request_transfer( { to => $library2, reason => 'Manual' } ) } >- 'Koha::Exceptions::Item::Transfer::Found', >+ 'Koha::Exceptions::Item::Transfer::InQueue', > 'Exception thrown if transfer is already in progress'; > > my $exception = $@; >diff --git a/t/db_dependent/Koha/Item/Transfer.t b/t/db_dependent/Koha/Item/Transfer.t >index ac782e28fb..c2bdd2cb7d 100755 >--- a/t/db_dependent/Koha/Item/Transfer.t >+++ b/t/db_dependent/Koha/Item/Transfer.t >@@ -92,7 +92,7 @@ subtest 'transit tests' => sub { > is( ref($checkout), 'Koha::Checkout', 'Mock checkout added' ); > > throws_ok { $transfer->transit() } >- 'Koha::Exceptions::Item::Transfer::Out', >+ 'Koha::Exceptions::Item::Transfer::OnLoan', > 'Exception thrown if item is checked out'; > > $checkout->delete; >@@ -155,7 +155,7 @@ subtest 'receive tests' => sub { > is( ref($checkout), 'Koha::Checkout', 'Mock checkout added' ); > > throws_ok { $transfer->receive() } >- 'Koha::Exceptions::Item::Transfer::Out', >+ 'Koha::Exceptions::Item::Transfer::OnLoan', > 'Exception thrown if item is checked out'; > > $checkout->delete; >@@ -246,7 +246,7 @@ subtest 'cancel tests' => sub { > > # Item in transit should result in failure > throws_ok { $transfer->cancel({ reason => $cancellation_reason }) } >- 'Koha::Exceptions::Item::Transfer::Transit', >+ 'Koha::Exceptions::Item::Transfer::InTransit', > 'Exception thrown if item is in transit'; > > $transfer->cancel({ reason => $cancellation_reason, force => 1}); >-- >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 26618
:
111305
|
111313
|
116571
|
117608
|
117609
|
117610
| 117611