accrual: Outgoing report handles requestors without RealName.

This commit is contained in:
Brett Smith 2020-05-18 14:44:34 -04:00
parent a8a1a53c7c
commit f64143db44
4 changed files with 13 additions and 7 deletions

View file

@ -220,8 +220,12 @@ def outgoing_report(groups: PostGroups,
requestor = '' requestor = ''
requestor_name = '' requestor_name = ''
else: else:
requestor = '{RealName} <{EmailAddress}>'.format_map(rt_requestor) requestor_name = (
requestor_name = rt_requestor['RealName'] rt_requestor.get('RealName')
or rt_requestor.get('CF.{payment-to}')
or ''
)
requestor = f'{requestor_name} <{rt_requestor["EmailAddress"]}>'.strip()
contract_links = related.all_meta_links('contract') contract_links = related.all_meta_links('contract')
if contract_links: if contract_links:

View file

@ -5,7 +5,7 @@ from setuptools import setup
setup( setup(
name='conservancy_beancount', name='conservancy_beancount',
description="Plugin, library, and reports for reading Conservancy's books", description="Plugin, library, and reports for reading Conservancy's books",
version='1.0.2', version='1.0.3',
author='Software Freedom Conservancy', author='Software Freedom Conservancy',
author_email='info@sfconservancy.org', author_email='info@sfconservancy.org',
license='GNU AGPLv3+', license='GNU AGPLv3+',

View file

@ -343,8 +343,8 @@ def test_outgoing_report_custom_field_fallbacks(accrual_postings):
contract_url = re.escape(f'<{rt_url}Ticket/Attachment/4000/4000/contract.pdf>') contract_url = re.escape(f'<{rt_url}Ticket/Attachment/4000/4000/contract.pdf>')
check_output(output, [ check_output(output, [
r'^PAYMENT FOR APPROVAL:$', r'^PAYMENT FOR APPROVAL:$',
r'^REQUESTOR: Mx\. 510 <mx510@example\.org>$', r'^REQUESTOR: <mx510@example\.org>$',
r'^PAYMENT TO: Mx\. 510$', r'^PAYMENT TO:\s*$',
r'^PAYMENT METHOD:\s*$', r'^PAYMENT METHOD:\s*$',
]) ])

View file

@ -363,9 +363,11 @@ class RTClient:
else: else:
email = user_id_s email = user_id_s
user_id_num = int(match.group(1)) user_id_num = int(match.group(1))
return { retval = {
'id': f'user/{user_id_num}', 'id': f'user/{user_id_num}',
'EmailAddress': email, 'EmailAddress': email,
'Name': email, 'Name': email,
'RealName': f'Mx. {user_id_num}',
} }
if self.want_cfs:
retval['RealName'] = f'Mx. {user_id_num}'
return retval