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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 729-735 sub CanBookBeIssued { Link Here
729
729
730
    # DEBTS
730
    # DEBTS
731
    my ($amount) =
731
    my ($amount) =
732
      C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'}, '' && $duedate->output('iso') );
732
      C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'}, 'FINES ONLY' );
733
    my $amountlimit = C4::Context->preference("noissuescharge");
733
    my $amountlimit = C4::Context->preference("noissuescharge");
734
    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
734
    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
735
    my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride");
735
    my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride");
(-)a/C4/Members.pm (-8 / +12 lines)
Lines 420-426 sub patronflags { Link Here
420
    my %flags;
420
    my %flags;
421
    my ( $patroninformation) = @_;
421
    my ( $patroninformation) = @_;
422
    my $dbh=C4::Context->dbh;
422
    my $dbh=C4::Context->dbh;
423
    my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'});
423
    my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'}, 'FINES ONLY');
424
    if ( $amount > 0 ) {
424
    if ( $amount > 0 ) {
425
        my %flaginfo;
425
        my %flaginfo;
426
        my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
426
        my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
Lines 1094-1100 sub GetAllIssues { Link Here
1094
1094
1095
=head2 GetMemberAccountRecords
1095
=head2 GetMemberAccountRecords
1096
1096
1097
  ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber);
1097
  ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber, $fines_only);
1098
1098
1099
Looks up accounting data for the patron with the given borrowernumber.
1099
Looks up accounting data for the patron with the given borrowernumber.
1100
1100
Lines 1104-1114 keys are the fields of the C<accountlines> table in the Koha database. Link Here
1104
C<$count> is the number of elements in C<$acctlines>. C<$total> is the
1104
C<$count> is the number of elements in C<$acctlines>. C<$total> is the
1105
total amount outstanding for all of the account lines.
1105
total amount outstanding for all of the account lines.
1106
1106
1107
If C<$fines_only> flag is set to true, only fines are taken in account
1108
1107
=cut
1109
=cut
1108
1110
1109
#'
1111
#'
1110
sub GetMemberAccountRecords {
1112
sub GetMemberAccountRecords {
1111
    my ($borrowernumber,$date) = @_;
1113
    my ($borrowernumber, $fines_only) = @_;
1112
    my $dbh = C4::Context->dbh;
1114
    my $dbh = C4::Context->dbh;
1113
    my @acctlines;
1115
    my @acctlines;
1114
    my $numlines = 0;
1116
    my $numlines = 0;
Lines 1116-1129 sub GetMemberAccountRecords { Link Here
1116
                        SELECT * 
1118
                        SELECT * 
1117
                        FROM accountlines 
1119
                        FROM accountlines 
1118
                        WHERE borrowernumber=?);
1120
                        WHERE borrowernumber=?);
1119
    my @bind = ($borrowernumber);
1121
    if ($fines_only) {
1120
    if ($date && $date ne ''){
1122
        $strsth .= " AND accounttype NOT IN (
1121
            $strsth.=" AND date < ? ";
1123
                         'Res',
1122
            push(@bind,$date);
1124
                         'Rent',
1125
                         (SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV')
1126
                     )";
1123
    }
1127
    }
1124
    $strsth.=" ORDER BY date desc,timestamp DESC";
1128
    $strsth.=" ORDER BY date desc,timestamp DESC";
1125
    my $sth= $dbh->prepare( $strsth );
1129
    my $sth= $dbh->prepare( $strsth );
1126
    $sth->execute( @bind );
1130
    $sth->execute( $borrowernumber );
1127
    my $total = 0;
1131
    my $total = 0;
1128
    while ( my $data = $sth->fetchrow_hashref ) {
1132
    while ( my $data = $sth->fetchrow_hashref ) {
1129
        if ( $data->{itemnumber} ) {
1133
        if ( $data->{itemnumber} ) {
(-)a/circ/circulation.pl (-8 / +6 lines)
Lines 188-195 if ( $print eq 'yes' && $borrowernumber ne '' ) { Link Here
188
my $borrowerslist;
188
my $borrowerslist;
189
my $message;
189
my $message;
190
if ($findborrower) {
190
if ($findborrower) {
191
    my $borrowers = Search($findborrower, 'cardnumber');
191
    my $borrowers = Search($findborrower, 'cardnumber') || [];
192
    my @borrowers = @$borrowers;
193
    if (C4::Context->preference("AddPatronLists")) {
192
    if (C4::Context->preference("AddPatronLists")) {
194
        $template->param(
193
        $template->param(
195
            "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
194
            "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
Lines 200-216 if ($findborrower) { Link Here
200
            $template->param(categories=>$categories);
199
            $template->param(categories=>$categories);
201
        }
200
        }
202
    }
201
    }
203
    if ( $#borrowers == -1 ) {
202
    if ( @$borrowers == 0 ) {
204
        $query->param( 'findborrower', '' );
203
        $query->param( 'findborrower', '' );
205
        $message = "'$findborrower'";
204
        $message = "'$findborrower'";
206
    }
205
    }
207
    elsif ( $#borrowers == 0 ) {
206
    elsif ( @$borrowers == 1 ) {
208
        $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} );
207
        $borrowernumber = $borrowers->[0]->{'borrowernumber'};
208
        $query->param( 'borrowernumber', $borrowernumber );
209
        $query->param( 'barcode',           '' );
209
        $query->param( 'barcode',           '' );
210
        $borrowernumber = $borrowers[0]->{'borrowernumber'};
211
    }
210
    }
212
    else {
211
    else {
213
        $borrowerslist = \@borrowers;
212
        $borrowerslist = $borrowers;
214
    }
213
    }
215
}
214
}
216
215
217
- 

Return to bug 7243