View | Details | Raw Unified | Return to bug 12001
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 2703-2709 sub CanBookBeRenewed { Link Here
2703
2703
2704
        if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
2704
        if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
2705
            my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
2705
            my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
2706
            my ( $amountoutstanding ) = C4::Members::GetMemberAccountRecords($patron->borrowernumber);
2706
            my $amountoutstanding = $patron->account->balance;
2707
            if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) {
2707
            if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) {
2708
                return ( 0, "auto_too_much_oweing" );
2708
                return ( 0, "auto_too_much_oweing" );
2709
            }
2709
            }
(-)a/C4/Members.pm (-53 / +11 lines)
Lines 26-31 use C4::Context; Link Here
26
use String::Random qw( random_string );
26
use String::Random qw( random_string );
27
use Scalar::Util qw( looks_like_number );
27
use Scalar::Util qw( looks_like_number );
28
use Date::Calc qw/Today check_date Date_to_Days/;
28
use Date::Calc qw/Today check_date Date_to_Days/;
29
use List::MoreUtils qw( uniq );
29
use C4::Log; # logaction
30
use C4::Log; # logaction
30
use C4::Overdues;
31
use C4::Overdues;
31
use C4::Reserves;
32
use C4::Reserves;
Lines 64-71 BEGIN { Link Here
64
        &GetPendingIssues
65
        &GetPendingIssues
65
        &GetAllIssues
66
        &GetAllIssues
66
67
67
        &GetMemberAccountRecords
68
69
        &GetBorrowersToExpunge
68
        &GetBorrowersToExpunge
70
69
71
        &IssueSlip
70
        &IssueSlip
Lines 736-784 sub GetAllIssues { Link Here
736
}
735
}
737
736
738
737
739
=head2 GetMemberAccountRecords
740
741
  ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber);
742
743
Looks up accounting data for the patron with the given borrowernumber.
744
745
C<&GetMemberAccountRecords> returns a three-element array. C<$acctlines> is a
746
reference-to-array, where each element is a reference-to-hash; the
747
keys are the fields of the C<accountlines> table in the Koha database.
748
C<$count> is the number of elements in C<$acctlines>. C<$total> is the
749
total amount outstanding for all of the account lines.
750
751
=cut
752
753
sub GetMemberAccountRecords {
754
    my ($borrowernumber) = @_;
755
    my $dbh = C4::Context->dbh;
756
    my @acctlines;
757
    my $numlines = 0;
758
    my $strsth      = qq(
759
                        SELECT * 
760
                        FROM accountlines 
761
                        WHERE borrowernumber=?);
762
    $strsth.=" ORDER BY accountlines_id desc";
763
    my $sth= $dbh->prepare( $strsth );
764
    $sth->execute( $borrowernumber );
765
766
    my $total = 0;
767
    while ( my $data = $sth->fetchrow_hashref ) {
768
        if ( $data->{itemnumber} ) {
769
            my $item = Koha::Items->find( $data->{itemnumber} );
770
            my $biblio = $item->biblio;
771
            $data->{biblionumber} = $biblio->biblionumber;
772
            $data->{title}        = $biblio->title;
773
        }
774
        $acctlines[$numlines] = $data;
775
        $numlines++;
776
        $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors
777
    }
778
    $total /= 1000;
779
    return ( $total, \@acctlines,$numlines);
780
}
781
782
=head2 GetMemberAccountBalance
738
=head2 GetMemberAccountBalance
783
739
784
  ($total_balance, $non_issue_balance, $other_charges) = &GetMemberAccountBalance($borrowernumber);
740
  ($total_balance, $non_issue_balance, $other_charges) = &GetMemberAccountBalance($borrowernumber);
Lines 795-800 Charges exempt from non-issue are: Link Here
795
sub GetMemberAccountBalance {
751
sub GetMemberAccountBalance {
796
    my ($borrowernumber) = @_;
752
    my ($borrowernumber) = @_;
797
753
754
    # FIXME REMOVE And add a warning in the about page + update DB if length(MANUAL_INV) > 5
798
    my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous...
755
    my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous...
799
756
800
    my @not_fines;
757
    my @not_fines;
Lines 802-817 sub GetMemberAccountBalance { Link Here
802
    push @not_fines, 'Rent' unless C4::Context->preference('RentalsInNoissuesCharge');
759
    push @not_fines, 'Rent' unless C4::Context->preference('RentalsInNoissuesCharge');
803
    unless ( C4::Context->preference('ManInvInNoissuesCharge') ) {
760
    unless ( C4::Context->preference('ManInvInNoissuesCharge') ) {
804
        my $dbh = C4::Context->dbh;
761
        my $dbh = C4::Context->dbh;
805
        my $man_inv_types = $dbh->selectcol_arrayref(qq{SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'});
762
        push @not_fines, @{ $dbh->selectcol_arrayref(qq{SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'}) };
806
        push @not_fines, map substr($_, 0, $ACCOUNT_TYPE_LENGTH), @$man_inv_types;
807
    }
763
    }
808
    my %not_fine = map {$_ => 1} @not_fines;
764
    @not_fines = map { substr($_, 0, $ACCOUNT_TYPE_LENGTH) } uniq (@not_fines);
809
765
810
    my ($total, $acctlines) = GetMemberAccountRecords($borrowernumber);
766
    my $patron = Koha::Patrons->find( $borrowernumber );
811
    my $other_charges = 0;
767
    my $total = $patron->account->balance;
812
    foreach (@$acctlines) {
768
    my $other_charges = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, accounttype => { -in => \@not_fines } }, {
813
        $other_charges += $_->{amountoutstanding} if $not_fine{ substr($_->{accounttype}, 0, $ACCOUNT_TYPE_LENGTH) };
769
            select => [ { sum => 'amountoutstanding' } ],
814
    }
770
            as => ['total_other_charges'],
771
        });
772
    $other_charges = $other_charges->count ? $other_charges->next->get_column('total_other_charges') : 0;
815
773
816
    return ( $total, $total - $other_charges, $other_charges);
774
    return ( $total, $total - $other_charges, $other_charges);
817
}
775
}
(-)a/C4/SIP/ILS/Patron.pm (-1 / +1 lines)
Lines 88-94 sub new { Link Here
88
        hold_ok         => ( !$debarred && !$expired && !$fine_blocked),
88
        hold_ok         => ( !$debarred && !$expired && !$fine_blocked),
89
        card_lost       => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
89
        card_lost       => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
90
        claims_returned => 0,
90
        claims_returned => 0,
91
        fines           => $fines_amount, # GetMemberAccountRecords($kp->{borrowernumber})
91
        fines           => $fines_amount,
92
        fees            => 0,             # currently not distinct from fines
92
        fees            => 0,             # currently not distinct from fines
93
        recall_overdue  => 0,
93
        recall_overdue  => 0,
94
        items_billed    => 0,
94
        items_billed    => 0,
(-)a/Koha/Account.pm (-1 / +2 lines)
Lines 279-285 sub balance { Link Here
279
            as => ['total_amountoutstanding'],
279
            as => ['total_amountoutstanding'],
280
        }
280
        }
281
    );
281
    );
282
    return $fines->count
282
283
    my $total = $fines->count
283
      ? $fines->next->get_column('total_amountoutstanding')
284
      ? $fines->next->get_column('total_amountoutstanding')
284
      : 0;
285
      : 0;
285
}
286
}
(-)a/Koha/Account/Line.pm (-1 / +14 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Carp;
20
use Carp;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Items;
23
24
24
use base qw(Koha::Object);
25
use base qw(Koha::Object);
25
26
Lines 33-39 Koha::Account::Lines - Koha accountline Object class Link Here
33
34
34
=cut
35
=cut
35
36
36
=head3 type
37
=head3 item
38
39
Return the item linked to this account line if exists
40
41
=cut
42
43
sub item {
44
    my ( $self ) = @_;
45
    my $rs = $self->_result->itemnumber;
46
    return Koha::Item->_new_from_dbic( $rs );
47
}
48
49
=head3 _type
37
50
38
=cut
51
=cut
39
52
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 558-564 foreach my $flag ( sort keys %$flags ) { Link Here
558
my $amountold = $flags ? $flags->{'CHARGES'}->{'message'} || 0 : 0;
558
my $amountold = $flags ? $flags->{'CHARGES'}->{'message'} || 0 : 0;
559
$amountold =~ s/^.*\$//;    # remove upto the $, if any
559
$amountold =~ s/^.*\$//;    # remove upto the $, if any
560
560
561
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
561
my $total = $patron ? $patron->account->balance : 0;
562
562
563
if ( $patron && $patron->category->category_type eq 'C') {
563
if ( $patron && $patron->category->category_type eq 'C') {
564
    my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
564
    my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-1 / +1 lines)
Lines 78-84 Link Here
78
          [% CASE %][% account.accounttype %]
78
          [% CASE %][% account.accounttype %]
79
        [%- END -%]
79
        [%- END -%]
80
        [%- IF account.description %], [% account.description %][% END %]
80
        [%- IF account.description %], [% account.description %][% END %]
81
        &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% account.title |html %]</a>[% END %]</td>
81
        &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% account.item.biblio.title |html %]</a>[% END %]</td>
82
      <td>[% account.note | html_line_break %]</td>
82
      <td>[% account.note | html_line_break %]</td>
83
      [% IF ( account.amountcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
83
      [% IF ( account.amountcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
84
      [% IF ( account.amountoutstandingcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
84
      [% IF ( account.amountoutstandingcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt (-3 / +2 lines)
Lines 103-113 Link Here
103
            </tr>
103
            </tr>
104
104
105
            [% FOREACH account IN accounts %]
105
            [% FOREACH account IN accounts %]
106
                [% NEXT IF account.amountoutstanding == 0 %]
107
                <tr>
106
                <tr>
108
                    <td>
107
                    <td>
109
                        [% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% END %]
108
                        [% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% END %]
110
                        [% account.description %]&nbsp;[% IF ( account.printtitle ) %] [% account.title |html %][% END %]
109
                        [% account.description %]&nbsp;[% IF account.item AND account.accounttype != 'F' AND account.accounttype != 'FU' %] [% account.item.biblio.title |html %][% END %]
111
                        [% IF ( account.itemnumber ) %]</a>[% END %]
110
                        [% IF ( account.itemnumber ) %]</a>[% END %]
112
                    </td>
111
                    </td>
113
                    <td>[% account.date | $KohaDates %]</td>
112
                    <td>[% account.date | $KohaDates %]</td>
(-)a/members/boraccount.pl (-3 / +18 lines)
Lines 71-84 if ( $patron->category->category_type eq 'C') { Link Here
71
}
71
}
72
72
73
#get account details
73
#get account details
74
my ($total,$accts,undef)=GetMemberAccountRecords($borrowernumber);
74
my $total = $patron->account->balance;
75
76
my $accts = Koha::Account::Lines->search(
77
    { borrowernumber => $patron->borrowernumber },
78
    { order_by       => { -desc => 'accountlines_id' } }
79
);
80
75
my $totalcredit;
81
my $totalcredit;
76
if($total <= 0){
82
if($total <= 0){
77
        $totalcredit = 1;
83
        $totalcredit = 1;
78
}
84
}
79
85
80
my $reverse_col = 0; # Flag whether we need to show the reverse column
86
my $reverse_col = 0; # Flag whether we need to show the reverse column
81
foreach my $accountline ( @{$accts}) {
87
my @accountlines;
88
while ( my $line = $accts->next ) {
89
    # FIXME We should pass the $accts iterator to the template and do this formatting part there
90
    my $accountline = $line->unblessed;
82
    $accountline->{amount} += 0.00;
91
    $accountline->{amount} += 0.00;
83
    if ($accountline->{amount} <= 0 ) {
92
    if ($accountline->{amount} <= 0 ) {
84
        $accountline->{amountcredit} = 1;
93
        $accountline->{amountcredit} = 1;
Lines 94-99 foreach my $accountline ( @{$accts}) { Link Here
94
        $accountline->{payment} = 1;
103
        $accountline->{payment} = 1;
95
        $reverse_col = 1;
104
        $reverse_col = 1;
96
    }
105
    }
106
107
    if ( $accountline->{itemnumber} ) {
108
        # Because we will not have access to the object from the template
109
        $accountline->{item} = { biblionumber => $line->item->biblionumber, };
110
    }
111
    push @accountlines, $accountline;
97
}
112
}
98
113
99
$template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ );
114
$template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ );
Lines 117-123 $template->param( Link Here
117
    totalcredit         => $totalcredit,
132
    totalcredit         => $totalcredit,
118
    is_child            => ($patron->category->category_type eq 'C'),
133
    is_child            => ($patron->category->category_type eq 'C'),
119
    reverse_col         => $reverse_col,
134
    reverse_col         => $reverse_col,
120
    accounts            => $accts,
135
    accounts            => \@accountlines,
121
);
136
);
122
137
123
output_html_with_http_headers $input, $cookie, $template->output;
138
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/moremember.pl (-10 / +6 lines)
Lines 50-55 use C4::Biblio; Link Here
50
use C4::Form::MessagingPreferences;
50
use C4::Form::MessagingPreferences;
51
use List::MoreUtils qw/uniq/;
51
use List::MoreUtils qw/uniq/;
52
use C4::Members::Attributes qw(GetBorrowerAttributes);
52
use C4::Members::Attributes qw(GetBorrowerAttributes);
53
use Koha::Account::Lines;
53
use Koha::AuthorisedValues;
54
use Koha::AuthorisedValues;
54
use Koha::CsvProfiles;
55
use Koha::CsvProfiles;
55
use Koha::Patron::Debarments qw(GetDebarments);
56
use Koha::Patron::Debarments qw(GetDebarments);
Lines 218-235 else { Link Here
218
my $library = Koha::Libraries->find( $data->{branchcode})->unblessed;
219
my $library = Koha::Libraries->find( $data->{branchcode})->unblessed;
219
@{$data}{keys %$library} = values %$library; # merge in all branch columns
220
@{$data}{keys %$library} = values %$library; # merge in all branch columns
220
221
221
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
222
223
# If printing a page, send the account informations to the template
222
# If printing a page, send the account informations to the template
224
if ($print eq "page") {
223
if ($print eq "page") {
225
    foreach my $accountline (@$accts) {
224
    my $accts = Koha::Account::Lines->search(
226
        $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
225
        { borrowernumber => $patron->borrowernumber, amountoutstanding => { '>' => 0 } },
227
        $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
226
        { order_by       => { -desc => 'accountlines_id' } }
228
227
    );
229
        if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){
230
            $accountline->{printtitle} = 1;
231
        }
232
    }
233
    $template->param( accounts => $accts );
228
    $template->param( accounts => $accts );
234
}
229
}
235
230
Lines 348-353 my $patron_messages = Koha::Patron::Messages->search( Link Here
348
my ( $subtag, $region ) = split '-', $patron->lang;
343
my ( $subtag, $region ) = split '-', $patron->lang;
349
my $translated_language = C4::Languages::language_get_description( $subtag, $subtag, 'language' );
344
my $translated_language = C4::Languages::language_get_description( $subtag, $subtag, 'language' );
350
345
346
my $total = $patron->account->balance;
351
$template->param(
347
$template->param(
352
    patron          => $patron,
348
    patron          => $patron,
353
    translated_language => $translated_language,
349
    translated_language => $translated_language,
(-)a/members/pay.pl (-1 / +2 lines)
Lines 129-135 output_html_with_http_headers $input, $cookie, $template->output; Link Here
129
129
130
sub add_accounts_to_template {
130
sub add_accounts_to_template {
131
131
132
    my ( $total, undef, undef ) = GetMemberAccountRecords($borrowernumber);
132
    my $patron = Koha::Patrons->find( $borrowernumber );
133
    my $total = $patron->account->balance;
133
    my $account_lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber, amountoutstanding => { '!=' => 0 } }, { order_by => ['accounttype'] });
134
    my $account_lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber, amountoutstanding => { '!=' => 0 } }, { order_by => ['accounttype'] });
134
    my @accounts;
135
    my @accounts;
135
    while ( my $account_line = $account_lines->next ) {
136
    while ( my $account_line = $account_lines->next ) {
(-)a/members/paycollect.pl (-1 / +1 lines)
Lines 61-67 my $user = $input->remote_user; Link Here
61
61
62
my $branch         = C4::Context->userenv->{'branch'};
62
my $branch         = C4::Context->userenv->{'branch'};
63
63
64
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
64
my $total_due = $patron->account->balance;
65
my $total_paid = $input->param('paid');
65
my $total_paid = $input->param('paid');
66
66
67
my $individual   = $input->param('pay_individual');
67
my $individual   = $input->param('pay_individual');
(-)a/members/printfeercpt.pl (-43 / +30 lines)
Lines 29-34 use C4::Output; Link Here
29
use CGI qw ( -utf8 );
29
use CGI qw ( -utf8 );
30
use C4::Members;
30
use C4::Members;
31
use C4::Accounts;
31
use C4::Accounts;
32
use Koha::Account::Lines;
32
use Koha::DateUtils;
33
use Koha::DateUtils;
33
use Koha::Patrons;
34
use Koha::Patrons;
34
use Koha::Patron::Categories;
35
use Koha::Patron::Categories;
Lines 69-122 if ( $data->{'category_type'} eq 'C') { Link Here
69
}
70
}
70
71
71
#get account details
72
#get account details
72
my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber);
73
my $total = $patron->account->balance;
74
75
# FIXME This whole stuff is ugly and should be rewritten
76
# FIXME We should pass the $accts iterator to the template and do this formatting part there
77
my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed;
73
my $totalcredit;
78
my $totalcredit;
74
if($total <= 0){
79
if($total <= 0){
75
        $totalcredit = 1;
80
        $totalcredit = 1;
76
}
81
}
77
my @accountrows; # this is for the tmpl-loop
82
78
83
$accountline->{'amount'} += 0.00;
79
my $toggle;
84
if ( $accountline->{'amount'} <= 0 ) {
80
for (my $i=0;$i<$numaccts;$i++){
85
    $accountline->{'amountcredit'} = 1;
81
    next if ( $accts->[$i]{'accountlines_id'} ne $accountlines_id );
86
    $accountline->{'amount'} *= -1.00;
82
    if($i%2){
87
}
83
            $toggle = 0;
88
$accountline->{'amountoutstanding'} += 0.00;
84
    } else {
89
if ( $accountline->{'amountoutstanding'} <= 0 ) {
85
            $toggle = 1;
90
    $accountline->{'amountoutstandingcredit'} = 1;
86
    }
87
    $accts->[$i]{'toggle'} = $toggle;
88
    $accts->[$i]{'amount'}+=0.00;
89
    if($accts->[$i]{'amount'} <= 0){
90
        $accts->[$i]{'amountcredit'} = 1;
91
	$accts->[$i]{'amount'}*=-1.00;
92
    }
93
    $accts->[$i]{'amountoutstanding'}+=0.00;
94
    if($accts->[$i]{'amountoutstanding'} <= 0){
95
        $accts->[$i]{'amountoutstandingcredit'} = 1;
96
    }
97
98
    my %row = ( 'date'         => dt_from_string( $accts->[$i]{'date'} ),
99
                'amountcredit' => $accts->[$i]{'amountcredit'},
100
                'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
101
                'toggle' => $accts->[$i]{'toggle'},
102
                'description'       => $accts->[$i]{'description'},
103
				'itemnumber'       => $accts->[$i]{'itemnumber'},
104
				'biblionumber'       => $accts->[$i]{'biblionumber'},
105
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
106
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
107
                'accountno' => $accts->[$i]{'accountno'},
108
                accounttype => $accts->[$i]{accounttype},
109
                'note' => $accts->[$i]{'note'},
110
                );
111
112
    if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
113
        $row{'printtitle'}=1;
114
        $row{'title'} = $accts->[$i]{'title'};
115
    }
116
117
    push(@accountrows, \%row);
118
}
91
}
119
92
93
my %row = (
94
    'date'                    => dt_from_string( $accountline->{'date'} ),
95
    'amountcredit'            => $accountline->{'amountcredit'},
96
    'amountoutstandingcredit' => $accountline->{'amountoutstandingcredit'},
97
    'description'             => $accountline->{'description'},
98
    'amount'                  => sprintf( "%.2f", $accountline->{'amount'} ),
99
    'amountoutstanding' =>
100
      sprintf( "%.2f", $accountline->{'amountoutstanding'} ),
101
    'accountno' => $accountline->{'accountno'},
102
    accounttype => $accountline->{accounttype},
103
    'note'      => $accountline->{'note'},
104
);
105
120
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' || $data->{'category_type'} eq 'I' );
106
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' || $data->{'category_type'} eq 'I' );
121
107
122
$template->param( picture => 1 ) if $patron->image;
108
$template->param( picture => 1 ) if $patron->image;
Lines 142-147 $template->param( Link Here
142
    total               => sprintf("%.2f",$total),
128
    total               => sprintf("%.2f",$total),
143
    totalcredit         => $totalcredit,
129
    totalcredit         => $totalcredit,
144
	is_child        => ($data->{'category_type'} eq 'C'),
130
	is_child        => ($data->{'category_type'} eq 'C'),
145
    accounts            => \@accountrows );
131
    accounts            => [$accountline], # FIXME There is always only 1 row!
132
);
146
133
147
output_html_with_http_headers $input, $cookie, $template->output;
134
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printinvoice.pl (-46 / +26 lines)
Lines 29-34 use CGI qw ( -utf8 ); Link Here
29
use C4::Members;
29
use C4::Members;
30
use C4::Accounts;
30
use C4::Accounts;
31
31
32
use Koha::Account::Lines;
32
use Koha::Patrons;
33
use Koha::Patrons;
33
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
34
35
Lines 64-121 if ( $data->{'category_type'} eq 'C' ) { Link Here
64
}
65
}
65
66
66
#get account details
67
#get account details
67
my ( $total, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
68
my $total = $patron->account->balance;
69
my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed;
70
68
my $totalcredit;
71
my $totalcredit;
69
if ( $total <= 0 ) {
72
if ( $total <= 0 ) {
70
    $totalcredit = 1;
73
    $totalcredit = 1;
71
}
74
}
72
75
73
my @accountrows;    # this is for the tmpl-loop
74
75
my $toggle;
76
for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
77
    next if ( $accts->[$i]{'accountlines_id'} ne $accountlines_id );
78
79
    if ( $i % 2 ) {
80
        $toggle = 0;
81
    } else {
82
        $toggle = 1;
83
    }
84
85
    $accts->[$i]{'toggle'} = $toggle;
86
    $accts->[$i]{'amount'} += 0.00;
87
88
    if ( $accts->[$i]{'amount'} <= 0 ) {
89
        $accts->[$i]{'amountcredit'} = 1;
90
    }
91
92
    $accts->[$i]{'amountoutstanding'} += 0.00;
93
    if ( $accts->[$i]{'amountoutstanding'} <= 0 ) {
94
        $accts->[$i]{'amountoutstandingcredit'} = 1;
95
    }
96
97
    my %row = (
98
        'date'                    => output_pref({ dt => dt_from_string( $accts->[$i]{'date'} ), dateonly => 1 }),
99
        'amountcredit'            => $accts->[$i]{'amountcredit'},
100
        'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
101
        'toggle'                  => $accts->[$i]{'toggle'},
102
        'description'             => $accts->[$i]{'description'},
103
        'itemnumber'              => $accts->[$i]{'itemnumber'},
104
        'biblionumber'            => $accts->[$i]{'biblionumber'},
105
        'amount'                  => sprintf( "%.2f", $accts->[$i]{'amount'} ),
106
        'amountoutstanding'       => sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} ),
107
        'accountno'               => $accts->[$i]{'accountno'},
108
        accounttype               => $accts->[$i]{accounttype},
109
        'note'                    => $accts->[$i]{'note'},
110
    );
111
112
    if ( $accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU' ) {
113
        $row{'printtitle'} = 1;
114
        $row{'title'}      = $accts->[$i]{'title'};
115
    }
116
76
117
    push( @accountrows, \%row );
77
$accountline->{'amount'} += 0.00;
78
if ( $accountline->{'amount'} <= 0 ) {
79
    $accountline->{'amountcredit'} = 1;
80
    $accountline->{'amount'} *= -1.00;
118
}
81
}
82
$accountline->{'amountoutstanding'} += 0.00;
83
if ( $accountline->{'amountoutstanding'} <= 0 ) {
84
    $accountline->{'amountoutstandingcredit'} = 1;
85
}
86
87
my %row = (
88
    'date'                    => dt_from_string( $accountline->{'date'}, dateonly => 1 ),
89
    'amountcredit'            => $accountline->{'amountcredit'},
90
    'amountoutstandingcredit' => $accountline->{'amountoutstandingcredit'},
91
    'description'             => $accountline->{'description'},
92
    'amount'                  => sprintf( "%.2f", $accountline->{'amount'} ),
93
    'amountoutstanding' =>
94
      sprintf( "%.2f", $accountline->{'amountoutstanding'} ),
95
    'accountno' => $accountline->{'accountno'},
96
    accounttype => $accountline->{accounttype},
97
    'note'      => $accountline->{'note'},
98
);
119
99
120
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' || $data->{'category_type'} eq 'I' );
100
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' || $data->{'category_type'} eq 'I' );
121
101
Lines 141-147 $template->param( Link Here
141
    total          => sprintf( "%.2f", $total ),
121
    total          => sprintf( "%.2f", $total ),
142
    totalcredit    => $totalcredit,
122
    totalcredit    => $totalcredit,
143
    is_child       => ( $data->{'category_type'} eq 'C' ),
123
    is_child       => ( $data->{'category_type'} eq 'C' ),
144
    accounts       => \@accountrows
124
    accounts       => [$accountline], # FIXME There is always only 1 row!
145
);
125
);
146
126
147
output_html_with_http_headers $input, $cookie, $template->output;
127
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/summary-print.pl (-8 / +5 lines)
Lines 52-65 my $data = $patron->unblessed; Link Here
52
$data->{description} = $category->description;
52
$data->{description} = $category->description;
53
$data->{category_type} = $category->category_type;
53
$data->{category_type} = $category->category_type;
54
54
55
my ( $total, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
55
my $total = $patron->account->balance;
56
foreach my $accountline (@$accts) {
56
my $accts = Koha::Account::Lines->search(
57
    if (   $accountline->{accounttype} ne 'F'
57
    { borrowernumber => $patron->borrowernumber },
58
        && $accountline->{accounttype} ne 'FU' )
58
    { order_by       => { -desc => 'accountlines_id' } }
59
    {
59
);
60
        $accountline->{printtitle} = 1;
61
    }
62
}
63
60
64
our $totalprice = 0;
61
our $totalprice = 0;
65
62
(-)a/opac/opac-account.pl (-20 / +19 lines)
Lines 24-29 use CGI qw ( -utf8 ); Link Here
24
use C4::Members;
24
use C4::Members;
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Output;
26
use C4::Output;
27
use Koha::Account::Lines;
27
use Koha::Patrons;
28
use Koha::Patrons;
28
use Koha::Plugins;
29
use Koha::Plugins;
29
30
Lines 45-76 $borrower->{description} = $category->description; Link Here
45
$borrower->{category_type} = $category->category_type;
46
$borrower->{category_type} = $category->category_type;
46
$template->param( BORROWER_INFO => $borrower );
47
$template->param( BORROWER_INFO => $borrower );
47
48
48
#get account details
49
my $total = $patron->account->balance;
49
my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
50
my $accts = Koha::Account::Lines->search(
51
    { borrowernumber => $patron->borrowernumber },
52
    { order_by       => { -desc => 'accountlines_id' } }
53
);
50
54
51
for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
55
my @accountlines;
52
    $accts->[$i]{'amount'} = sprintf( "%.2f", $accts->[$i]{'amount'} || '0.00');
56
while ( my $line = $accts->next ) {
53
    if ( $accts->[$i]{'amount'} >= 0 ) {
57
    my $accountline = $line->unblessed;
54
        $accts->[$i]{'amountcredit'} = 1;
58
    $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00');
59
    if ( $accountline->{'amount'} >= 0 ) {
60
        $accountline->{'amountcredit'} = 1;
55
    }
61
    }
56
    $accts->[$i]{'amountoutstanding'} =
62
    $accountline->{'amountoutstanding'} =
57
      sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} || '0.00' );
63
      sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' );
58
    if ( $accts->[$i]{'amountoutstanding'} >= 0 ) {
64
    if ( $accountline->{'amountoutstanding'} >= 0 ) {
59
        $accts->[$i]{'amountoutstandingcredit'} = 1;
65
        $accountline->{'amountoutstandingcredit'} = 1;
60
    }
66
    }
61
}
67
    push @accountlines, $accountline;
62
63
# add the row parity
64
my $num = 0;
65
foreach my $row (@$accts) {
66
    $row->{'even'} = 1 if $num % 2 == 0;
67
    $row->{'odd'}  = 1 if $num % 2 == 1;
68
    $num++;
69
}
68
}
70
69
71
$template->param(
70
$template->param(
72
    ACCOUNT_LINES => $accts,
71
    ACCOUNT_LINES => \@accountlines,
73
    total         => sprintf( "%.2f", $total ),
72
    total         => sprintf( "%.2f", $total ), # FIXME Use TT plugin Price
74
    accountview   => 1,
73
    accountview   => 1,
75
    message       => scalar $query->param('message') || q{},
74
    message       => scalar $query->param('message') || q{},
76
    message_value => scalar $query->param('message_value') || q{},
75
    message_value => scalar $query->param('message_value') || q{},
(-)a/opac/opac-main.pl (-11 / +13 lines)
Lines 67-90 my $koha_news_count = scalar @$all_koha_news; Link Here
67
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
67
my $quote = GetDailyQuote();   # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha
68
68
69
# For dashboard
69
# For dashboard
70
if ( defined $borrowernumber ){
70
my $patron = Koha::Patrons->find( $borrowernumber );
71
72
if ( $patron ) {
71
    my $checkouts = Koha::Checkouts->search({ borrowernumber => $borrowernumber })->count;
73
    my $checkouts = Koha::Checkouts->search({ borrowernumber => $borrowernumber })->count;
72
    my ( $overdues_count, $overdues ) = checkoverdues($borrowernumber);
74
    my ( $overdues_count, $overdues ) = checkoverdues($borrowernumber);
73
    my $holds_pending = Koha::Holds->search({ borrowernumber => $borrowernumber, found => undef })->count;
75
    my $holds_pending = Koha::Holds->search({ borrowernumber => $borrowernumber, found => undef })->count;
74
    my $holds_waiting = Koha::Holds->search({ borrowernumber => $borrowernumber })->waiting->count;
76
    my $holds_waiting = Koha::Holds->search({ borrowernumber => $borrowernumber })->waiting->count;
75
    my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
77
78
    my $total = $patron->account->balance;
76
79
77
    if  ( $checkouts > 0 || $overdues_count > 0 || $holds_pending > 0 || $holds_waiting > 0 || $total > 0 ) {
80
    if  ( $checkouts > 0 || $overdues_count > 0 || $holds_pending > 0 || $holds_waiting > 0 || $total > 0 ) {
78
        $template->param( dashboard_info => 1 );
81
        $template->param(
82
            dashboard_info => 1,
83
            checkouts           => $checkouts,
84
            overdues            => $overdues_count,
85
            holds_pending       => $holds_pending,
86
            holds_waiting       => $holds_waiting,
87
            total_owing         => $total,
88
        );
79
    }
89
    }
80
81
    $template->param(
82
        checkouts           => $checkouts,
83
        overdues            => $overdues_count,
84
        holds_pending       => $holds_pending,
85
        holds_waiting       => $holds_waiting,
86
        total_owing         => $total,
87
    );
88
}
90
}
89
91
90
$template->param(
92
$template->param(
(-)a/opac/opac-reserve.pl (-1 / +1 lines)
Lines 330-336 if ( $query->param('place_reserve') ) { Link Here
330
my $noreserves     = 0;
330
my $noreserves     = 0;
331
my $maxoutstanding = C4::Context->preference("maxoutstanding");
331
my $maxoutstanding = C4::Context->preference("maxoutstanding");
332
$template->param( noreserve => 1 ) unless $maxoutstanding;
332
$template->param( noreserve => 1 ) unless $maxoutstanding;
333
my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber);
333
my $amountoutstanding = $patron->account->balance;
334
if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
334
if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
335
    my $amount = sprintf "%.02f", $amountoutstanding;
335
    my $amount = sprintf "%.02f", $amountoutstanding;
336
    $template->param( message => 1 );
336
    $template->param( message => 1 );
(-)a/opac/opac-user.pl (-18 / +29 lines)
Lines 33-38 use C4::Output; Link Here
33
use C4::Biblio;
33
use C4::Biblio;
34
use C4::Items;
34
use C4::Items;
35
use C4::Letters;
35
use C4::Letters;
36
use Koha::Account::Lines;
36
use Koha::Libraries;
37
use Koha::Libraries;
37
use Koha::DateUtils;
38
use Koha::DateUtils;
38
use Koha::Holds;
39
use Koha::Holds;
Lines 88-94 if (!$borrowernumber) { Link Here
88
}
89
}
89
90
90
# get borrower information ....
91
# get borrower information ....
91
my $borr = Koha::Patrons->find( $borrowernumber )->unblessed;
92
my $patron = Koha::Patrons->find( $borrowernumber );
93
my $borr = $patron->unblessed;
92
94
93
my (  $today_year,   $today_month,   $today_day) = Today();
95
my (  $today_year,   $today_month,   $today_day) = Today();
94
my ($warning_year, $warning_month, $warning_day) = split /-/, $borr->{'dateexpiry'};
96
my ($warning_year, $warning_month, $warning_day) = split /-/, $borr->{'dateexpiry'};
Lines 116-122 if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { Link Here
116
    $canrenew = 0;
118
    $canrenew = 0;
117
}
119
}
118
120
119
my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber);
121
my $amountoutstanding = $patron->account->balance;
120
if ( $amountoutstanding > 5 ) {
122
if ( $amountoutstanding > 5 ) {
121
    $borr->{'amountoverfive'} = 1;
123
    $borr->{'amountoverfive'} = 1;
122
}
124
}
Lines 187-209 if ($issues){ Link Here
187
            $issue->{'reserved'} = 1;
189
            $issue->{'reserved'} = 1;
188
        }
190
        }
189
191
190
        my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
192
        # Must be moved in a module if reused
191
        my $charges = 0;
193
        my $charges = Koha::Account::Lines->search(
192
        my $rentalfines = 0;
194
            {
193
        foreach my $ac (@$accts) {
195
                borrowernumber    => $patron->borrowernumber,
194
            if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
196
                amountoutstanding => { '>' => 0 },
195
                $charges += $ac->{'amountoutstanding'}
197
                accounttype       => [ 'F', 'FU', 'L' ],
196
                  if $ac->{'accounttype'} eq 'F';
198
                itemnumber        => $issue->{itemnumber}
197
                $charges += $ac->{'amountoutstanding'}
199
            },
198
                  if $ac->{'accounttype'} eq 'FU';
200
            { select => [ { sum => 'amountoutstanding' } ], as => ['charges'] }
199
                $charges += $ac->{'amountoutstanding'}
201
        );
200
                  if $ac->{'accounttype'} eq 'L';
202
        $issue->{charges} = $charges->count ? $charges->next->get_column('charges') : 0;
201
                $rentalfines += $ac->{'amountoutstanding'}
203
202
                  if $ac->{'accounttype'} eq 'Rent';
204
        my $rental_fines = Koha::Account::Lines->search(
205
            {
206
                borrowernumber    => $patron->borrowernumber,
207
                amountoutstanding => { '>' => 0 },
208
                accounttype       => 'Rent',
209
                itemnumber        => $issue->{itemnumber}
210
            },
211
            {
212
                select => [ { sum => 'amountoutstanding' } ],
213
                as     => ['rental_fines']
203
            }
214
            }
204
        }
215
        );
205
        $issue->{'charges'} = $charges;
216
        $issue->{rentalfines} = $charges->count ? $charges->next->get_column('rental_fines') : 0;
206
        $issue->{'rentalfines'} = $rentalfines;
217
207
        my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} });
218
        my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} });
208
        $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'}));
219
        $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'}));
209
        # check if item is renewable
220
        # check if item is renewable
(-)a/reserve/request.pl (-1 / +2 lines)
Lines 180-185 if ($borrowernumber_hold && !$action) { Link Here
180
    }
180
    }
181
181
182
    my $is_debarred = $patron->is_debarred;
182
    my $is_debarred = $patron->is_debarred;
183
    my $amount_outstanding = $patron->account->balance;
183
    $template->param(
184
    $template->param(
184
                borrowernumber      => $patron->borrowernumber,
185
                borrowernumber      => $patron->borrowernumber,
185
                borrowersurname     => $patron->surname,
186
                borrowersurname     => $patron->surname,
Lines 198-204 if ($borrowernumber_hold && !$action) { Link Here
198
                messages            => $messages,
199
                messages            => $messages,
199
                warnings            => $warnings,
200
                warnings            => $warnings,
200
                restricted          => $is_debarred,
201
                restricted          => $is_debarred,
201
                amount_outstanding  => GetMemberAccountRecords($patron->borrowernumber),
202
                amount_outstanding  => $amount_outstanding,
202
    );
203
    );
203
}
204
}
204
205
(-)a/t/db_dependent/Koha/Patrons.t (-10 / +10 lines)
Lines 400-413 subtest 'add_enrolment_fee_if_needed' => sub { Link Here
400
    my $borrowernumber = C4::Members::AddMember(%borrower_data);
400
    my $borrowernumber = C4::Members::AddMember(%borrower_data);
401
    $borrower_data{borrowernumber} = $borrowernumber;
401
    $borrower_data{borrowernumber} = $borrowernumber;
402
402
403
    my ($total) = C4::Members::GetMemberAccountRecords($borrowernumber);
403
    my $patron = Koha::Patrons->find( $borrowernumber );
404
    is( $total, $enrolmentfee_K, "New kid pay $enrolmentfee_K" );
404
    my $total = $patron->account->balance;
405
    is( int($total), int($enrolmentfee_K), "New kid pay $enrolmentfee_K" );
405
406
406
    t::lib::Mocks::mock_preference( 'FeeOnChangePatronCategory', 0 );
407
    t::lib::Mocks::mock_preference( 'FeeOnChangePatronCategory', 0 );
407
    $borrower_data{categorycode} = 'J';
408
    $borrower_data{categorycode} = 'J';
408
    C4::Members::ModMember(%borrower_data);
409
    C4::Members::ModMember(%borrower_data);
409
    ($total) = C4::Members::GetMemberAccountRecords($borrowernumber);
410
    $total = $patron->account->balance;
410
    is( $total, $enrolmentfee_K, "Kid growing and become a juvenile, but shouldn't pay for the upgrade " );
411
    is( int($total), int($enrolmentfee_K), "Kid growing and become a juvenile, but shouldn't pay for the upgrade " );
411
412
412
    $borrower_data{categorycode} = 'K';
413
    $borrower_data{categorycode} = 'K';
413
    C4::Members::ModMember(%borrower_data);
414
    C4::Members::ModMember(%borrower_data);
Lines 415-430 subtest 'add_enrolment_fee_if_needed' => sub { Link Here
415
416
416
    $borrower_data{categorycode} = 'J';
417
    $borrower_data{categorycode} = 'J';
417
    C4::Members::ModMember(%borrower_data);
418
    C4::Members::ModMember(%borrower_data);
418
    ($total) = C4::Members::GetMemberAccountRecords($borrowernumber);
419
    $total = $patron->account->balance;
419
    is( $total, $enrolmentfee_K + $enrolmentfee_J, "Kid growing and become a juvenile, they should pay " . ( $enrolmentfee_K + $enrolmentfee_J ) );
420
    is( int($total), int($enrolmentfee_K + $enrolmentfee_J), "Kid growing and become a juvenile, they should pay " . ( $enrolmentfee_K + $enrolmentfee_J ) );
420
421
421
    # Check with calling directly Koha::Patron->get_enrolment_fee_if_needed
422
    # Check with calling directly Koha::Patron->get_enrolment_fee_if_needed
422
    my $patron = Koha::Patrons->find($borrowernumber);
423
    $patron->categorycode('YA')->store;
423
    $patron->categorycode('YA')->store;
424
    my $fee = $patron->add_enrolment_fee_if_needed;
424
    my $fee = $patron->add_enrolment_fee_if_needed;
425
    ($total) = C4::Members::GetMemberAccountRecords($borrowernumber);
425
    $total = $patron->account->balance;
426
    is( $total,
426
    is( int($total),
427
        $enrolmentfee_K + $enrolmentfee_J + $enrolmentfee_YA,
427
        int($enrolmentfee_K + $enrolmentfee_J + $enrolmentfee_YA),
428
        "Juvenile growing and become an young adult, they should pay " . ( $enrolmentfee_K + $enrolmentfee_J + $enrolmentfee_YA )
428
        "Juvenile growing and become an young adult, they should pay " . ( $enrolmentfee_K + $enrolmentfee_J + $enrolmentfee_YA )
429
    );
429
    );
430
430
(-)a/t/db_dependent/Members.t (-31 / +1 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 62;
20
use Test::More tests => 61;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Exception;
22
use Test::Exception;
23
23
Lines 373-407 ok( $borrower->{userid}, 'A userid should have been generated correctly' ); Link Here
373
is( Check_Userid( C4::Context->config('user'), '' ), 0,
373
is( Check_Userid( C4::Context->config('user'), '' ), 0,
374
    'Check_Userid should return 0 for the DB user (Bug 12226)');
374
    'Check_Userid should return 0 for the DB user (Bug 12226)');
375
375
376
subtest 'GetMemberAccountRecords' => sub {
377
378
    plan tests => 2;
379
380
    my $borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber };
381
    my $accountline_1  = $builder->build({
382
        source => 'Accountline',
383
        value  => {
384
            borrowernumber    => $borrowernumber,
385
            amountoutstanding => 64.60
386
        }
387
    });
388
389
    my ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber );
390
    is( $total , 64.60, "Rounding works correctly in total calculation (single value)" );
391
392
    my $accountline_2 = $builder->build({
393
        source => 'Accountline',
394
        value  => {
395
            borrowernumber    => $borrowernumber,
396
            amountoutstanding => 10.65
397
        }
398
    });
399
400
    ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber );
401
    is( $total , 75.25, "Rounding works correctly in total calculation (multiple values)" );
402
403
};
404
405
subtest 'GetMemberAccountBalance' => sub {
376
subtest 'GetMemberAccountBalance' => sub {
406
377
407
    plan tests => 6;
378
    plan tests => 6;
408
- 

Return to bug 12001