Show
Ignore:
Timestamp:
02/12/06 00:05:15 (18 years ago)
Author:
jerome
Message:

The duration for the modification of billing codes has been more than halved.

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

Legend:

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

    r2657 r2676  
    16151615        return self.getBillingCode(label) 
    16161616         
    1617     def writeBillingCodeDescription(self, code) : 
     1617    def saveBillingCode(self, code) : 
    16181618        """Sets the new description for a billing code.""" 
    16191619        fields = { 
    16201620                   "description" : self.userCharsetToDatabase(code.Description or ""),  
    1621                  } 
    1622         if fields["description"] : 
    1623             self.doModify(code.ident, fields) 
     1621                   "pykotaPageCounter" : str(code.PageCounter), 
     1622                   "pykotaBalance" : str(code.Balance), 
     1623                 } 
     1624        self.doModify(code.ident, fields) 
    16241625             
    16251626    def getMatchingBillingCodes(self, billingcodepattern) : 
     
    16451646        return codes         
    16461647         
    1647     def setBillingCodeValues(self, code, newpagecounter, newbalance) : 
    1648         """Sets the new page counter and balance for a billing code.""" 
    1649         fields = { 
    1650                    "pykotaPageCounter" : str(newpagecounter), 
    1651                    "pykotaBalance" : str(newbalance), 
    1652                  }   
    1653         return self.doModify(code.ident, fields)          
    1654         
    16551648    def consumeBillingCode(self, code, pagecounter, balance) : 
    16561649        """Consumes from a billing code.""" 
  • pykota/trunk/pykota/storages/sql.py

    r2665 r2676  
    592592        self.doModify("UPDATE userpquota SET pagecounter=%s, lifepagecounter=%s, warncount=0, datelimit=NULL WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident))) 
    593593        
    594     def writeBillingCodeDescription(self, code) : 
    595         """Sets the new description for a billing code.""" 
    596         self.doModify("UPDATE billingcodes SET description=%s WHERE id=%s" % (self.doQuote(self.userCharsetToDatabase(code.Description or "")), self.doQuote(code.ident))) 
    597         
    598     def setBillingCodeValues(self, code, newpagecounter, newbalance) :     
    599         """Sets the new page counter and balance for a billing code.""" 
    600         self.doModify("UPDATE billingcodes SET balance=%s, pagecounter=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(newpagecounter), self.doQuote(code.ident))) 
     594    def saveBillingCode(self, code) :     
     595        """Saves the billing code to the database.""" 
     596        self.doModify("UPDATE billingcodes SET balance=%s, pagecounter=%s, description=%s WHERE id=%s" \ 
     597                            % (self.doQuote(code.Balance), \ 
     598                               self.doQuote(code.PageCounter), \ 
     599                               self.doQuote(self.userCharsetToDatabase(code.Description)), \ 
     600                              self.doQuote(code.ident))) 
    601601        
    602602    def consumeBillingCode(self, code, pagecounter, balance) :