Show
Ignore:
Timestamp:
06/11/03 21:32:00 (21 years ago)
Author:
jalet
Message:

Severe bug wrt account balance setting should be corrected.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r975 r1023  
    2323# 
    2424# $Log$ 
     25# Revision 1.45  2003/06/11 19:32:00  jalet 
     26# Severe bug wrt account balance setting should be corrected. 
     27# 
    2528# Revision 1.44  2003/04/29 22:03:38  jalet 
    2629# Better error handling. 
     
    388391            groupnames = [] 
    389392             
     393        uwaschanged = {}         # tracks changed made at the user level 
     394        gwaschanged = {}         # tracks changed made at the group level 
    390395        for (printerid, printer) in printers : 
    391396            if options["charge"] : 
     
    428433            for (ident, name) in [(i, n) for (i, n) in allidnames if self.matchString(n, names)]: 
    429434                if options["groups"] : 
     435                    if not gwaschanged.has_key(ident) : 
     436                        gwaschanged[ident] = {} 
    430437                    quota = self.storage.getGroupPQuota(ident, printerid) 
    431438                else : 
     439                    if not uwaschanged.has_key(ident) : 
     440                        uwaschanged[ident] = {"ingroups": []} 
    432441                    quota = self.storage.getUserPQuota(ident, printerid) 
    433442                if quota is None : 
     
    465474                                self.storage.resetGroupPQuota(ident, printerid) 
    466475                            if limitby : 
    467                                 self.storage.limitGroupBy(ident, limitby) 
     476                                if gwaschanged[ident].get("limitby") is None : 
     477                                    self.storage.limitGroupBy(ident, limitby) 
     478                                    gwaschanged[ident]["limitby"] = limitby 
    468479                            self.warnGroupPQuota(name, printer)     
    469480                        else : 
     
    473484                                self.storage.resetUserPQuota(ident, printerid) 
    474485                            if limitby : 
    475                                 self.storage.limitUserBy(ident, limitby) 
     486                                if uwaschanged[ident].get("limitby") is None : 
     487                                    self.storage.limitUserBy(ident, limitby) 
     488                                    uwaschanged[ident]["limitby"] = limitby 
    476489                            if balance : 
    477                                 if balance.startswith("+") or balance.startswith("-") : 
    478                                     self.storage.increaseUserBalance(ident, balancevalue) 
    479                                 else : 
    480                                     self.storage.setUserBalance(ident, balancevalue) 
     490                                if uwaschanged[ident].get("balance") is None : 
     491                                    if balance.startswith("+") or balance.startswith("-") : 
     492                                        self.storage.increaseUserBalance(ident, balancevalue) 
     493                                    else : 
     494                                        self.storage.setUserBalance(ident, balancevalue) 
     495                                    uwaschanged[ident]["balance"] = balance 
    481496                            for groupname in groupnames :         
    482                                 groupid = self.storage.getGroupId(groupname) 
    483                                 if groupid is not None : 
    484                                     self.storage.addUserToGroup(ident, groupid) 
    485                                 else : 
    486                                     self.logger.log_message(_("Group %s not found in the PyKota Storage.") % groupname) 
     497                                if groupname not in uwaschanged[ident]["ingroups"] : 
     498                                    groupid = self.storage.getGroupId(groupname) 
     499                                    if groupid is not None : 
     500                                        self.storage.addUserToGroup(ident, groupid) 
     501                                        uwaschanged[ident]["ingroups"].append(groupname) 
     502                                    else : 
     503                                        self.logger.log_message(_("Group %s not found in the PyKota Storage.") % groupname) 
    487504                            self.warnUserPQuota(name, printer)     
    488505