Fixes for is_quote

This commit is contained in:
Hillel Coren 2016-05-29 15:34:44 +03:00
parent 59d0a1cb80
commit a9302d4d01
3 changed files with 63 additions and 59 deletions

View File

@ -243,6 +243,10 @@ class Invoice extends EntityModel implements BalanceAffecting
return $this->invoice_type_id == $typeId; return $this->invoice_type_id == $typeId;
} }
public function isQuote() {
return $this->isType(INVOICE_TYPE_QUOTE);
}
public function markInvitationsSent($notify = false) public function markInvitationsSent($notify = false)
{ {
foreach ($this->invitations as $invitation) { foreach ($this->invitations as $invitation) {

View File

@ -731,8 +731,8 @@ class InvoiceRepository extends BaseRepository
public function findOpenInvoices($clientId) public function findOpenInvoices($clientId)
{ {
return Invoice::scope() return Invoice::scope()
->invoiceType(INVOICE_TYPE_STANDARD)
->whereClientId($clientId) ->whereClientId($clientId)
->whereIsQuote(false)
->whereIsRecurring(false) ->whereIsRecurring(false)
->whereDeletedAt(null) ->whereDeletedAt(null)
->whereHasTasks(true) ->whereHasTasks(true)

View File

@ -70,7 +70,7 @@
@include('partials.checkout_com_payment') @include('partials.checkout_com_payment')
@else @else
<div class="pull-right" style="text-align:right"> <div class="pull-right" style="text-align:right">
@if ($invoice->is_quote) @if ($invoice->isQuote())
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}&nbsp;&nbsp; {!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}&nbsp;&nbsp;
@if ($showApprove) @if ($showApprove)
{!! Button::success(trans('texts.approve'))->asLinkTo(URL::to('/approve/' . $invitation->invitation_key))->large() !!} {!! Button::success(trans('texts.approve'))->asLinkTo(URL::to('/approve/' . $invitation->invitation_key))->large() !!}
@ -135,7 +135,7 @@
remove_created_by:{{ $invoice->client->account->hasFeature(FEATURE_REMOVE_CREATED_BY) ? 'true' : 'false' }}, remove_created_by:{{ $invoice->client->account->hasFeature(FEATURE_REMOVE_CREATED_BY) ? 'true' : 'false' }},
invoice_settings:{{ $invoice->client->account->hasFeature(FEATURE_INVOICE_SETTINGS) ? 'true' : 'false' }} invoice_settings:{{ $invoice->client->account->hasFeature(FEATURE_INVOICE_SETTINGS) ? 'true' : 'false' }}
}; };
invoice.is_quote = {{ $invoice->is_quote ? 'true' : 'false' }}; invoice.is_quote = {{ $invoice->isQuote() ? 'true' : 'false' }};
invoice.contact = {!! $contact->toJson() !!}; invoice.contact = {!! $contact->toJson() !!};
function getPDFString(cb) { function getPDFString(cb) {