1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fix expense include documents

This commit is contained in:
Hillel Coren 2017-07-21 13:44:36 +03:00
parent 947c1e2a12
commit 48dbf0f287
3 changed files with 11 additions and 7 deletions

View File

@ -71,7 +71,9 @@ class ContactMailer extends Mailer
$documents = $invoice->documents;
foreach ($invoice->expenses as $expense) {
$documents = $documents->merge($expense->documents);
if ($expense->invoice_documents) {
$documents = $documents->merge($expense->documents);
}
}
$documents = $documents->sortBy('size');

View File

@ -38,8 +38,10 @@ class TemplateService
$documentsHTML .= '<li><a href="'.HTML::entities($document->getClientUrl($invitation)).'">'.HTML::entities($document->name).'</a></li>';
}
foreach ($invoice->expenses as $expense) {
foreach ($expense->documents as $document) {
$documentsHTML .= '<li><a href="'.HTML::entities($document->getClientUrl($invitation)).'">'.HTML::entities($document->name).'</a></li>';
if ($expense->invoice_documents) {
foreach ($expense->documents as $document) {
$documentsHTML .= '<li><a href="'.HTML::entities($document->getClientUrl($invitation)).'">'.HTML::entities($document->name).'</a></li>';
}
}
}
$documentsHTML .= '</ul>';

View File

@ -155,11 +155,11 @@
<li><a target="_blank" href="{{ $document->getClientUrl($invitation) }}">{{$document->name}} ({{Form::human_filesize($document->size)}})</a></li>
@endforeach
@foreach ($invoice->expenses as $expense)
@foreach ($expense->documents as $document)
@if ($expense->invoice_documents)
@if ($expense->invoice_documents)
@foreach ($expense->documents as $document)
<li><a target="_blank" href="{{ $document->getClientUrl($invitation) }}">{{$document->name}} ({{Form::human_filesize($document->size)}})</a></li>
@endif
@endforeach
@endforeach
@endif
@endforeach
</ul>
</div>