Bugzilla – Attachment 172331 Details for
Bug 17976
TT syntax for notices - Add an equivalence for items.fine
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17976: (QA follow-up) Tidy code
Bug-17976-QA-follow-up-Tidy-code.patch (text/plain), 7.75 KB, created by
Kyle M Hall (khall)
on 2024-10-02 18:36:07 UTC
(
hide
)
Description:
Bug 17976: (QA follow-up) Tidy code
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-10-02 18:36:07 UTC
Size:
7.75 KB
patch
obsolete
>From f738fe86bc7e723a96bfc3ad499a54c4ffc8b93a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 2 Oct 2024 18:34:25 +0000 >Subject: [PATCH] Bug 17976: (QA follow-up) Tidy code > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Checkout.pm | 59 +++++++++++++++++----------------- > t/db_dependent/Koha/Checkout.t | 32 +++++++++--------- > 2 files changed, 45 insertions(+), 46 deletions(-) > >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index c22917de57e..df025afcd6a 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -59,9 +59,9 @@ sub is_overdue { > $dt ||= dt_from_string(); > > my $is_overdue = >- DateTime->compare( dt_from_string( $self->date_due, 'sql' ), $dt ) == -1 >- ? 1 >- : 0; >+ DateTime->compare( dt_from_string( $self->date_due, 'sql' ), $dt ) == -1 >+ ? 1 >+ : 0; > return $is_overdue; > } > >@@ -74,9 +74,9 @@ Return the checked out item > =cut > > sub item { >- my ( $self ) = @_; >+ my ($self) = @_; > my $item_rs = $self->_result->item; >- return Koha::Item->_new_from_dbic( $item_rs ); >+ return Koha::Item->_new_from_dbic($item_rs); > } > > =head3 account_lines >@@ -88,9 +88,9 @@ Return the checked out account_lines > =cut > > sub account_lines { >- my ( $self ) = @_; >+ my ($self) = @_; > my $account_lines_rs = $self->_result->account_lines; >- return Koha::Account::Lines->_new_from_dbic( $account_lines_rs ); >+ return Koha::Account::Lines->_new_from_dbic($account_lines_rs); > } > > =head3 overdue_fines >@@ -102,9 +102,9 @@ Return the account lines for just the overdue fines > =cut > > sub overdue_fines { >- my ( $self ) = @_; >+ my ($self) = @_; > my $account_lines_rs = $self->_result->account_lines->search( { debit_type_code => 'OVERDUE' } ); >- return Koha::Account::Lines->_new_from_dbic( $account_lines_rs ); >+ return Koha::Account::Lines->_new_from_dbic($account_lines_rs); > } > > =head3 library >@@ -116,9 +116,9 @@ Return the library in which the transaction took place > =cut > > sub library { >- my ( $self ) = @_; >+ my ($self) = @_; > my $library_rs = $self->_result->library; >- return Koha::Library->_new_from_dbic( $library_rs ); >+ return Koha::Library->_new_from_dbic($library_rs); > } > > =head3 patron >@@ -130,9 +130,9 @@ Return the patron for who the checkout has been done > =cut > > sub patron { >- my ( $self ) = @_; >+ my ($self) = @_; > my $patron_rs = $self->_result->patron; >- return Koha::Patron->_new_from_dbic( $patron_rs ); >+ return Koha::Patron->_new_from_dbic($patron_rs); > } > > =head3 issuer >@@ -144,10 +144,10 @@ Return the patron by whom the checkout was done > =cut > > sub issuer { >- my ( $self ) = @_; >+ my ($self) = @_; > my $issuer_rs = $self->_result->issuer; > return unless $issuer_rs; >- return Koha::Patron->_new_from_dbic( $issuer_rs ); >+ return Koha::Patron->_new_from_dbic($issuer_rs); > } > > =head3 renewals >@@ -159,10 +159,10 @@ Return a Koha::Checkouts::Renewals set attached to this checkout > =cut > > sub renewals { >- my ( $self ) = @_; >+ my ($self) = @_; > my $renewals_rs = $self->_result->renewals; > return unless $renewals_rs; >- return Koha::Checkouts::Renewals->_new_from_dbic( $renewals_rs ); >+ return Koha::Checkouts::Renewals->_new_from_dbic($renewals_rs); > } > > =head3 attempt_auto_renew >@@ -276,28 +276,29 @@ sub claim_returned { > > my $ClaimReturnedChargeFee = C4::Context->preference('ClaimReturnedChargeFee'); > $charge_lost_fee = >- $ClaimReturnedChargeFee eq 'charge' ? 1 >- : $ClaimReturnedChargeFee eq 'no_charge' ? 0 >- : $charge_lost_fee; # $ClaimReturnedChargeFee eq 'ask' >+ $ClaimReturnedChargeFee eq 'charge' ? 1 >+ : $ClaimReturnedChargeFee eq 'no_charge' ? 0 >+ : $charge_lost_fee; # $ClaimReturnedChargeFee eq 'ask' > >- if ( $charge_lost_fee ) { >+ if ($charge_lost_fee) { > C4::Circulation::LostItem( $self->itemnumber, 'claim_returned' ); >- } >- elsif ( C4::Context->preference( 'MarkLostItemsAsReturned' ) =~ m/claim_returned/ ) { >- C4::Circulation::MarkIssueReturned( $self->borrowernumber, $self->itemnumber, undef, $self->patron->privacy ); >+ } elsif ( C4::Context->preference('MarkLostItemsAsReturned') =~ m/claim_returned/ ) { >+ C4::Circulation::MarkIssueReturned( >+ $self->borrowernumber, $self->itemnumber, undef, >+ $self->patron->privacy >+ ); > } > > return $claim; > } > ); >- } >- catch { >+ } catch { > if ( $_->isa('Koha::Exception') ) { > $_->rethrow(); >- } >- else { >+ } else { >+ > # ? >- Koha::Exception->throw( "Unhandled exception" ); >+ Koha::Exception->throw("Unhandled exception"); > } > }; > } >diff --git a/t/db_dependent/Koha/Checkout.t b/t/db_dependent/Koha/Checkout.t >index 5effd76a692..a3883fdd90d 100755 >--- a/t/db_dependent/Koha/Checkout.t >+++ b/t/db_dependent/Koha/Checkout.t >@@ -67,13 +67,17 @@ subtest 'overdue_fines' => sub { > )->store(); > > my $overdue_fines = $checkout->overdue_fines; >- is( ref($overdue_fines), 'Koha::Account::Lines', >- 'Koha::Checkout->overdue_fines should return a Koha::Account::Lines' ); >- is( $overdue_fines->count, 1, "Koha::Checkout->overdue_fines returns only overdue fines"); >+ is( >+ ref($overdue_fines), 'Koha::Account::Lines', >+ 'Koha::Checkout->overdue_fines should return a Koha::Account::Lines' >+ ); >+ is( $overdue_fines->count, 1, "Koha::Checkout->overdue_fines returns only overdue fines" ); > > my $overdue = $overdue_fines->next; >- is( ref($overdue), 'Koha::Account::Line', >- 'next returns a Koha::Account::Line' ); >+ is( >+ ref($overdue), 'Koha::Account::Line', >+ 'next returns a Koha::Account::Line' >+ ); > > is( > $overdueline->id, >@@ -88,17 +92,15 @@ subtest 'library() tests' => sub { > > $schema->storage->txn_begin; > >- my $library = $builder->build_object({ class => 'Koha::Libraries' }); >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); > my $checkout = $builder->build_object( > { > class => 'Koha::Checkouts', >- value => { >- branchcode => $library->branchcode >- } >+ value => { branchcode => $library->branchcode } > } > ); > >- is( ref($checkout->library), 'Koha::Library', 'Object type is correct' ); >+ is( ref( $checkout->library ), 'Koha::Library', 'Object type is correct' ); > is( $checkout->library->branchcode, $library->branchcode, 'Right library linked' ); > > $schema->storage->txn_rollback; >@@ -109,11 +111,7 @@ subtest 'renewals() tests' => sub { > plan tests => 2; > $schema->storage->txn_begin; > >- my $checkout = $builder->build_object( >- { >- class => 'Koha::Checkouts' >- } >- ); >+ my $checkout = $builder->build_object( { class => 'Koha::Checkouts' } ); > my $renewal1 = $builder->build_object( > { > class => 'Koha::Checkouts::Renewals', >@@ -127,8 +125,8 @@ subtest 'renewals() tests' => sub { > } > ); > >- is( ref($checkout->renewals), 'Koha::Checkouts::Renewals', 'Object set type is correct' ); >- is( $checkout->renewals->count, 2, "Count of renewals is correct" ); >+ is( ref( $checkout->renewals ), 'Koha::Checkouts::Renewals', 'Object set type is correct' ); >+ is( $checkout->renewals->count, 2, "Count of renewals is correct" ); > > $schema->storage->txn_rollback; > }; >-- >2.39.5 (Apple Git-154)
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 17976
:
172277
|
172278
|
172283
|
172304
|
172305
|
172306
|
172328
|
172329
|
172330
| 172331 |
174324