From 6ace43876388f1d85ae70e5ba193d442b2c380c7 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 16 Jun 2014 02:02:48 -0400 Subject: [PATCH] Bug 6427 [Part 32] - Fix koha-qa.pl issues --- Koha/Accounts.pm | 31 +++++++++++--------- .../prog/en/modules/members/account.tt | 4 +- misc/cronjobs/recalculate_account_balances.pl | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Koha/Accounts.pm b/Koha/Accounts.pm index a5e3359..90677e2 100644 --- a/Koha/Accounts.pm +++ b/Koha/Accounts.pm @@ -198,7 +198,10 @@ sub DebitLostItem { $params->{amount} = $item->replacementprice(); $params->{itemnumber} = $item->itemnumber(); $params->{issue_id} = $issue->issue_id(); - $params->{description} = "Lost Item " . $issue->item()->biblio()->title() . " " . $issue->item()->barcode(); + $params->{description} = + "Lost Item " + . $issue->item()->biblio()->title() . " " + . $issue->item()->barcode(); #TODO: Shouldn't we have a default replacement price as a syspref? if ( $params->{amount} ) { @@ -442,7 +445,8 @@ sub RecalculateAccountBalance { my $debits = Koha::Database->new()->schema->resultset('AccountDebit') ->search( { borrowernumber => $borrower->borrowernumber() } ); - my $amount_outstanding = $debits->get_column('amount_outstanding')->sum() || 0; + my $amount_outstanding = $debits->get_column('amount_outstanding')->sum() + || 0; my $credits = Koha::Database->new()->schema->resultset('AccountCredit') @@ -475,13 +479,14 @@ sub VoidCredit { my $credit = $schema->resultset('AccountCredit')->find($id); foreach my $offset ( $credit->account_offsets() ) { - my $debit = $offset->debit(); + my $debit = $offset->debit(); - $debit->amount_outstanding( $debit->amount_outstanding() - $offset->amount() ); - $debit->updated_on( get_timestamp() ); - $debit->update(); + $debit->amount_outstanding( + $debit->amount_outstanding() - $offset->amount() ); + $debit->updated_on( get_timestamp() ); + $debit->update(); - Koha::Database->new()->schema->resultset('AccountOffset')->create( + Koha::Database->new()->schema->resultset('AccountOffset')->create( { amount => $offset->amount() * -1, debit_id => $debit->id(), @@ -489,7 +494,7 @@ sub VoidCredit { created_on => get_timestamp(), type => Koha::Accounts::OffsetTypes::Void(), } - ); + ); } $credit->amount_voided( $credit->amount_paid ); @@ -520,21 +525,19 @@ sub NormalizeBalances { my $schema = Koha::Database->new()->schema(); - my @credits = - $schema->resultset('AccountCredit')->search( + my @credits = $schema->resultset('AccountCredit')->search( { borrowernumber => $borrower->borrowernumber(), amount_remaining => { '>' => '0' } } - ); + ); - my @debits = - $schema->resultset('AccountDebit')->search( + my @debits = $schema->resultset('AccountDebit')->search( { borrowernumber => $borrower->borrowernumber(), amount_outstanding => { '>' => '0' } } - ); + ); foreach my $credit (@credits) { foreach my $debit (@debits) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt index 5519f3c..c91565a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt @@ -36,7 +36,7 @@ $(document).ready(function() { var debitsTable = $('#debits-table').dataTable( { "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>", "oTableTools": { - "sSwfPath": "/intranet-tmpl/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf", + "sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf", "aButtons": [ { "sExtends": "print", @@ -141,7 +141,7 @@ $(document).ready(function() { var creditsTable = $('#credits-table').dataTable( { "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>", "oTableTools": { - "sSwfPath": "/intranet-tmpl/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf", + "sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf", "aButtons": [ { "sExtends": "print", diff --git a/misc/cronjobs/recalculate_account_balances.pl b/misc/cronjobs/recalculate_account_balances.pl index 426c2a2..63086c2 100755 --- a/misc/cronjobs/recalculate_account_balances.pl +++ b/misc/cronjobs/recalculate_account_balances.pl @@ -6,7 +6,7 @@ # # Koha is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later +# Foundation; either version 3 of the License, or (at your option) any later # version. # # Koha is distributed in the hope that it will be useful, but WITHOUT ANY -- 1.7.2.5