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 1119-1125 sub GetAllIssues { Link Here
1119
1119
1120
=head2 GetMemberAccountRecords
1120
=head2 GetMemberAccountRecords
1121
1121
1122
  ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber);
1122
  ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber, $fines_only);
1123
1123
1124
Looks up accounting data for the patron with the given borrowernumber.
1124
Looks up accounting data for the patron with the given borrowernumber.
1125
1125
Lines 1129-1139 keys are the fields of the C<accountlines> table in the Koha database. Link Here
1129
C<$count> is the number of elements in C<$acctlines>. C<$total> is the
1129
C<$count> is the number of elements in C<$acctlines>. C<$total> is the
1130
total amount outstanding for all of the account lines.
1130
total amount outstanding for all of the account lines.
1131
1131
1132
If C<$fines_only> flag is set to true, only fines are taken in account
1133
1132
=cut
1134
=cut
1133
1135
1134
#'
1136
#'
1135
sub GetMemberAccountRecords {
1137
sub GetMemberAccountRecords {
1136
    my ($borrowernumber,$date) = @_;
1138
    my ($borrowernumber, $fines_only) = @_;
1137
    my $dbh = C4::Context->dbh;
1139
    my $dbh = C4::Context->dbh;
1138
    my @acctlines;
1140
    my @acctlines;
1139
    my $numlines = 0;
1141
    my $numlines = 0;
Lines 1141-1154 sub GetMemberAccountRecords { Link Here
1141
                        SELECT * 
1143
                        SELECT * 
1142
                        FROM accountlines 
1144
                        FROM accountlines 
1143
                        WHERE borrowernumber=?);
1145
                        WHERE borrowernumber=?);
1144
    my @bind = ($borrowernumber);
1146
    if ($fines_only) {
1145
    if ($date && $date ne ''){
1147
        $strsth .= " AND accounttype NOT IN (
1146
            $strsth.=" AND date < ? ";
1148
                         'Res',
1147
            push(@bind,$date);
1149
                         'Rent',
1150
                         (SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV')
1151
                     )";
1148
    }
1152
    }
1149
    $strsth.=" ORDER BY date desc,timestamp DESC";
1153
    $strsth.=" ORDER BY date desc,timestamp DESC";
1150
    my $sth= $dbh->prepare( $strsth );
1154
    my $sth= $dbh->prepare( $strsth );
1151
    $sth->execute( @bind );
1155
    $sth->execute( $borrowernumber );
1152
    my $total = 0;
1156
    my $total = 0;
1153
    while ( my $data = $sth->fetchrow_hashref ) {
1157
    while ( my $data = $sth->fetchrow_hashref ) {
1154
        if ( $data->{itemnumber} ) {
1158
        if ( $data->{itemnumber} ) {
(-)a/circ/circulation.pl (-8 / +6 lines)
Lines 187-194 if ( $print eq 'yes' && $borrowernumber ne '' ) { Link Here
187
my $borrowerslist;
187
my $borrowerslist;
188
my $message;
188
my $message;
189
if ($findborrower) {
189
if ($findborrower) {
190
    my $borrowers = Search($findborrower, 'cardnumber');
190
    my $borrowers = Search($findborrower, 'cardnumber') || [];
191
    my @borrowers = @$borrowers;
192
    if (C4::Context->preference("AddPatronLists")) {
191
    if (C4::Context->preference("AddPatronLists")) {
193
        $template->param(
192
        $template->param(
194
            "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
193
            "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
Lines 199-215 if ($findborrower) { Link Here
199
            $template->param(categories=>$categories);
198
            $template->param(categories=>$categories);
200
        }
199
        }
201
    }
200
    }
202
    if ( $#borrowers == -1 ) {
201
    if ( @$borrowers == 0 ) {
203
        $query->param( 'findborrower', '' );
202
        $query->param( 'findborrower', '' );
204
        $message = "'$findborrower'";
203
        $message = "'$findborrower'";
205
    }
204
    }
206
    elsif ( $#borrowers == 0 ) {
205
    elsif ( @$borrowers == 1 ) {
207
        $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} );
206
        $borrowernumber = $borrowers->[0]->{'borrowernumber'};
207
        $query->param( 'borrowernumber', $borrowernumber );
208
        $query->param( 'barcode',           '' );
208
        $query->param( 'barcode',           '' );
209
        $borrowernumber = $borrowers[0]->{'borrowernumber'};
210
    }
209
    }
211
    else {
210
    else {
212
        $borrowerslist = \@borrowers;
211
        $borrowerslist = $borrowers;
213
    }
212
    }
214
}
213
}
215
214
216
- 

Return to bug 7243