my $po = $e->retrieve_acq_purchase_order($args)
or return $e->event;
+ return $e->event unless $e->allowed(['VIEW_INVOICE', 'CREATE_INVOICE'], $po->ordering_agency);
+
if($$options{flesh_lineitems}) {
my $flesh_fields = { jub => ['attributes'] };
);
-sub fetch_invoice_api {
- my($self, $conn, $auth, $invoice_id, $options) = @_;
-
- my $e = new_editor(authtoken=>$auth);
- return $e->event unless $e->checkauth;
+sub fetch_invoice_with_perm_check {
+ my($e, $invoice_id, $options) = @_;
my $invoice = fetch_invoice_impl($e, $invoice_id, $options) or
return $e->event;