- Timestamp:
- 07/03/05 23:47:57 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkbcodes
r2337 r2340 49 49 50 50 -d | --delete Deletes billing codes from PyKota's database. 51 NB : the history entries with this billing code 52 are not deleted, voluntarily. 51 53 52 54 -D | --description d Adds a textual description to billing codes. -
pykota/trunk/pykota/storage.py
r2302 r2340 99 99 else : 100 100 self.parent.commitTransaction() 101 self.Exists = 0 101 102 102 103 class StorageGroup(StorageObject) : … … 129 130 else : 130 131 self.parent.commitTransaction() 132 self.Exists = 0 131 133 132 134 class StoragePrinter(StorageObject) : … … 176 178 self.parent.writePrinterPrices(self) 177 179 178 def setDescription(self, description = None) :179 """Sets the printer's prices."""180 def setDescription(self, description=None) : 181 """Sets the printer's description.""" 180 182 if description is None : 181 183 description = self.Description … … 194 196 else : 195 197 self.parent.commitTransaction() 198 self.Exists = 0 196 199 197 200 class StorageUserPQuota(StorageObject) : … … 301 304 upq.PageCounter = int(upq.PageCounter or 0) + jobsize 302 305 upq.LifePageCounter = int(upq.LifePageCounter or 0) + jobsize 306 # TODO : consume from the billing code as well 303 307 except PyKotaStorageError, msg : 304 308 self.parent.rollbackTransaction() … … 412 416 self.PrinterName = printer.Name # not needed 413 417 self.Printer = printer 418 419 class StorageBillingCode(StorageObject) : 420 """Billing code class.""" 421 def __init__(self, parent, name) : 422 StorageObject.__init__(self, parent) 423 self.BillingCode = name 424 self.Description = None 425 self.PageCounter = None 426 self.Balance = None 427 428 def delete(self) : 429 """Deletes the billing code from the database.""" 430 self.parent.deleteBillingCode(self) 431 self.Exists = 0 432 433 def reset(self, pagecounter=0, balance=0.0) : 434 """Resets the pagecounter and balance for this billing code.""" 435 self.parent.setBillingCodeValues(self, pagecounter, balance) 436 self.PageCounter = pagecounter 437 self.Balance = balance 438 439 def setDescription(self, description=None) : 440 """Modifies the description for this billing code.""" 441 if description is None : 442 description = self.Description 443 else : 444 self.Description = str(description) 445 self.parent.writeBillingCodeDescription(self) 446 447 def consume(self, pages, price) : 448 """Consumes some pages and credits for this billing code.""" 449 if pages : 450 self.parent.consumeBillingCode(self, pages, price) 451 self.PageCounter += pages 452 self.Balance -= price 414 453 415 454 class BaseStorage :