More Standardisation work.

This commit is contained in:
Deon George
2016-08-03 14:00:51 +10:00
parent 85f08bbb0a
commit 5f84d2c14f
38 changed files with 276 additions and 100 deletions

View File

@@ -26,13 +26,15 @@ class Controller_User_Invoice extends Controller_Invoice {
if (! $io->loaded() OR ! Auth::instance()->authorised($io->account))
throw HTTP_Exception::factory(403,'Service either doesnt exist, or you are not authorised to see it');
// Log the download
$imo = $io->invoice_memo;
$imo->invoice_id = $io->id;
$imo->account_id = $this->ao->id;
$imo->type = 'download';
$imo->memo = 'Invoice Downloaded.';
$imo->save();
if (! $this->ao->isAdmin()) {
// Log the download
$imo = $io->invoice_memo;
$imo->invoice_id = $io->id;
$imo->account_id = $this->ao->id;
$imo->type = 'download';
$imo->memo = 'Invoice Downloaded.';
$imo->save();
}
$this->response->body(Invoice::instance($io)->render('pdf','all',array('download'=>sprintf('%s.pdf',$io->refnum()))));
$this->response->headers(array('Content-Type' => 'application/pdf'));