def showOutstanding(self, showAll=0): """ Show which users still need to pay their membership fees and if a reminder has already been sent """ if showAll == '1': showAll = True else: showAll = False activeMembers = self.mf.getActiveMemberList() # Prepare add payment form c = TemplateContext() c.heading = _('Outstanding payments') c.members = [] c.member_ids = [] for uid in activeMembers: last_payment = None try: last_payment = self.db.query(Payment).filter( and_(Payment.uid == uid, Payment.verified == 1)).order_by( Payment.date.desc()).limit(1)[0] except: ''' Don't care if there is no payment ''' pass m = self.mf.getUser(uid) m.paymentGood = False if last_payment: d = last_payment.date today = datetime.datetime.now().date() if d.year > today.year or (d.year == today.year and d.month >= today.month): m.paymentGood = True if not m.paymentGood or showAll: c.members.append(m) c.member_ids.append(uid) return self.render('/payments/showOutstanding.mako', template_context=c)
def showOutstanding(self, showAll=0): """ Show which users still need to pay their membership fees and if a reminder has already been sent """ if showAll == '1': showAll = True else: showAll = False activeMembers = self.mf.getActiveMemberList() # Prepare add payment form c = TemplateContext() c.heading = _('Outstanding payments') c.members = [] c.member_ids = [] for uid in activeMembers: last_payment = None try: last_payment = self.db.query(Payment).filter(and_(Payment.uid == uid, Payment.verified == 1)).order_by(Payment.date.desc()).limit(1)[0] except: ''' Don't care if there is no payment ''' pass m = self.mf.getUser(uid) m.paymentGood = False if last_payment: d = last_payment.date today = datetime.datetime.now().date() if d.year > today.year or (d.year == today.year and d.month >= today.month): m.paymentGood = True if not m.paymentGood or showAll: c.members.append(m) c.member_ids.append(uid) return self.render('/payments/showOutstanding.mako', template_context=c)