| 156 | # Was the printer ever used ? |
| 157 | if (lastpagecounter is None) or (lastusername is None) : |
| 158 | lastusername = username |
| 159 | lastpagecounter = counterbeforejob |
| 160 | |
| 161 | # Update the quota for the previous user on this printer according |
| 162 | # to the job size (difference between actual counter and latest one from storage) |
| 163 | jobsize = (counterbeforejob - lastpagecounter) |
| 164 | if jobsize >= 0 : |
| 165 | kotafilter.storage.updateUserPQuota(lastusername, kotafilter.printername, jobsize) |
| 166 | kotafilter.warnUserPQuota(lastusername) |
| 167 | else : |
| 168 | kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, kotafilter.printername, lastusername), "error") |
| 169 | |
157 | | |
158 | | # Yes |
159 | | if (lastpagecounter is None) or (lastusername is None) : |
160 | | lastusername = username |
161 | | lastpagecounter = counterbeforejob |
162 | | jobsize = (counterbeforejob - lastpagecounter) |
163 | | if jobsize >= 0: |
164 | | kotafilter.storage.updateUserPQuota(lastusername, kotafilter.printername, jobsize) |
165 | | kotafilter.warnUserPQuota(lastusername) |
166 | | else : |
167 | | kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, kotafilter.printername, lastusername), "error") |