Bugzilla – Attachment 83618 Details for
Bug 19489
Detailed description of charges on Accounting tab
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19489: Add the Koha::Account::Line->issue method
Bug-19489-Add-the-KohaAccountLine-issue-method.patch (text/plain), 3.03 KB, created by
Nick Clemens (kidclamp)
on 2019-01-03 14:32:36 UTC
(
hide
)
Description:
Bug 19489: Add the Koha::Account::Line->issue method
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-01-03 14:32:36 UTC
Size:
3.03 KB
patch
obsolete
>From 2c14e237919d798d77399e65d649bddd535c4e57 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Nazl=C4=B1=20=C3=87etin?= <nazli@devinim.com.tr> >Date: Fri, 23 Nov 2018 11:56:45 +0000 >Subject: [PATCH] Bug 19489: Add the Koha::Account::Line->issue method > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Account/Line.pm | 16 +++++++++++++++ > t/db_dependent/Koha/Account/Lines.t | 41 ++++++++++++++++++++++++++++++++++++- > 2 files changed, 56 insertions(+), 1 deletion(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 9a538476f9..aeaceb972d 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -52,6 +52,22 @@ sub item { > return Koha::Item->_new_from_dbic( $rs ); > } > >+=head3 issue >+ >+Return the issue linked to this account line if exists >+ >+=cut >+ >+sub issue { >+ my ( $self ) = @_; >+ >+ return unless $self->issue_id ; >+ >+ my $issue = Koha::Checkouts->find( $self->issue_id ); >+ $issue = Koha::Old::Checkouts->find( $self->issue_id ) unless $issue; >+ return $issue; >+} >+ > =head3 void > > $payment_accountline->void(); >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index c294dbedd2..6a96dc2130 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/t/db_dependent/Koha/Account/Lines.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > use Test::Exception; > > use Koha::Account; >@@ -298,3 +298,42 @@ subtest 'Keep account info when a patron is deleted' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'issue() tests' => sub { >+ >+ plan tests => 5; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build( { source => 'Branch' } ); >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ my $item = $builder->build( { source => 'Item' } ); >+ >+ my $checkout = Koha::Checkout->new( >+ { borrowernumber => $patron->{borrowernumber}, >+ itemnumber => $item->{itemnumber}, >+ branchcode => $library->{branchcode}, >+ })->store; >+ >+ my $line = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->{borrowernumber}, >+ itemnumber => $item->{itemnumber}, >+ issue_id => $checkout->issue_id, >+ accounttype => "F", >+ amount => 10, >+ })->store; >+ >+ my $line_issue = $line->issue; >+ is( ref($line_issue), 'Koha::Checkout', 'Result type is correct' ); >+ is( $line_issue->issue_id, $checkout->issue_id, 'Koha::Account::Line->issue should return the correct issue'); >+ >+ my ( $returned, undef, $old_checkout) = C4::Circulation::AddReturn( $item->{barcode} ,$library->{branchcode} ); >+ is( $returned, 1, 'The item should have been returned' ); >+ >+ my $old_line_issue = $line->issue; >+ is( ref($old_line_issue), 'Koha::Old::Checkout', 'Result type is correct' ); >+ is( $old_line_issue->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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 19489
:
81956
|
81989
|
81991
|
82519
|
82520
|
82614
|
82615
|
82846
|
83109
|
83110
|
83242
|
83276
|
83277
|
83299
|
83300
|
83301
|
83618
|
83619
|
83620
|
85236
|
85237
|
85275
|
85315
|
85668
|
85669
|
85670
|
85671
|
85672
|
85673
|
85674
|
85675
|
85731
|
85732
|
85733
|
85734
|
85735
|
85736
|
85737
|
85738