Show
Ignore:
Timestamp:
11/23/03 20:01:37 (20 years ago)
Author:
jalet
Message:

Job price added to history

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/pgstorage.py

    r1200 r1203  
    2222# 
    2323# $Log$ 
     24# Revision 1.23  2003/11/23 19:01:37  jalet 
     25# Job price added to history 
     26# 
    2427# Revision 1.22  2003/11/21 14:28:46  jalet 
    2528# More complete job history. 
     
    282285        """Extracts a printer's last job information.""" 
    283286        lastjob = StorageLastJob(self, printer) 
    284         result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, jobdate FROM jobhistory, users WHERE printerid=%s AND userid=users.id ORDER BY jobdate DESC LIMIT 1" % self.doQuote(printer.ident)) 
     287        result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, jobprice, filename, title, copies, options, jobdate FROM jobhistory, users WHERE printerid=%s AND userid=users.id ORDER BY jobdate DESC LIMIT 1" % self.doQuote(printer.ident)) 
    285288        if result : 
    286289            fields = result[0] 
     
    290293            lastjob.PrinterPageCounter = fields.get("pagecounter") 
    291294            lastjob.JobSize = fields.get("jobsize") 
     295            lastjob.JobPrice = fields.get("jobprice") 
    292296            lastjob.JobAction = fields.get("action") 
     297            lastjob.JobFileName = fields.get("filename") 
     298            lastjob.JobTitle = fields.get("title") 
     299            lastjob.JobCopies = fields.get("copies") 
     300            lastjob.JobOptions = fields.get("options") 
    293301            lastjob.JobDate = fields.get("jobdate") 
    294302            lastjob.Exists = 1 
     
    446454           self.doModify("UPDATE users SET balance=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(user.ident))) 
    447455             
    448     def writeLastJobSize(self, lastjob, jobsize) :         
     456    def writeLastJobSize(self, lastjob, jobsize, jobprice) :         
    449457        """Sets the last job's size permanently.""" 
    450         self.doModify("UPDATE jobhistory SET jobsize=%s WHERE id=%s" % (self.doQuote(jobsize), self.doQuote(lastjob.ident))) 
    451          
    452     def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, filename=None, title=None, copies=None, options=None) :     
     458        self.doModify("UPDATE jobhistory SET jobsize=%s, jobprice=%s WHERE id=%s" % (self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(lastjob.ident))) 
     459         
     460    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None) :     
    453461        """Adds a job in a printer's history.""" 
    454462        if (not self.disablehistory) or (not printer.LastJob.Exists) : 
    455463            if jobsize is not None : 
    456                 self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options))) 
     464                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize, jobprice, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options))) 
    457465            else :     
    458466                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options))) 
    459467        else :         
    460468            # here we explicitly want to reset jobsize to NULL if needed 
    461             self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(printer.LastJob.ident))) 
     469            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobprice=%s, filename=%s, title=%s, copies=%s, options=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options), self.doQuote(printer.LastJob.ident))) 
    462470             
    463471    def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) :