Bugzilla – Attachment 89858 Details for
Bug 22877
Returning a lost item not marked as returned can generate additional overdue fines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22877: Unit test to highlight problem
Bug-22877-Unit-test-to-highlight-problem.patch (text/plain), 3.71 KB, created by
Liz Rea
on 2019-05-16 16:20:25 UTC
(
hide
)
Description:
Bug 22877: Unit test to highlight problem
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-05-16 16:20:25 UTC
Size:
3.71 KB
patch
obsolete
>From f33879aa85a00b3f32817b10abf22503900c9041 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 9 May 2019 12:32:38 +0000 >Subject: [PATCH] Bug 22877: Unit test to highlight problem > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > t/db_dependent/Circulation.t | 30 +++++++++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 0c12efb34e..6269ea9b69 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1980,7 +1980,7 @@ subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { > > > subtest 'AddReturn | is_overdue' => sub { >- plan tests => 5; >+ plan tests => 7; > > t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); > t::lib::Mocks::mock_preference('finesMode', 'production'); >@@ -1992,6 +1992,17 @@ subtest 'AddReturn | is_overdue' => sub { > t::lib::Mocks::mock_userenv({ patron => $manager, branchcode => $manager->branchcode }); > > my $biblioitem = $builder->build( { source => 'Biblioitem' } ); >+ my $item_type = $builder->build_object( >+ { class => 'Koha::ItemTypes', >+ value => { >+ notforloan => undef, >+ rentalcharge => 0, >+ defaultreplacecost => undef, >+ processfee => 0, >+ rentalcharge_daily => 0, >+ } >+ } >+ ); > my $item = $builder->build( > { > source => 'Item', >@@ -2002,6 +2013,8 @@ subtest 'AddReturn | is_overdue' => sub { > itemlost => 0, > withdrawn => 0, > biblionumber => $biblioitem->{biblionumber}, >+ replacementprice => 7, >+ itype => $item_type->itemtype > } > } > ); >@@ -2020,6 +2033,7 @@ subtest 'AddReturn | is_overdue' => sub { > ); > $rule->store(); > >+ my $now = dt_from_string; > my $one_day_ago = dt_from_string->subtract( days => 1 ); > my $five_days_ago = dt_from_string->subtract( days => 5 ); > my $ten_days_ago = dt_from_string->subtract( days => 10 ); >@@ -2054,6 +2068,20 @@ subtest 'AddReturn | is_overdue' => sub { > AddReturn( $item->{barcode}, $library->{branchcode}, $five_days_ago ); > is( int($patron->account->balance()), 0, 'AddReturn: pass return_date => no overdue in dropbox mode' ); # FIXME? This is weird, the OVERDUE fine is created ( _CalculateAndUpdateFine > C4::Overdues::UpdateFine ) then remove later (in _FixOverduesOnReturn). Looks like it is a feature > Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; >+ >+ # Checkout an item 10 days ago >+ my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $ten_days_ago ); # date due was 10d ago >+ # Fake fines cronjob on this checkout >+ my ( $fine ) = CalcFine( $item , $patron->categorycode, $library->{branchcode}, $ten_days_ago, $now ); >+ UpdateFine({ issue_id => $issue->issue_id, itemnumber => $item->{itemnumber}, borrowernumber => $patron->borrowernumber, amount => $fine, due => output_pref($ten_days_ago) }); >+ is( int($patron->account->balance()),10, "Overdue fine of 10 days overdue"); >+ # Fake longoverdue with charge and not marking returned >+ LostItem( $item->{itemnumber}, 'cronjob',0 ); >+ is( int($patron->account->balance()),17, "Lost fine of 7 plus 10 days overdue"); >+ # Now we return it today >+ AddReturn( $item->{barcode}, $library->{branchcode} ); >+ is( int($patron->account->balance()),17, "Should have a single 10 days overdue fine and lost charge"); >+ > }; > > subtest '_FixAccountForLostAndReturned' => sub { >-- >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 22877
:
89505
|
89507
|
89508
|
89509
|
89510
|
89511
|
89512
|
89513
|
89514
|
89516
|
89527
|
89818
|
89819
|
89820
|
89821
|
89858
|
89859
|
89860
|
89861
|
90210
|
90211
|
90212
|
90213