Changeset 1203 for pykota/trunk/pykota/storages/pgstorage.py
- Timestamp:
- 11/23/03 20:01:37 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/pgstorage.py
r1200 r1203 22 22 # 23 23 # $Log$ 24 # Revision 1.23 2003/11/23 19:01:37 jalet 25 # Job price added to history 26 # 24 27 # Revision 1.22 2003/11/21 14:28:46 jalet 25 28 # More complete job history. … … 282 285 """Extracts a printer's last job information.""" 283 286 lastjob = StorageLastJob(self, printer) 284 result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, job date 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)) 285 288 if result : 286 289 fields = result[0] … … 290 293 lastjob.PrinterPageCounter = fields.get("pagecounter") 291 294 lastjob.JobSize = fields.get("jobsize") 295 lastjob.JobPrice = fields.get("jobprice") 292 296 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") 293 301 lastjob.JobDate = fields.get("jobdate") 294 302 lastjob.Exists = 1 … … 446 454 self.doModify("UPDATE users SET balance=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(user.ident))) 447 455 448 def writeLastJobSize(self, lastjob, jobsize ) :456 def writeLastJobSize(self, lastjob, jobsize, jobprice) : 449 457 """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) : 453 461 """Adds a job in a printer's history.""" 454 462 if (not self.disablehistory) or (not printer.LastJob.Exists) : 455 463 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))) 457 465 else : 458 466 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))) 459 467 else : 460 468 # 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, job date=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))) 462 470 463 471 def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) :