Bugzilla – Attachment 20487 Details for
Bug 7639
system preference to forgive fines on lost items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 7639 - system preference to forgive fines on lost items - Add Unit Tests
PASSED-QA-Bug-7639---system-preference-to-forgive-.patch (text/plain), 4.87 KB, created by
Katrin Fischer
on 2013-08-19 20:23:57 UTC
(
hide
)
Description:
[PASSED QA] Bug 7639 - system preference to forgive fines on lost items - Add Unit Tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-08-19 20:23:57 UTC
Size:
4.87 KB
patch
obsolete
>From 4973ac57af8a3d8837ac1072d1db4013b72e56b3 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 19 Aug 2013 08:01:13 -0400 >Subject: [PATCH] [PASSED QA] Bug 7639 - system preference to forgive fines on > lost items - Add Unit Tests > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >All tests and QA script pass. >I fixed a redundant 'my' that the QA script pointed out. >--- > t/db_dependent/Circulation.t | 70 ++++++++++++++++++++++++++++++++++-------- > 1 file changed, 58 insertions(+), 12 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index bf27fb5..03a1d51 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -9,7 +9,7 @@ use C4::Items; > use C4::Members; > use C4::Reserves; > >-use Test::More tests => 30; >+use Test::More tests => 32; > > BEGIN { > use_ok('C4::Circulation'); >@@ -129,16 +129,19 @@ $dbh->do('DELETE FROM issuingrules'); > $dbh->do( > q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, > maxissueqty, issuelength, lengthunit, >- renewalsallowed, renewalperiod) >+ renewalsallowed, renewalperiod, >+ fine, chargeperiod) > VALUES (?, ?, ?, ?, > ?, ?, ?, >+ ?, ?, > ?, ? > ) > }, > {}, > '*', '*', '*', 25, > 20, 14, 'days', >- 1, 7 >+ 1, 7, >+ .10, 1 > ); > > # Test C4::Circulation::ProcessOfflinePayment >@@ -157,7 +160,7 @@ ok( $new_count == $original_count + 1, 'ProcessOfflinePayment makes payment cor > > C4::Context->dbh->do("DELETE FROM accountlines WHERE borrowernumber IN ( SELECT borrowernumber FROM borrowers WHERE cardnumber = '99999999999' )"); > C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); >- >+C4::Context->dbh->do("DELETE FROM accountlines"); > { > # CanBookBeRenewed tests > >@@ -174,16 +177,26 @@ C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); > my $barcode = 'R00000342'; > my $branch = 'MPL'; > >- my ($item_bibnum, $item_bibitemnum, $itemnumber) = >- AddItem({ homebranch => $branch, >- holdingbranch => $branch, >- barcode => $barcode, } , $biblionumber); >+ my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( >+ { >+ homebranch => $branch, >+ holdingbranch => $branch, >+ barcode => $barcode, >+ replacementprice => 12.00 >+ }, >+ $biblionumber >+ ); > > my $barcode2 = 'R00000343'; >- my ($item_bibnum2, $item_bibitemnum2, $itemnumber2) = >- AddItem({ homebranch => $branch, >- holdingbranch => $branch, >- barcode => $barcode2, } , $biblionumber); >+ my ( $item_bibnum2, $item_bibitemnum2, $itemnumber2 ) = AddItem( >+ { >+ homebranch => $branch, >+ holdingbranch => $branch, >+ barcode => $barcode2, >+ replacementprice => 23.00 >+ }, >+ $biblionumber >+ ); > > # Create 2 borrowers > my %renewing_borrower_data = ( >@@ -281,6 +294,39 @@ C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); > is( $renewokay, 0, 'Cannot renew, 0 renewals allowed'); > is( $error, 'too_many', 'Cannot renew, 0 renewals allowed (returned code is too_many)'); > >+ # Test WhenLostForgiveFine and WhenLostChargeReplacementFee >+ diag("WhenLostForgiveFine and WhenLostChargeReplacementFee"); >+ C4::Context->set_preference('WhenLostForgiveFine','1'); >+ C4::Context->set_preference('WhenLostChargeReplacementFee','1'); >+ >+ C4::Overdues::UpdateFine( $itemnumber, $renewing_borrower->{borrowernumber}, >+ 15.00, q{}, Koha::DateUtils::output_pref($datedue) ); >+ >+ LostItem( $itemnumber, 1 ); >+ >+ my $total_due = $dbh->selectrow_array( >+ 'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', >+ undef, $renewing_borrower->{borrowernumber} >+ ); >+ >+ ok( $total_due == 12, 'Borrower only charged replacement fee with both WhenLostForgiveFine and WhenLostChargeReplacementFee enabled' ); >+ >+ C4::Context->dbh->do("DELETE FROM accountlines"); >+ >+ C4::Context->set_preference('WhenLostForgiveFine','0'); >+ C4::Context->set_preference('WhenLostChargeReplacementFee','0'); >+ >+ C4::Overdues::UpdateFine( $itemnumber2, $renewing_borrower->{borrowernumber}, >+ 15.00, q{}, Koha::DateUtils::output_pref($datedue) ); >+ >+ LostItem( $itemnumber2, 1 ); >+ >+ $total_due = $dbh->selectrow_array( >+ 'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', >+ undef, $renewing_borrower->{borrowernumber} >+ ); >+ >+ ok( $total_due == 15, 'Borrower only charged fine with both WhenLostForgiveFine and WhenLostChargeReplacementFee disabled' ); > } > > $dbh->rollback; >-- >1.7.9.5
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 7639
:
9281
|
9282
|
9436
|
10662
|
10663
|
13006
|
13007
|
14961
|
14962
|
15088
|
15089
|
16593
|
16607
|
16608
|
16609
|
16729
|
16730
|
16731
|
18929
|
18930
|
18932
|
18964
|
18965
|
18966
|
19654
|
19655
|
19656
|
19657
|
20436
|
20437
|
20438
|
20439
|
20456
| 20487