Changeset 3056 for pykota/trunk/pykota/storages
- Timestamp:
- 11/13/06 23:24:01 (17 years ago)
- Location:
- pykota/trunk/pykota/storages
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r2953 r3056 1303 1303 self.doModify(pgroup.ident, fields) 1304 1304 1305 def retrieveHistory(self, user=None, printer=None, hostname=None, billingcode=None, limit=100, start=None, end=None) :1305 def retrieveHistory(self, user=None, printer=None, hostname=None, billingcode=None, jobid=None, limit=100, start=None, end=None) : 1306 1306 """Retrieves all print jobs for user on printer (or all) between start and end date, limited to first 100 results.""" 1307 1307 precond = "(objectClass=pykotaJob)" … … 1315 1315 if billingcode is not None : 1316 1316 where.append("(pykotaBillingCode=%s)" % self.userCharsetToDatabase(billingcode)) 1317 if jobid is not None : 1318 where.append("(pykotaJobId=%s)" % jobid) # TODO : jobid is text, so self.userCharsetToDatabase(jobid) but do all of them as well. 1317 1319 if where : 1318 1320 where = "(&%s)" % "".join([precond] + where) … … 1778 1780 return self.doModify(bcode.ident, fields) 1779 1781 1782 def refundJob(self, jobident) : 1783 """Marks a job as refunded in the history.""" 1784 dn = "cn=%s,%s" % (ident, self.info["jobbase"]) 1785 fields = { 1786 "pykotaAction" : "REFUND", 1787 } 1788 self.doModify(dn, fields) 1789 1780 1790 def storageUserFromRecord(self, username, record) : 1781 1791 """Returns a StorageUser instance from a database record.""" -
pykota/trunk/pykota/storages/sql.py
r2949 r3056 688 688 self.doModify("UPDATE billingcodes SET balance=balance + %s, pagecounter=pagecounter + %s WHERE id=%s" % (self.doQuote(balance), self.doQuote(pagecounter), self.doQuote(bcode.ident))) 689 689 690 def refundJob(self, jobident) : 691 """Marks a job as refunded in the history.""" 692 self.doModify("UPDATE jobhistory SET action='REFUND' WHERE id=%s;" % self.doQuote(jobident)) 693 690 694 def decreaseUserAccountBalance(self, user, amount) : 691 695 """Decreases user's account balance from an amount.""" … … 763 767 self.doModify("DELETE FROM printergroupsmembers WHERE groupid=%s AND printerid=%s" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident))) 764 768 765 def retrieveHistory(self, user=None, printer=None, hostname=None, billingcode=None, limit=100, start=None, end=None) :769 def retrieveHistory(self, user=None, printer=None, hostname=None, billingcode=None, jobid=None, limit=100, start=None, end=None) : 766 770 """Retrieves all print jobs for user on printer (or all) between start and end date, limited to first 100 results.""" 767 771 query = "SELECT jobhistory.*,username,printername FROM jobhistory,users,printers WHERE users.id=userid AND printers.id=printerid" … … 775 779 if billingcode is not None : 776 780 where.append("billingcode=%s" % self.doQuote(self.userCharsetToDatabase(billingcode))) 781 if jobid is not None : 782 where.append("jobid=%s" % self.doQuote(jobid)) # TODO : jobid is text, so self.userCharsetToDatabase(jobid) but do all of them as well. 777 783 if start is not None : 778 784 where.append("jobdate>=%s" % self.doQuote(start))