mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01: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
|
||||
{
|
||||
use PresentableTrait;
|
||||
use OwnedByClientTrait;
|
||||
use SoftDeletes {
|
||||
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')) !!}
|
||||
|
||||
@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::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
|
||||
|
||||
@if ($invoice->id)
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->dropup() !!}
|
||||
@endif
|
||||
|
||||
@elseif ($invoice->trashed())
|
||||
{!! Button::success(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@ -1007,16 +1006,17 @@
|
||||
}
|
||||
|
||||
function isEmailValid() {
|
||||
var isValid = false;
|
||||
var isValid = true;
|
||||
var sendTo = false;
|
||||
var client = model.invoice().client();
|
||||
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())) {
|
||||
isValid = true;
|
||||
if (contact.send_invoice() || client.contacts().length == 1) {
|
||||
sendTo = true;
|
||||
}
|
||||
sendTo = true;
|
||||
} else {
|
||||
isValid = false;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user