585 | | if options["delete"] : |
586 | | todelete[entry.Name] = entry # will be done for each printer, we don't care. |
587 | | else : |
588 | | if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) : |
589 | | entrypquota.setLimits(softlimit, hardlimit) |
590 | | if limitby : |
591 | | if changed[entry.Name].get("limitby") is None : |
592 | | entry.setLimitBy(limitby) |
593 | | changed[entry.Name]["limitby"] = limitby |
594 | | |
595 | | if not options["groups"] : |
596 | | if options["reset"] : |
597 | | entrypquota.reset() |
| 590 | if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) : |
| 591 | entrypquota.setLimits(softlimit, hardlimit) |
| 592 | if limitby : |
| 593 | if changed[entry.Name].get("limitby") is None : |
| 594 | entry.setLimitBy(limitby) |
| 595 | changed[entry.Name]["limitby"] = limitby |
| 596 | |
| 597 | if not options["groups"] : |
| 598 | if options["reset"] : |
| 599 | entrypquota.reset() |
| 600 | |
| 601 | if balance : |
| 602 | if changed[entry.Name].get("balance") is None : |
| 603 | if balance.startswith("+") or balance.startswith("-") : |
| 604 | newbalance = float(entry.AccountBalance or 0.0) + balancevalue |
| 605 | newlifetimepaid = float(entry.LifeTimePaid or 0.0) + balancevalue |
| 606 | entry.setAccountBalance(newbalance, newlifetimepaid) |
| 607 | else : |
| 608 | diff = balancevalue - float(entry.AccountBalance or 0.0) |
| 609 | newlifetimepaid = float(entry.LifeTimePaid or 0.0) + diff |
| 610 | entry.setAccountBalance(balancevalue, newlifetimepaid) |
| 611 | changed[entry.Name]["balance"] = balance |
599 | | if balance : |
600 | | if changed[entry.Name].get("balance") is None : |
601 | | if balance.startswith("+") or balance.startswith("-") : |
602 | | newbalance = float(entry.AccountBalance or 0.0) + balancevalue |
603 | | newlifetimepaid = float(entry.LifeTimePaid or 0.0) + balancevalue |
604 | | entry.setAccountBalance(newbalance, newlifetimepaid) |
605 | | else : |
606 | | diff = balancevalue - float(entry.AccountBalance or 0.0) |
607 | | newlifetimepaid = float(entry.LifeTimePaid or 0.0) + diff |
608 | | entry.setAccountBalance(balancevalue, newlifetimepaid) |
609 | | changed[entry.Name]["balance"] = balance |
| 613 | for groupname in groupnames : |
| 614 | # not executed if option --ingroups is not used |
| 615 | if groupname not in changed[entry.Name]["ingroups"] : |
| 616 | group = self.storage.getGroup(groupname) |
| 617 | if group.Exists : |
| 618 | self.storage.addUserToGroup(entry, group) |
| 619 | changed[entry.Name]["ingroups"].append(groupname) |
| 620 | else : |
| 621 | self.logger.log_message(_("Group %s not found in the PyKota Storage.") % groupname) |
611 | | for groupname in groupnames : |
612 | | # not executed if option --ingroups is not used |
613 | | if groupname not in changed[entry.Name]["ingroups"] : |
614 | | group = self.storage.getGroup(groupname) |
615 | | if group.Exists : |
616 | | self.storage.addUserToGroup(entry, group) |
617 | | changed[entry.Name]["ingroups"].append(groupname) |
618 | | else : |
619 | | self.logger.log_message(_("Group %s not found in the PyKota Storage.") % groupname) |
620 | | |
621 | | # This line disabled to prevent sending of unwanted email |
622 | | # messages if quota is reached at creation/modification time. |
623 | | # The check will be done at print time anyway. |
624 | | # getattr(self, "warn%sPQuota" % suffix)(entrypquota) |
| 623 | # This line disabled to prevent sending of unwanted email |
| 624 | # messages if quota is reached at creation/modification time. |
| 625 | # The check will be done at print time anyway. |
| 626 | # getattr(self, "warn%sPQuota" % suffix)(entrypquota) |