-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
list the invoices of an organization in index page
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# coding: utf8 | ||
|
||
from liberapay.utils import get_participant | ||
|
||
[---] | ||
|
||
participant = get_participant(state, restrict=False) | ||
|
||
if participant.kind != 'organization': | ||
raise response.error(404) | ||
|
||
invoices = website.db.all(""" | ||
SELECT i.* | ||
, ( SELECT ts | ||
FROM invoice_events ie | ||
WHERE ie.invoice = i.id | ||
ORDER BY ts DESC | ||
LIMIT 1 | ||
) AS mtime | ||
FROM invoices i | ||
WHERE i.addressee = %s | ||
AND i.status NOT IN ('pre', 'canceled') | ||
ORDER BY i.ctime DESC | ||
LIMIT 100 | ||
""", (participant.id,)) | ||
|
||
title = _("Invoices - {username}", username=participant.username) | ||
|
||
[---] text/html | ||
% extends "templates/base.html" | ||
|
||
% block content | ||
|
||
% for i in invoices | ||
<p> | ||
<a href="{{ participant.path('invoices/%i' % i.id) }}">{{ i.description }}</a> | ||
— {{ _(constants.INVOICE_STATUSES[i.status]) }} ({{ format_date(i.mtime, 'long') }}) | ||
</p> | ||
% else | ||
<p>{{ _("Nothing to show.") }}</p> | ||
% endfor | ||
|
||
% endblock |