Enable viewing draft invoices with link

This commit is contained in:
Hillel Coren 2017-01-08 21:45:42 +02:00
parent b34c5724de
commit 854b13de19
4 changed files with 6 additions and 4 deletions

View File

@ -194,7 +194,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

@ -196,7 +196,7 @@ class Invoice extends EntityModel implements BalanceAffecting
if ($this->getRawAdjustment() != 0) {
return true;
}
foreach ([
'invoice_number',
'po_number',
@ -566,7 +566,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;
}
public static function calcStatusLabel($status, $class, $entityType, $quoteInvoiceId)

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)