Show
Ignore:
Timestamp:
02/08/07 21:13:03 (17 years ago)
Author:
jerome
Message:

Make start= and end= filters also work with payments. For an unknown
reason it didn't already work (not implemented !)...
Ensures that these filters are only allowed for payments and
history, otherwise an SQL syntax error could have occured.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/ldapstorage.py

    r3133 r3142  
    16201620    def extractPayments(self, extractonly={}) : 
    16211621        """Extracts all payment records.""" 
     1622        startdate = extractonly.get("start") 
     1623        enddate = extractonly.get("end") 
     1624        (startdate, enddate) = self.cleanDates(startdate, enddate) 
    16221625        uname = extractonly.get("username") 
    16231626        entries = [u for u in [self.getUser(name) for name in self.getAllUsersNames(uname)] if u.Exists] 
     
    16261629            for entry in entries : 
    16271630                for (date, amount, description) in entry.Payments : 
    1628                     result.append((entry.Name, amount, date, description)) 
     1631                    if ((startdate is None) and (enddate is None)) or \ 
     1632                       ((startdate is None) and (date <= enddate)) or \ 
     1633                       ((enddate is None) and (date >= startdate)) or \ 
     1634                       ((date >= startdate) and (date <= enddate)) : 
     1635                        result.append((entry.Name, amount, date, description)) 
    16291636            return result         
    16301637