1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Merge pull request #6565 from turbo124/v5-develop

Allow users to define From Name in UI
This commit is contained in:
David Bomba 2021-09-03 23:00:06 +10:00 committed by GitHub
commit ceec85f15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 6 deletions

View File

@ -267,8 +267,10 @@ class CompanySettings extends BaseSettings
public $use_credits_payment = 'off'; //always, option, off //@implemented
public $hide_empty_columns_on_pdf = false;
public $email_from_name = '';
public static $casts = [
'email_from_name' => 'string',
'show_all_tasks_client_portal' => 'string',
'entity_send_time' => 'int',
'shared_invoice_credit_counter' => 'bool',

View File

@ -79,7 +79,14 @@ class TemplateEmail extends Mailable
else
$signature = $settings->email_signature;
$this->from(config('mail.from.address'), $this->company->present()->name());
if(property_exists($settings, 'email_from_name') && strlen($settings->email_from_name) > 1)
$email_from_name = $settings->email_from_name;
else
$email_from_name = $this->company->present()->name();
nlog($email_from_name);
$this->from(config('mail.from.address'), $email_from_name);
if (strlen($settings->bcc_email) > 1)
$this->bcc(explode(",",$settings->bcc_email));

View File

@ -14,6 +14,7 @@ namespace App\Services\Invoice;
use App\DataMapper\InvoiceItem;
use App\Events\Payment\PaymentWasCreated;
use App\Factory\PaymentFactory;
use App\Libraries\MultiDB;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\Payment;
@ -31,15 +32,22 @@ class AutoBillInvoice extends AbstractService
private $used_credit = [];
public function __construct(Invoice $invoice)
protected $db;
public function __construct(Invoice $invoice, $db)
{
$this->invoice = $invoice;
$this->client = $invoice->client;
$this->db = $db;
}
public function run()
{
MultiDB::setDb($this->db);
$this->client = $this->invoice->client;
$is_partial = false;
/* Is the invoice payable? */
@ -82,7 +90,6 @@ class AutoBillInvoice extends AbstractService
}
/* $gateway fee */
//$fee = $gateway_token->gateway->calcGatewayFee($amount, $gateway_token->gateway_type_id, $this->invoice->uses_inclusive_taxes);
$this->invoice = $this->invoice->service()->addGatewayFee($gateway_token->gateway, $gateway_token->gateway_type_id, $amount)->save();
if($is_partial)

View File

@ -233,7 +233,7 @@ class InvoiceService
public function autoBill()
{
$this->invoice = (new AutoBillInvoice($this->invoice))->run();
$this->invoice = (new AutoBillInvoice($this->invoice, $this->invoice->company->db))->run();
return $this;
}