mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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();
|
||||
|
||||
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) {
|
||||
app('mail.manager')->forgetMailers();
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
|
@ -76,12 +76,12 @@ class SendRecurring implements ShouldQueue
|
||||
$invoice = $invoice->service()
|
||||
->markSent()
|
||||
->applyNumber()
|
||||
->fillDefaults()
|
||||
->fillDefaults(true)
|
||||
->adjustInventory()
|
||||
->save();
|
||||
} else {
|
||||
$invoice = $invoice->service()
|
||||
->fillDefaults()
|
||||
->fillDefaults(true)
|
||||
->save();
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ class InvoiceService
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function fillDefaults()
|
||||
public function fillDefaults(bool $is_recurring = false)
|
||||
{
|
||||
$this->invoice->load('client.company');
|
||||
|
||||
@ -571,7 +571,7 @@ class InvoiceService
|
||||
$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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user