mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:44:32 -04:00
Bug fixes
This commit is contained in:
parent
ce4524ba1a
commit
eaf73077b1
@ -15,6 +15,7 @@ use App\Events\QuoteInvitationWasEmailed;
|
|||||||
class Invoice extends EntityModel implements BalanceAffecting
|
class Invoice extends EntityModel implements BalanceAffecting
|
||||||
{
|
{
|
||||||
use PresentableTrait;
|
use PresentableTrait;
|
||||||
|
use OwnedByClientTrait;
|
||||||
use SoftDeletes {
|
use SoftDeletes {
|
||||||
SoftDeletes::trashed as parentTrashed;
|
SoftDeletes::trashed as parentTrashed;
|
||||||
}
|
}
|
||||||
|
13
app/Models/OwnedByClientTrait.php
Normal file
13
app/Models/OwnedByClientTrait.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
trait OwnedByClientTrait
|
||||||
|
{
|
||||||
|
public function isClientTrashed()
|
||||||
|
{
|
||||||
|
if (!$this->client) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->client->trashed();
|
||||||
|
}
|
||||||
|
}
|
@ -392,19 +392,18 @@
|
|||||||
|
|
||||||
{!! Button::primary(trans('texts.download_pdf'))->withAttributes(array('onclick' => 'onDownloadClick()'))->appendIcon(Icon::create('download-alt')) !!}
|
{!! Button::primary(trans('texts.download_pdf'))->withAttributes(array('onclick' => 'onDownloadClick()'))->appendIcon(Icon::create('download-alt')) !!}
|
||||||
|
|
||||||
@if (!$invoice->trashed())
|
@if ($invoice->isClientTrashed())
|
||||||
|
<!-- do nothing -->
|
||||||
|
@elseif ($invoice->trashed())
|
||||||
|
{!! Button::success(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||||
|
@elseif (!$invoice->trashed())
|
||||||
{!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
|
{!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
|
||||||
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
|
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
|
||||||
|
|
||||||
@if ($invoice->id)
|
@if ($invoice->id)
|
||||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||||
->withContents($actions)
|
->withContents($actions)
|
||||||
->dropup() !!}
|
->dropup() !!}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@elseif ($invoice->trashed())
|
|
||||||
{!! Button::success(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -1007,16 +1006,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isEmailValid() {
|
function isEmailValid() {
|
||||||
var isValid = false;
|
var isValid = true;
|
||||||
var sendTo = false;
|
var sendTo = false;
|
||||||
var client = model.invoice().client();
|
var client = model.invoice().client();
|
||||||
for (var i=0; i<client.contacts().length; i++) {
|
for (var i=0; i<client.contacts().length; i++) {
|
||||||
var contact = client.contacts()[i];
|
var contact = client.contacts()[i];
|
||||||
|
if ( ! contact.send_invoice()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (isValidEmailAddress(contact.email())) {
|
if (isValidEmailAddress(contact.email())) {
|
||||||
isValid = true;
|
isValid = true;
|
||||||
if (contact.send_invoice() || client.contacts().length == 1) {
|
|
||||||
sendTo = true;
|
sendTo = true;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user