Show
Ignore:
Timestamp:
11/13/06 23:24:01 (17 years ago)
Author:
jerome
Message:

The code to refund jobs is there and works (at least with PostgreSQL).
Only the pkrefund command line tool (and CGI script ?) is missing.

Files:
1 modified

Legend:

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

    r2949 r3056  
    688688        self.doModify("UPDATE billingcodes SET balance=balance + %s, pagecounter=pagecounter + %s WHERE id=%s" % (self.doQuote(balance), self.doQuote(pagecounter), self.doQuote(bcode.ident))) 
    689689        
     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         
    690694    def decreaseUserAccountBalance(self, user, amount) :     
    691695        """Decreases user's account balance from an amount.""" 
     
    763767        self.doModify("DELETE FROM printergroupsmembers WHERE groupid=%s AND printerid=%s" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident))) 
    764768         
    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) : 
    766770        """Retrieves all print jobs for user on printer (or all) between start and end date, limited to first 100 results.""" 
    767771        query = "SELECT jobhistory.*,username,printername FROM jobhistory,users,printers WHERE users.id=userid AND printers.id=printerid" 
     
    775779        if billingcode is not None :     
    776780            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. 
    777783        if start is not None :     
    778784            where.append("jobdate>=%s" % self.doQuote(start))