Index: pykota/trunk/bin/edpykota
===================================================================
--- pykota/trunk/bin/edpykota (revision 2028)
+++ pykota/trunk/bin/edpykota (revision 2030)
@@ -24,4 +24,7 @@
 #
 # $Log$
+# Revision 1.85  2005/01/18 19:47:49  jalet
+# Big bug fix wrt the datelimit attribute
+#
 # Revision 1.84  2005/01/17 08:44:23  jalet
 # Modified copyright years
@@ -691,9 +694,11 @@
                             changed[entry.Name]["limitby"] = limitby
                     
+                    if options["reset"] :
+                        entrypquota.reset()
+                        
+                    if options["hardreset"] :    
+                        entrypquota.hardreset()
+                        
                     if not options["groups"] :
-                        if options["reset"] :
-                            entrypquota.reset()
-                        if options["hardreset"] :    
-                            entrypquota.hardreset()
                         if options["used"] :
                             entrypquota.setUsage(used)
@@ -773,5 +778,5 @@
         elif options["noquota"] and (options["prototype"] or options["hardlimit"] or options["softlimit"]) :
             raise PyKotaToolError, _("incompatible options, see help.")
-        elif options["groups"] and (options["balance"] or options["ingroups"] or options["used"] or options["reset"] or options["hardreset"]) :
+        elif options["groups"] and (options["balance"] or options["ingroups"] or options["used"]) :
             raise PyKotaToolError, _("incompatible options, see help.")
         else :
Index: pykota/trunk/NEWS
===================================================================
--- pykota/trunk/NEWS (revision 2028)
+++ pykota/trunk/NEWS (revision 2030)
@@ -22,4 +22,9 @@
 PyKota NEWS :
 
+    - 1.21alpha20 :
+    
+        - Big bug fix wrt the datelimit field which was never
+          reset.
+          
     - 1.21alpha19 :
     
Index: pykota/trunk/pykota/storages/sql.py
===================================================================
--- pykota/trunk/pykota/storages/sql.py (revision 1999)
+++ pykota/trunk/pykota/storages/sql.py (revision 2030)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.64  2005/01/18 19:47:50  jalet
+# Big bug fix wrt the datelimit attribute
+#
 # Revision 1.63  2005/01/01 08:16:17  jalet
 # Fixed a problem which occured when 'limitby' was unset in the PostgreSQL
@@ -522,5 +525,5 @@
     def writeUserPQuotaPagesCounters(self, userpquota, newpagecounter, newlifepagecounter) :    
         """Sets the new page counters permanently for a user print quota."""
-        self.doModify("UPDATE userpquota SET pagecounter=%s,lifepagecounter=%s WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident)))
+        self.doModify("UPDATE userpquota SET pagecounter=%s, lifepagecounter=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident)))
        
     def decreaseUserAccountBalance(self, user, amount) :    
Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 2000)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 2030)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.95  2005/01/18 19:47:50  jalet
+# Big bug fix wrt the datelimit attribute
+#
 # Revision 1.94  2005/01/01 18:53:27  jalet
 # Implemented in the LDAP backend code the same fix than in PostgreSQL backend
@@ -1167,4 +1170,5 @@
                    "pykotaPageCounter" : str(newpagecounter),
                    "pykotaLifePageCounter" : str(newlifepagecounter),
+                   "pykotaDateLimit" : None,
                  }  
         return self.doModify(userpquota.ident, fields)         
Index: pykota/trunk/pykota/storage.py
===================================================================
--- pykota/trunk/pykota/storage.py (revision 1967)
+++ pykota/trunk/pykota/storage.py (revision 2030)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.67  2005/01/18 19:47:50  jalet
+# Big bug fix wrt the datelimit attribute
+#
 # Revision 1.66  2004/12/02 21:24:50  jalet
 # Integrated the patch by Wilson Roberto Afonso and Matt Hyclak to allow
@@ -447,10 +450,19 @@
         vused = int(used)
         if used.startswith("+") or used.startswith("-") :
-           self.parent.increaseUserPQuotaPagesCounters(self, vused)
-           self.PageCounter += vused
-           self.LifePageCounter += vused
+            self.parent.beginTransaction()
+            try :
+                self.parent.increaseUserPQuotaPagesCounters(self, vused)
+                self.parent.writeUserPQuotaDateLimit(self, None)
+            except PyKotaStorageError, msg :    
+                self.parent.rollbackTransaction()
+                raise PyKotaStorageError, msg
+            else :
+                self.parent.commitTransaction()
+            self.PageCounter += vused
+            self.LifePageCounter += vused
         else :
-           self.parent.writeUserPQuotaPagesCounters(self, vused, vused)
-           self.PageCounter = self.LifePageCounter = vused
+            self.parent.writeUserPQuotaPagesCounters(self, vused, vused)
+            self.PageCounter = self.LifePageCounter = vused
+        self.DateLimit = None
 
     def reset(self) :    
@@ -458,4 +470,5 @@
         self.parent.writeUserPQuotaPagesCounters(self, 0, int(self.LifePageCounter or 0))
         self.PageCounter = 0
+        self.DateLimit = None
         
     def hardreset(self) :    
@@ -463,4 +476,5 @@
         self.parent.writeUserPQuotaPagesCounters(self, 0, 0)
         self.PageCounter = self.LifePageCounter = 0
+        self.DateLimit = None
         
     def computeJobPrice(self, jobsize) :    
@@ -512,4 +526,36 @@
             raise AttributeError, name
         
+    def reset(self) :    
+        """Resets page counter to 0."""
+        self.parent.beginTransaction()
+        try :
+            for user in self.parent.getGroupMembers(self.Group) :
+                uq = self.parent.getUserPQuota(user, self.Printer)
+                uq.reset()
+            self.parent.writeGroupPQuotaDateLimit(self, None)
+        except PyKotaStorageError, msg :    
+            self.parent.rollbackTransaction()
+            raise PyKotaStorageError, msg
+        else :    
+            self.parent.commitTransaction()
+        self.PageCounter = 0
+        self.DateLimit = None
+        
+    def hardreset(self) :    
+        """Resets actual and life time page counters to 0."""
+        self.parent.beginTransaction()
+        try :
+            for user in self.parent.getGroupMembers(self.Group) :
+                uq = self.parent.getUserPQuota(user, self.Printer)
+                uq.hardreset()
+            self.parent.writeGroupPQuotaDateLimit(self, None)
+        except PyKotaStorageError, msg :    
+            self.parent.rollbackTransaction()
+            raise PyKotaStorageError, msg
+        else :    
+            self.parent.commitTransaction()
+        self.PageCounter = self.LifePageCounter = 0
+        self.DateLimit = None
+        
     def setDateLimit(self, datelimit) :    
         """Sets the date limit for this quota."""
Index: pykota/trunk/pykota/version.py
===================================================================
--- pykota/trunk/pykota/version.py (revision 2020)
+++ pykota/trunk/pykota/version.py (revision 2030)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.21alpha19_unofficial"
+__version__ = "1.21alpha20_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
