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} ) { |