1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00

Enable viewing draft invoices with link

This commit is contained in:
Hillel Coren 2017-01-08 21:47:12 +02:00
parent 7a2ff46c89
commit dc763eb6f7
4 changed files with 5 additions and 3 deletions

View File

@ -192,7 +192,7 @@ class InvoiceController extends BaseController
}
// Set the invitation data on the client's contacts
if ($invoice->is_public && ! $clone) {
if ( ! $clone) {
$clients = $data['clients'];
foreach ($clients as $client) {
if ($client->id != $invoice->client->id) {

View File

@ -550,7 +550,7 @@ class Invoice extends EntityModel implements BalanceAffecting
public function canBePaid()
{
return floatval($this->balance) > 0 && ! $this->is_deleted && $this->isInvoice();
return floatval($this->balance) > 0 && ! $this->is_deleted && $this->isInvoice() && $this->is_public;
}
/**

View File

@ -797,7 +797,7 @@ class InvoiceRepository extends BaseRepository
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted || ! $invoice->is_public) {
if (!$invoice || $invoice->is_deleted) {
return false;
}

View File

@ -116,6 +116,8 @@
@if ($showApprove)
{!! Button::success(trans('texts.approve'))->asLinkTo(URL::to('/approve/' . $invitation->invitation_key))->large() !!}
@endif
@elseif ( ! $invoice->canBePaid())
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
@elseif ($invoice->client->account->isGatewayConfigured() && floatval($invoice->balance) && !$invoice->is_recurring)
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}  
@if (count($paymentTypes) > 1)