Bug 20562: issue_id is not stored in accountlines for rental fees
Test Plan: 1) Apply this patch 2) Assign a charge to an item type 3) Checkout an item of that type to a patron 4) View the accountlines table for that patron SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##; 5) Note there is an issue_id Or 1) Apply this patch 2) prove t/db_dependent/Circulation/issue.t Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
f553d76600
commit
dc5d3b9abd
|
|
@ -1406,7 +1406,7 @@ sub AddIssue {
|
|||
# If it costs to borrow this book, charge it to the patron's account.
|
||||
my ( $charge, $itemtype ) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} );
|
||||
if ( $charge > 0 ) {
|
||||
AddIssuingCharge( $item->{'itemnumber'}, $borrower->{'borrowernumber'}, $charge );
|
||||
AddIssuingCharge( $item->{'itemnumber'}, $borrower->{'borrowernumber'}, $issue->id, $charge );
|
||||
$item->{'charge'} = $charge;
|
||||
}
|
||||
|
||||
|
|
@ -3165,12 +3165,12 @@ sub _get_discount_from_rule {
|
|||
|
||||
=head2 AddIssuingCharge
|
||||
|
||||
&AddIssuingCharge( $itemno, $borrowernumber, $charge )
|
||||
&AddIssuingCharge( $itemno, $borrowernumber, $issue_id, $charge )
|
||||
|
||||
=cut
|
||||
|
||||
sub AddIssuingCharge {
|
||||
my ( $itemnumber, $borrowernumber, $charge ) = @_;
|
||||
my ( $itemnumber, $borrowernumber, $issue_id, $charge ) = @_;
|
||||
|
||||
my $nextaccntno = getnextacctno($borrowernumber);
|
||||
|
||||
|
|
@ -3181,6 +3181,7 @@ sub AddIssuingCharge {
|
|||
{
|
||||
borrowernumber => $borrowernumber,
|
||||
itemnumber => $itemnumber,
|
||||
issue_id => $issue_id,
|
||||
accountno => $nextaccntno,
|
||||
amount => $charge,
|
||||
amountoutstanding => $charge,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 31;
|
||||
use Test::More tests => 32;
|
||||
use DateTime::Duration;
|
||||
|
||||
use t::lib::Mocks;
|
||||
|
|
@ -207,8 +207,10 @@ $sth = $dbh->prepare($query);
|
|||
$sth->execute;
|
||||
my $countaccount = $sth -> fetchrow_array;
|
||||
is ($countaccount,0,"0 accountline exists");
|
||||
is( ref( C4::Circulation::AddIssuingCharge( $item_id1, $borrower_id1, 10 ) ),
|
||||
'Koha::Account::Offset', "An issuing charge has been added" );
|
||||
my $offset = C4::Circulation::AddIssuingCharge( $item_id1, $borrower_id1, $issue_id1, 10 );
|
||||
is( ref( $offset ), 'Koha::Account::Offset', "An issuing charge has been added" );
|
||||
my $charge = Koha::Account::Lines->find( $offset->debit_id );
|
||||
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' );
|
||||
my $account_id = $dbh->last_insert_id( undef, undef, 'accountlines', undef );
|
||||
$sth->execute;
|
||||
$countaccount = $sth -> fetchrow_array;
|
||||
|
|
|
|||
Loading…
Reference in New Issue