accrual: Aging report uses RT short links for all RT link text.

Per user request. This is better than saying "Display.html" everywhere.
This commit is contained in:
Brett Smith 2020-06-12 15:54:50 -04:00
parent 4ca188611f
commit d6559b572f

View file

@ -390,20 +390,16 @@ class AgingODS(core.BaseODS[AccrualPostings, Optional[data.Account]]):
def _link_seq(self, row: AccrualPostings, key: MetaKey) -> Iterator[Tuple[str, str]]:
for href in row.all_meta_links(key):
text: Optional[str] = None
rt_ids = self.rt_wrapper.parse(href)
if rt_ids is not None:
ticket_id, attachment_id = rt_ids
if attachment_id is None:
text = f'RT#{ticket_id}'
href = self.rt_wrapper.url(ticket_id, attachment_id) or href
else:
rt_href = rt_ids and self.rt_wrapper.url(*rt_ids)
if rt_ids is None or rt_href is None:
# '..' pops the ODS filename off the link path. In other words,
# make the link relative to the directory the ODS is in.
href = f'../{href}'
if text is None:
href_path = Path(urlparse.urlparse(href).path)
href_path = Path('..', urlparse.urlparse(href).path)
href = str(href_path)
text = urlparse.unquote(href_path.name)
else:
text = self.rt_wrapper.unparse(*rt_ids)
yield (href, text)
def write_row(self, row: AccrualPostings) -> None: