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

(-)a/members/paycollect.pl (-9 / +14 lines)
Lines 145-165 if ( $selected_accts ) { Link Here
145
    }
145
    }
146
    my @acc = split /,/, $selected_accts;
146
    my @acc = split /,/, $selected_accts;
147
147
148
    my $selected_accountlines = Koha::Account::Lines->search(
148
    my $search_params = {
149
        {
149
        borrowernumber    => $borrowernumber,
150
            borrowernumber    => $borrowernumber,
151
            amountoutstanding => { '<>' => 0 },
150
            amountoutstanding => { '<>' => 0 },
152
            accountlines_id   => { 'in' => \@acc },
151
            accountlines_id   => { 'in' => \@acc },
153
        },
152
    };
153
154
    my @selected_accountlines = Koha::Account::Lines->search(
155
        $search_params,
154
        { order_by => 'date' }
156
        { order_by => 'date' }
155
    );
157
    );
156
158
157
    $total_due = $selected_accountlines->_resultset->get_column('amountoutstanding')->sum();
159
    my $sum = Koha::Account::Lines->search(
158
160
        $search_params,
159
    @selected_accountlines = $selected_accountlines->as_list;
161
        {
162
            select => [ { sum => 'amountoutstanding' } ],
163
            as     => [ 'total_amountoutstanding'],
164
        }
165
    );
166
    $total_due = $sum->_resultset->first->get_column('total_amountoutstanding');
160
}
167
}
161
168
162
163
if ( $total_paid and $total_paid ne '0.00' ) {
169
if ( $total_paid and $total_paid ne '0.00' ) {
164
    $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
170
    $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
165
    if ( $total_paid < 0 or $total_paid > $total_due ) {
171
    if ( $total_paid < 0 or $total_paid > $total_due ) {
166
- 

Return to bug 26076