1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #4422 from turbo124/v5-stable

Fixes for email
This commit is contained in:
David Bomba 2020-12-03 09:28:18 +11:00 committed by GitHub
commit 8dfdfa1a6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 9 deletions

View File

@ -294,7 +294,7 @@ class CheckData extends Command
$wrong_balances = 0;
$wrong_paid_to_dates = 0;
foreach (Client::cursor() as $client) {
foreach (Client::where('is_deleted', 0)->cursor() as $client) {
$invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
$credit_balance = $client->credits->where('is_deleted', false)->sum('balance');
@ -318,7 +318,7 @@ class CheckData extends Command
$wrong_paid_to_dates = 0;
$credit_total_applied = 0;
Client::withTrashed()->cursor()->each(function ($client) use ($wrong_paid_to_dates, $credit_total_applied) {
Client::withTrashed()->where('is_deleted', 0)->cursor()->each(function ($client) use ($wrong_paid_to_dates, $credit_total_applied) {
$total_invoice_payments = 0;
foreach ($client->invoices->where('is_deleted', false)->where('status_id', '>', 1) as $invoice) {
@ -358,7 +358,7 @@ class CheckData extends Command
$wrong_balances = 0;
$wrong_paid_to_dates = 0;
Client::cursor()->each(function ($client) use ($wrong_balances) {
Client::cursor()->where('is_deleted', 0)->each(function ($client) use ($wrong_balances) {
$client->invoices->where('is_deleted', false)->whereIn('status_id', '!=', Invoice::STATUS_DRAFT)->each(function ($invoice) use ($wrong_balances, $client) {
$total_amount = $invoice->payments->whereIn('status_id', [Payment::STATUS_PAID, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.amount');
$total_refund = $invoice->payments->whereIn('status_id', [Payment::STATUS_PAID, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.refunded');
@ -385,7 +385,7 @@ class CheckData extends Command
$wrong_balances = 0;
$wrong_paid_to_dates = 0;
foreach (Client::cursor() as $client) {
foreach (Client::cursor()->where('is_deleted', 0) as $client) {
//$invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
$invoice_balance = Invoice::where('client_id', $client->id)->where('is_deleted', false)->where('status_id', '>', 1)->withTrashed()->sum('balance');
$client_balance = Credit::where('client_id', $client->id)->where('is_deleted', false)->withTrashed()->sum('balance');

View File

@ -13,6 +13,7 @@ namespace App\Http\Requests\Project;
use App\Http\Requests\Request;
use App\Utils\Traits\ChecksEntityStatus;
use Illuminate\Validation\Rule;
class UpdateProjectRequest extends Request
{

View File

@ -25,7 +25,7 @@ class BaseEmailEngine implements EngineInterface
public $template_style;
public $attachments;
public $attachments = [];
public $link;
@ -83,7 +83,8 @@ class BaseEmailEngine implements EngineInterface
public function setAttachments($attachments)
{
$this->attachments = $attachments;
$this->attachments = array_merge($this->getAttachments(), $attachments);
return $this;
}

View File

@ -88,7 +88,7 @@ class CreditEmailEngine extends BaseEmailEngine
->setViewText(ctrans('texts.view_credit'));
if ($this->client->getSetting('pdf_email_attachment') !== false) {
$this->setAttachments($invitation->pdf_file_path());
$this->setAttachments([$this->credit->pdf_file_path()]);
}
return $this;

View File

@ -97,7 +97,7 @@ class InvoiceEmailEngine extends BaseEmailEngine
->setViewText(ctrans('texts.view_invoice'));
if ($this->client->getSetting('pdf_email_attachment') !== false) {
$this->setAttachments($this->invoice->pdf_file_path());
$this->setAttachments([$this->invoice->pdf_file_path()]);
}
return $this;

View File

@ -88,7 +88,7 @@ class QuoteEmailEngine extends BaseEmailEngine
->setViewText(ctrans('texts.view_quote'));
if ($this->client->getSetting('pdf_email_attachment') !== false) {
$this->setAttachments($this->invitation->pdf_file_path());
$this->setAttachments([$this->invitation->pdf_file_path()]);
}
return $this;