- Timestamp:
- 13 Feb 2025, 11:36:26 (2 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py
r17760 r18021 19 19 """ 20 20 import grok 21 from datetime import datetime, timedelta 21 22 from zope.catalog.interfaces import ICatalog 22 from zope.component import queryUtility 23 from zope.component import queryUtility, getUtility 23 24 from waeup.kofa.applicants.interfaces import ( 24 25 IApplicantBaseData, IApplicantsContainer, IApplicantOnlinePayment, 25 26 IApplicantRefereeReport, IApplicant) 26 from waeup.kofa.interfaces import ICSVExporter 27 from waeup.kofa.interfaces import ICSVExporter, IKofaUtils 27 28 from waeup.kofa.interfaces import MessageFactory as _ 28 29 from waeup.kofa.utils.batching import ExporterBase 29 from waeup.kofa.utils.helpers import iface_names 30 from waeup.kofa.utils.helpers import iface_names, to_timezone 30 31 31 32 class ApplicantsContainerExporter(grok.GlobalUtility, ExporterBase): … … 213 214 """ 214 215 container = grok.getSite()['applicants'][kw['container']] 216 p_start = kw.get('p_start') 217 p_end = kw.get('p_end') 215 218 container_values = container.values() 216 219 used = [value for value in container_values 217 220 if value.container_code.endswith('+')] 218 221 payments = [] 222 date_format = '%d/%m/%Y' 219 223 for applicant in used: 220 224 for payment in applicant.payments: 225 if p_start and p_end: 226 if not payment.payment_date: 227 continue 228 payments_start = datetime.strptime(p_start, date_format) 229 payments_end = datetime.strptime(p_end, date_format) 230 tz = getUtility(IKofaUtils).tzinfo 231 payments_start = tz.localize(payments_start) 232 payments_end = tz.localize(payments_end) + timedelta(days=1) 233 payment_date = to_timezone(payment.payment_date, tz) 234 if payment_date < payments_start or payment_date > payments_end: 235 continue 221 236 if payment.p_state == 'paid': 222 237 payments.append(payment)
Note: See TracChangeset for help on using the changeset viewer.