Changeset 2220

Show
Ignore:
Timestamp:
04/28/05 09:20:20 (19 years ago)
Author:
jerome
Message:

Job's billing code is now clicable in the print job
history viewed from the CGI script

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/cgi-bin/printquota.cgi

    r2210 r2220  
    183183            else :     
    184184                hostname = None 
     185            if self.form.has_key("billingcode") :     
     186                billingcode = self.form["billingcode"].value 
     187            else :     
     188                billingcode = None 
    185189            self.report = ["<h2>%s</h2>" % _("History")]     
    186             history = self.storage.retrieveHistory(user, printer, datelimit, hostname) 
     190            history = self.storage.retrieveHistory(user, printer, datelimit, hostname, billingcode) 
    187191            if not history : 
    188192                self.report.append("<h3>%s</h3>" % _("Empty")) 
     
    213217                    else :     
    214218                        hostname_url = None 
    215                     self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % (h or "&nbsp;") for h in (job.JobDate[:19], job.JobAction, username_url, printername_url, hostname_url, job.JobId, job.JobSize, job.JobPrice, job.JobCopies, job.JobSizeBytes, job.PrinterPageCounter, job.JobTitle, job.JobFileName, job.JobOptions, job.JobMD5Sum, job.JobBillingCode, job.JobPages)]))) 
     219                    if job.JobBillingCode : 
     220                        billingcode_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "billingcode" : job.JobBillingCode}), job.JobBillingCode) 
     221                    else :     
     222                        billingcode_url = None 
     223                    self.report.append('<tr class="%s">%s</tr>' % \ 
     224                                          (oddevenclass, \ 
     225                                           "".join(["<td>%s</td>" % (h or "&nbsp;") \ 
     226                                              for h in (job.JobDate[:19], \ 
     227                                                        job.JobAction, \ 
     228                                                        username_url, \ 
     229                                                        printername_url, \ 
     230                                                        hostname_url, \ 
     231                                                        job.JobId, \ 
     232                                                        job.JobSize, \ 
     233                                                        job.JobPrice, \ 
     234                                                        job.JobCopies, \ 
     235                                                        job.JobSizeBytes, \ 
     236                                                        job.PrinterPageCounter, \ 
     237                                                        job.JobTitle, \ 
     238                                                        job.JobFileName, \ 
     239                                                        job.JobOptions, \ 
     240                                                        job.JobMD5Sum, \ 
     241                                                        billingcode_url, \ 
     242                                                        job.JobPages)]))) 
    216243                self.report.append('</table>') 
    217244                dico = { "history" : 1, 
  • pykota/trunk/NEWS

    r2219 r2220  
    2424    - 1.22alpha8 : 
    2525     
     26        - Clicking on the billing code in printquota.cgi's job history 
     27          now shows all jobs matching this billing code. 
     28           
    2629        - Fixed the dump in CUPS' page_log format which didn't 
    2730          dump the oldest entry. 
  • pykota/trunk/pykota/storages/sql.py

    r2218 r2220  
    498498        self.doModify("DELETE FROM printergroupsmembers WHERE groupid=%s AND printerid=%s" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident))) 
    499499         
    500     def retrieveHistory(self, user=None, printer=None, datelimit=None, hostname=None, limit=100) :     
     500    def retrieveHistory(self, user=None, printer=None, datelimit=None, hostname=None, billingcode=None, limit=100) : 
    501501        """Retrieves all print jobs for user on printer (or all) before date, limited to first 100 results.""" 
    502502        query = "SELECT jobhistory.*,username,printername FROM jobhistory,users,printers WHERE users.id=userid AND printers.id=printerid" 
     
    508508        if hostname is not None :     
    509509            where.append("hostname=%s" % self.doQuote(hostname)) 
     510        if billingcode is not None :     
     511            where.append("billingcode=%s" % self.doQuote(self.userCharsetToDatabase(billingcode))) 
    510512        if datelimit is not None :     
    511513            where.append("jobdate<=%s" % self.doQuote(datelimit))