Show
Ignore:
Timestamp:
03/04/13 05:52:27 (9 years ago)
Author:
jerome
Message:

Don't output reports anymore for printers without any print quota entry.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/reporters/text.py

    r3561 r3568  
    3535            prefix = "User" 
    3636        for printer in self.printers : 
    37             self.report.append(self.getPrinterTitle(printer)) 
    38             self.report.append(self.getPrinterGraceDelay(printer)) 
    39             (pjob, ppage) = self.getPrinterPrices(printer) 
    40             self.report.append(pjob) 
    41             self.report.append(ppage) 
     37            entries = getattr(self.tool.storage, "getPrinter%ssAndQuotas" % prefix)(printer, self.ugnames) 
     38            if entries : 
     39                self.report.append(self.getPrinterTitle(printer)) 
     40                self.report.append(self.getPrinterGraceDelay(printer)) 
     41                (pjob, ppage) = self.getPrinterPrices(printer) 
     42                self.report.append(pjob) 
     43                self.report.append(ppage) 
    4244 
    43             total = 0 
    44             totalmoney = 0.0 
    45             header = self.getReportHeader() 
    46             self.report.append(header) 
    47             self.report.append('-' * len(header)) 
    48             for (entry, entrypquota) in getattr(self.tool.storage, "getPrinter%ssAndQuotas" % prefix)(printer, self.ugnames) : 
    49                 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid, overcharge, warncount) = self.getQuota(entry, entrypquota) 
    50                 self.report.append("%-15.15s %s %5s %7i %7s %7s %10s %-10.10s %8i %10s %4s" % (name, reached, overcharge, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid, warncount)) 
    51                 total += pages 
    52                 totalmoney += money 
     45                total = 0 
     46                totalmoney = 0.0 
     47                header = self.getReportHeader() 
     48                self.report.append(header) 
     49                self.report.append('-' * len(header)) 
     50                for (entry, entrypquota) in entries : 
     51                    (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid, overcharge, warncount) = self.getQuota(entry, entrypquota) 
     52                    self.report.append("%-15.15s %s %5s %7i %7s %7s %10s %-10.10s %8i %10s %4s" % (name, reached, overcharge, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid, warncount)) 
     53                    total += pages 
     54                    totalmoney += money 
    5355 
    54             if total or totalmoney : 
    55                 (tpage, tmoney) = self.getTotals(total, totalmoney) 
    56                 self.report.append((" " * 62) + tpage + tmoney) 
    57             self.report.append((" " * 63) + self.getPrinterRealPageCounter(printer)) 
    58             self.report.append("") 
     56                if total or totalmoney : 
     57                    (tpage, tmoney) = self.getTotals(total, totalmoney) 
     58                    self.report.append((" " * 62) + tpage + tmoney) 
     59                self.report.append((" " * 63) + self.getPrinterRealPageCounter(printer)) 
     60                self.report.append("") 
    5961        if self.isgroup : 
    6062            self.report.append(_("Totals may be inaccurate if some users are members of several groups."))