Index: /pykota/trunk/pykota/dumper.py
===================================================================
--- /pykota/trunk/pykota/dumper.py (revision 3133)
+++ /pykota/trunk/pykota/dumper.py (revision 3142)
@@ -108,7 +108,17 @@
             raise PyKotaToolError, _("XML output is disabled because the jaxml module is not available.")
             
-        if options["sum"] and datatype not in ("payments", "history") : 
-            raise PyKotaCommandLineError, _("Invalid data type [%s] for --sum command line option, see help.") % datatype
-            
+        if datatype not in ("payments", "history") : 
+            if options["sum"] : 
+                raise PyKotaCommandLineError, _("Invalid data type [%s] for --sum command line option, see help.") % datatype
+            if extractonly.has_key("start") or extractonly.has_key("end") :    
+                self.printInfo(_("Invalid filter for the %(datatype)s data type.") % locals(), "warn")
+                try :
+                    del extractonly["start"]
+                except KeyError :    
+                    pass
+                try :
+                    del extractonly["end"]
+                except KeyError :    
+                    pass
             
         retcode = 0
Index: /pykota/trunk/pykota/storages/sql.py
===================================================================
--- /pykota/trunk/pykota/storages/sql.py (revision 3139)
+++ /pykota/trunk/pykota/storages/sql.py (revision 3142)
@@ -187,7 +187,19 @@
     def extractPayments(self, extractonly={}) :
         """Extracts all payment records."""
+        startdate = extractonly.get("start")
+        enddate = extractonly.get("end")
+        for limit in ("start", "end") :
+            try :
+                del extractonly[limit]
+            except KeyError :    
+                pass
         thefilter = self.createFilter(extractonly)
         if thefilter :
             thefilter = "AND %s" % thefilter
+        (startdate, enddate) = self.cleanDates(startdate, enddate)
+        if startdate : 
+            thefilter = "%s AND date>=%s" % (thefilter, self.doQuote(startdate))
+        if enddate : 
+            thefilter = "%s AND date<=%s" % (thefilter, self.doQuote(enddate))
         result = self.doRawSearch("SELECT username,payments.* FROM users,payments WHERE users.id=payments.userid %s ORDER BY payments.id ASC" % thefilter)
         return self.prepareRawResult(result)
Index: /pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- /pykota/trunk/pykota/storages/ldapstorage.py (revision 3133)
+++ /pykota/trunk/pykota/storages/ldapstorage.py (revision 3142)
@@ -1620,4 +1620,7 @@
     def extractPayments(self, extractonly={}) :
         """Extracts all payment records."""
+        startdate = extractonly.get("start")
+        enddate = extractonly.get("end")
+        (startdate, enddate) = self.cleanDates(startdate, enddate)
         uname = extractonly.get("username")
         entries = [u for u in [self.getUser(name) for name in self.getAllUsersNames(uname)] if u.Exists]
@@ -1626,5 +1629,9 @@
             for entry in entries :
                 for (date, amount, description) in entry.Payments :
-                    result.append((entry.Name, amount, date, description))
+                    if ((startdate is None) and (enddate is None)) or \
+                       ((startdate is None) and (date <= enddate)) or \
+                       ((enddate is None) and (date >= startdate)) or \
+                       ((date >= startdate) and (date <= enddate)) :
+                        result.append((entry.Name, amount, date, description))
             return result        
         
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 3141)
+++ /pykota/trunk/NEWS (revision 3142)
@@ -24,4 +24,7 @@
     - 1.26alpha3 (2007-01-31) :
     
+        - Ensures start= and end= filters are only allowed for history and 
+          payments. Made start= or end= filters also work with payments.
+          
         - Doesn't print banners anymore when the user cancelled the print job.
         
