mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 02:04:46 -04:00
Adjustments for auto billing
This commit is contained in:
parent
8e431a4138
commit
d2325bed7c
@ -55,7 +55,17 @@ class SmtpController extends BaseController
|
|||||||
(new \Illuminate\Mail\MailServiceProvider(app()))->register();
|
(new \Illuminate\Mail\MailServiceProvider(app()))->register();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Mail::mailer('smtp')->to($user->email, $user->present()->name())->send(new TestMailServer('Email Server Works!', strlen($company->settings->custom_sending_email) > 1 ? $company->settings->custom_sending_email : $user->email));
|
|
||||||
|
$sending_email = (isset($company->settings->custom_sending_email) && stripos($company->settings->custom_sending_email, "@")) ? $company->settings->custom_sending_email : $user->email;
|
||||||
|
$sending_user = (isset($company->settings->email_from_name) && strlen($company->settings->email_from_name) > 2) ? $company->settings->email_from_name : $user->name();
|
||||||
|
|
||||||
|
$mailable = new TestMailServer('Email Server Works!', $sending_email);
|
||||||
|
$mailable->from($sending_email,$sending_user);
|
||||||
|
|
||||||
|
Mail::mailer('smtp')
|
||||||
|
->to($user->email, $user->present()->name())
|
||||||
|
->send($mailable);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
app('mail.manager')->forgetMailers();
|
app('mail.manager')->forgetMailers();
|
||||||
return response()->json(['message' => $e->getMessage()], 400);
|
return response()->json(['message' => $e->getMessage()], 400);
|
||||||
|
@ -76,12 +76,12 @@ class SendRecurring implements ShouldQueue
|
|||||||
$invoice = $invoice->service()
|
$invoice = $invoice->service()
|
||||||
->markSent()
|
->markSent()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->fillDefaults()
|
->fillDefaults(true)
|
||||||
->adjustInventory()
|
->adjustInventory()
|
||||||
->save();
|
->save();
|
||||||
} else {
|
} else {
|
||||||
$invoice = $invoice->service()
|
$invoice = $invoice->service()
|
||||||
->fillDefaults()
|
->fillDefaults(true)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ class InvoiceService
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fillDefaults()
|
public function fillDefaults(bool $is_recurring = false)
|
||||||
{
|
{
|
||||||
$this->invoice->load('client.company');
|
$this->invoice->load('client.company');
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ class InvoiceService
|
|||||||
$this->invoice->exchange_rate = $this->invoice->client->setExchangeRate();
|
$this->invoice->exchange_rate = $this->invoice->client->setExchangeRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->invoice->client->getSetting('auto_bill_standard_invoices')) {
|
if ($is_recurring && $this->invoice->client->getSetting('auto_bill_standard_invoices')) {
|
||||||
$this->invoice->auto_bill_enabled = true;
|
$this->invoice->auto_bill_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user