Bugzilla – Attachment 68427 Details for
Bug 12768
Replacement cost and processing fee management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12768 [QA Followup] - Don't use manualinvoice for non-manual invoices in chargelostitem
Bug-12768-QA-Followup---Dont-use-manualinvoice-for.patch (text/plain), 6.97 KB, created by
Kyle M Hall (khall)
on 2017-10-23 17:09:04 UTC
(
hide
)
Description:
Bug 12768 [QA Followup] - Don't use manualinvoice for non-manual invoices in chargelostitem
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-10-23 17:09:04 UTC
Size:
6.97 KB
patch
obsolete
>From 6a05bcae8cc6181c852611820c9a02599c7d0d9f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 23 Oct 2017 12:51:50 -0400 >Subject: [PATCH] Bug 12768 [QA Followup] - Don't use manualinvoice for > non-manual invoices in chargelostitem > >--- > C4/Accounts.pm | 75 +++++++++++++++++++++- > installer/data/mysql/account_offset_types.sql | 1 + > .../data/mysql/atomicupdate/processing_fee.sql | 1 + > t/db_dependent/Circulation/Chargelostitem.t | 9 ++- > 4 files changed, 83 insertions(+), 3 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/processing_fee.sql > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 7daff23..0717215 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -159,11 +159,82 @@ sub chargelostitem{ > unless ($existing_charges) { > #add processing fee > if ($processfee && $processfee > 0){ >- manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1); >+ my $accountline = Koha::Account::Line->new( >+ { >+ borrowernumber => $borrowernumber, >+ accountno => getnextacctno($borrowernumber), >+ date => \'NOW()', >+ amount => $processfee, >+ description => $description, >+ accounttype => 'PF', >+ amountoutstanding => $processfee, >+ itemnumber => $itemnumber, >+ note => $processingfeenote, >+ manager_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ } >+ )->store(); >+ >+ my $account_offset = Koha::Account::Offset->new( >+ { >+ debit_id => $accountline->id, >+ type => 'Processing Fee', >+ amount => $accountline->amount, >+ } >+ )->store(); >+ >+ if ( C4::Context->preference("FinesLog") ) { >+ logaction("FINES", 'CREATE',$borrowernumber,Dumper({ >+ action => 'create_fee', >+ borrowernumber => $accountline->borrowernumber,, >+ accountno => $accountline->accountno, >+ amount => $accountline->amount, >+ description => $accountline->description, >+ accounttype => $accountline->accounttype, >+ amountoutstanding => $accountline->amountoutstanding, >+ note => $accountline->note, >+ itemnumber => $accountline->itemnumber, >+ manager_id => $accountline->manager_id, >+ })); >+ } > } > #add replace cost > if ($replacementprice > 0){ >- manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice, undef, 1); >+ my $accountline = Koha::Account::Line->new( >+ { >+ borrowernumber => $borrowernumber, >+ accountno => getnextacctno($borrowernumber), >+ date => \'NOW()', >+ amount => $replacementprice, >+ description => $description, >+ accounttype => 'L', >+ amountoutstanding => $replacementprice, >+ itemnumber => $itemnumber, >+ manager_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, >+ } >+ )->store(); >+ >+ my $account_offset = Koha::Account::Offset->new( >+ { >+ debit_id => $accountline->id, >+ type => 'Lost Item', >+ amount => $accountline->amount, >+ } >+ )->store(); >+ >+ if ( C4::Context->preference("FinesLog") ) { >+ logaction("FINES", 'CREATE',$borrowernumber,Dumper({ >+ action => 'create_fee', >+ borrowernumber => $accountline->borrowernumber,, >+ accountno => $accountline->accountno, >+ amount => $accountline->amount, >+ description => $accountline->description, >+ accounttype => $accountline->accounttype, >+ amountoutstanding => $accountline->amountoutstanding, >+ note => $accountline->note, >+ itemnumber => $accountline->itemnumber, >+ manager_id => $accountline->manager_id, >+ })); >+ } > } > } > } >diff --git a/installer/data/mysql/account_offset_types.sql b/installer/data/mysql/account_offset_types.sql >index 2f9004c..a0f2fb1 100644 >--- a/installer/data/mysql/account_offset_types.sql >+++ b/installer/data/mysql/account_offset_types.sql >@@ -2,6 +2,7 @@ INSERT INTO account_offset_types ( type ) VALUES > ('Writeoff'), > ('Payment'), > ('Lost Item'), >+('Processing Fee'), > ('Manual Debit'), > ('Reverse Payment'), > ('Forgiven'), >diff --git a/installer/data/mysql/atomicupdate/processing_fee.sql b/installer/data/mysql/atomicupdate/processing_fee.sql >new file mode 100644 >index 0000000..98b9827 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/processing_fee.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Processing Fee' ); >diff --git a/t/db_dependent/Circulation/Chargelostitem.t b/t/db_dependent/Circulation/Chargelostitem.t >index 3ffb295..bb2f230 100644 >--- a/t/db_dependent/Circulation/Chargelostitem.t >+++ b/t/db_dependent/Circulation/Chargelostitem.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 6; > use Test::MockModule; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -62,6 +62,7 @@ AddIssue($borrower, '0101'); > AddIssue($borrower, '0203'); > > # Begin tests... >+Koha::Account::Offsets->delete(); > my $issue = Koha::Checkouts->search( { borrowernumber => $borrowernumber } )->next()->unblessed(); > C4::Accounts::chargelostitem( $borrowernumber, $issue->{itemnumber}, '1.00'); > >@@ -70,3 +71,9 @@ my $accountline = Koha::Account::Lines->search( { borrowernumber => $borrowernum > is( int($accountline->amount), $itemtype->{processfee}, "The accountline amount should be precessfee value " ); > is( $accountline->itemnumber, $itemnumber1, "The accountline itemnumber should the linked with barcode '0101'" ); > is( $accountline->note, C4::Context->preference("ProcessingFeeNote"), "The accountline description should be 'test'" ); >+ >+my $lost_ao = Koha::Account::Offsets->single( { type => 'Lost Item' } ); >+ok( $lost_ao, 'Account offset of type "Lost Item" created' ); >+ >+my $processing_fee_ao = Koha::Account::Offsets->single( { type => 'Processing Fee' } ); >+ok( $processing_fee_ao, 'Account offset of type "Processing Fee" created' ); >-- >2.10.2
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 12768
:
34333
|
34334
|
36350
|
36505
|
36506
|
36552
|
36553
|
36554
|
36555
|
38365
|
38367
|
38368
|
38375
|
39298
|
39299
|
39300
|
39999
|
40000
|
40001
|
40002
|
42157
|
42158
|
43181
|
43546
|
64775
|
64776
|
66760
|
66761
|
67875
|
67876
|
67877
|
67878
|
67891
|
67892
|
67893
|
67894
|
67895
|
67896
|
67897
|
68035
|
68036
|
68037
|
68038
|
68039
|
68040
|
68041
|
68042
|
68076
|
68264
|
68265
|
68266
|
68267
|
68268
|
68269
|
68270
|
68271
|
68272
|
68273
|
68274
|
68332
|
68415
|
68416
|
68417
|
68426
| 68427