Show
Ignore:
Timestamp:
07/27/05 15:17:28 (19 years ago)
Author:
jerome
Message:

Fixed an LDAP filtering problem when several billing codes were passed on pkbcodes' command line.
The unknown_billingcode directive now works as expected.
The billing code's page counter and balance are updated when printing.
Severity : If you need full management of billing codes, this is for you.

Location:
pykota/trunk/pykota/storages
Files:
2 modified

Legend:

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

    r2386 r2388  
    14201420        """Returns the list of all billing codes which match a certain pattern.""" 
    14211421        codes = [] 
    1422         result = self.doSearch("(&(objectClass=pykotaBilling)%s)" % "".join(["(pykotaBillingCode=%s)" % self.userCharsetToDatabase(bcode) for bcode in billingcodepattern.split(",")]), \ 
     1422        result = self.doSearch("(&(objectClass=pykotaBilling)(|%s))" % "".join(["(pykotaBillingCode=%s)" % self.userCharsetToDatabase(bcode) for bcode in billingcodepattern.split(",")]), \ 
    14231423                                ["pykotaBillingCode", "description", "pykotaPageCounter", "pykotaBalance"], \ 
    14241424                                base=self.info["billingcodebase"]) 
     
    14371437        return codes         
    14381438         
    1439     def setBillingCodeValues(self, code, newbalance, newpagecounter) :     
     1439    def setBillingCodeValues(self, code, newpagecounter, newbalance) : 
    14401440        """Sets the new page counter and balance for a billing code.""" 
    14411441        fields = { 
     
    14451445        return self.doModify(code.ident, fields)          
    14461446        
    1447     def consumeBillingCode(self, code, balance, pagecounter) : 
     1447    def consumeBillingCode(self, code, pagecounter, balance) : 
    14481448        """Consumes from a billing code.""" 
    14491449        fields = { 
  • pykota/trunk/pykota/storages/sql.py

    r2374 r2388  
    495495        self.doModify("UPDATE billingcodes SET description=%s WHERE id=%s" % (self.doQuote(self.userCharsetToDatabase(code.Description or "")), self.doQuote(code.ident))) 
    496496        
    497     def setBillingCodeValues(self, code, newbalance, newpagecounter) :     
     497    def setBillingCodeValues(self, code, newpagecounter, newbalance) :     
    498498        """Sets the new page counter and balance for a billing code.""" 
    499499        self.doModify("UPDATE billingcodes SET balance=%s, pagecounter=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(newpagecounter), self.doQuote(code.ident))) 
    500500        
    501     def consumeBillingCode(self, code, balance, pagecounter) : 
     501    def consumeBillingCode(self, code, pagecounter, balance) : 
    502502        """Consumes from a billing code.""" 
    503503        self.doModify("UPDATE billingcodes SET balance=balance + %s, pagecounter=pagecounter + %s WHERE id=%s" % (self.doQuote(balance), self.doQuote(pagecounter), self.doQuote(code.ident)))