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