mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-05 23:14:36 -04:00
Merge pull request #4710 from turbo124/v5-develop
Fixes for how we login a client contact
This commit is contained in:
commit
a2ef4f6ec7
@ -37,9 +37,12 @@ class FeesAndLimits
|
|||||||
|
|
||||||
public $adjust_fee_percent = false;
|
public $adjust_fee_percent = false;
|
||||||
|
|
||||||
|
public $is_enabled = true;
|
||||||
|
|
||||||
//public $gateway_type_id = 1;
|
//public $gateway_type_id = 1;
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'is_enabled' => 'bool',
|
||||||
'gateway_type_id' => 'int',
|
'gateway_type_id' => 'int',
|
||||||
'min_limit' => 'float',
|
'min_limit' => 'float',
|
||||||
'max_limit' => 'float',
|
'max_limit' => 'float',
|
||||||
|
@ -22,6 +22,7 @@ use App\Models\GroupSetting;
|
|||||||
use App\Repositories\GroupSettingRepository;
|
use App\Repositories\GroupSettingRepository;
|
||||||
use App\Transformers\GroupSettingTransformer;
|
use App\Transformers\GroupSettingTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use App\Utils\Traits\Uploadable;
|
use App\Utils\Traits\Uploadable;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -32,6 +33,7 @@ class GroupSettingController extends BaseController
|
|||||||
use DispatchesJobs;
|
use DispatchesJobs;
|
||||||
use Uploadable;
|
use Uploadable;
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
protected $entity_type = GroupSetting::class;
|
protected $entity_type = GroupSetting::class;
|
||||||
|
|
||||||
@ -357,6 +359,9 @@ class GroupSettingController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $group_setting->company, $group_setting);
|
$this->uploadLogo($request->file('company_logo'), $group_setting->company, $group_setting);
|
||||||
|
|
||||||
|
if ($request->has('documents'))
|
||||||
|
$this->saveDocuments($request->input('documents'), $group_setting, false);
|
||||||
|
|
||||||
return $this->itemResponse($group_setting);
|
return $this->itemResponse($group_setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class ReminderJob implements ShouldQueue
|
|||||||
Invoice::where('next_send_date', Carbon::today()->format('Y-m-d'))->with('invitations')->cursor()->each(function ($invoice) {
|
Invoice::where('next_send_date', Carbon::today()->format('Y-m-d'))->with('invitations')->cursor()->each(function ($invoice) {
|
||||||
if ($invoice->isPayable()) {
|
if ($invoice->isPayable()) {
|
||||||
$reminder_template = $invoice->calculateTemplate('invoice');
|
$reminder_template = $invoice->calculateTemplate('invoice');
|
||||||
$invoice->service()->touchReminder($this->reminder_template)->save();
|
$invoice->service()->touchReminder($reminder_template)->save();
|
||||||
|
|
||||||
$invoice->invitations->each(function ($invitation) use ($invoice, $reminder_template) {
|
$invoice->invitations->each(function ($invitation) use ($invoice, $reminder_template) {
|
||||||
EmailEntity::dispatch($invitation, $invitation->company, $reminder_template);
|
EmailEntity::dispatch($invitation, $invitation->company, $reminder_template);
|
||||||
|
@ -87,6 +87,12 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
|||||||
'client_id',
|
'client_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/* Changing the username to id allows us to login() a contact that doesn't have an email address set*/
|
||||||
|
public function username()
|
||||||
|
{
|
||||||
|
return 'id';
|
||||||
|
}
|
||||||
|
|
||||||
public function getEntityType()
|
public function getEntityType()
|
||||||
{
|
{
|
||||||
return self::class;
|
return self::class;
|
||||||
|
@ -51,6 +51,11 @@ class GroupSetting extends StaticModel
|
|||||||
return $this->hasMany(Client::class, 'id', 'group_settings_id');
|
return $this->hasMany(Client::class, 'id', 'group_settings_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function documents()
|
||||||
|
{
|
||||||
|
return $this->morphMany(Document::class, 'documentable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the model for a bound value.
|
* Retrieve the model for a bound value.
|
||||||
*
|
*
|
||||||
|
@ -202,10 +202,6 @@ class BaseRepository
|
|||||||
|
|
||||||
/* Model now persisted, now lets do some child tasks */
|
/* Model now persisted, now lets do some child tasks */
|
||||||
|
|
||||||
/* If client currency differs from the company default currency, then insert the client exchange rate on the model.*/
|
|
||||||
if($client->currency()->id != (int) $model->company->settings->currency_id)
|
|
||||||
$model->exchange_rate = $client->currency()->exchange_rate;
|
|
||||||
|
|
||||||
/* Save any documents */
|
/* Save any documents */
|
||||||
if (array_key_exists('documents', $data))
|
if (array_key_exists('documents', $data))
|
||||||
$this->saveDocuments($data['documents'], $model);
|
$this->saveDocuments($data['documents'], $model);
|
||||||
|
@ -76,6 +76,7 @@ class ClientContactRepository extends BaseRepository
|
|||||||
$new_contact->client_id = $client->id;
|
$new_contact->client_id = $client->id;
|
||||||
$new_contact->contact_key = Str::random(40);
|
$new_contact->contact_key = Str::random(40);
|
||||||
$new_contact->is_primary = true;
|
$new_contact->is_primary = true;
|
||||||
|
$new_contact->confirmed = true;
|
||||||
$new_contact->save();
|
$new_contact->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,17 +102,21 @@ class CreditService
|
|||||||
{
|
{
|
||||||
$settings = $this->credit->client->getMergedSettings();
|
$settings = $this->credit->client->getMergedSettings();
|
||||||
|
|
||||||
if (! $this->credit->design_id) {
|
if (! $this->credit->design_id)
|
||||||
$this->credit->design_id = $this->decodePrimaryKey($settings->credit_design_id);
|
$this->credit->design_id = $this->decodePrimaryKey($settings->credit_design_id);
|
||||||
}
|
|
||||||
|
if (!isset($this->credit->footer))
|
||||||
if (!isset($this->credit->footer)) {
|
|
||||||
$this->credit->footer = $settings->credit_footer;
|
$this->credit->footer = $settings->credit_footer;
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->credit->terms)) {
|
if (!isset($this->credit->terms))
|
||||||
$this->credit->terms = $settings->credit_terms;
|
$this->credit->terms = $settings->credit_terms;
|
||||||
}
|
|
||||||
|
/* If client currency differs from the company default currency, then insert the client exchange rate on the model.*/
|
||||||
|
if(!isset($this->credit->exchange_rate) && $this->credit->client->currency()->id != (int) $this->credit->company->settings->currency_id)
|
||||||
|
$this->credit->exchange_rate = $this->credit->client->currency()->exchange_rate;
|
||||||
|
|
||||||
|
if (!isset($this->credit->public_notes))
|
||||||
|
$this->credit->public_notes = $this->credit->client->public_notes;
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -364,18 +364,22 @@ class InvoiceService
|
|||||||
{
|
{
|
||||||
$settings = $this->invoice->client->getMergedSettings();
|
$settings = $this->invoice->client->getMergedSettings();
|
||||||
|
|
||||||
if (! $this->invoice->design_id) {
|
if (! $this->invoice->design_id)
|
||||||
$this->invoice->design_id = $this->decodePrimaryKey($settings->invoice_design_id);
|
$this->invoice->design_id = $this->decodePrimaryKey($settings->invoice_design_id);
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->invoice->footer)) {
|
|
||||||
$this->invoice->footer = $settings->invoice_footer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->invoice->terms)) {
|
|
||||||
$this->invoice->terms = $settings->invoice_terms;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!isset($this->invoice->footer))
|
||||||
|
$this->invoice->footer = $settings->invoice_footer;
|
||||||
|
|
||||||
|
if (!isset($this->invoice->terms))
|
||||||
|
$this->invoice->terms = $settings->invoice_terms;
|
||||||
|
|
||||||
|
if (!isset($this->invoice->public_notes))
|
||||||
|
$this->invoice->public_notes = $this->invoice->client->public_notes;
|
||||||
|
|
||||||
|
/* If client currency differs from the company default currency, then insert the client exchange rate on the model.*/
|
||||||
|
if(!isset($this->invoice->exchange_rate) && $this->invoice->client->currency()->id != (int) $this->invoice->company->settings->currency_id)
|
||||||
|
$this->invoice->exchange_rate = $this->invoice->client->currency()->exchange_rate;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,18 +159,21 @@ class QuoteService
|
|||||||
{
|
{
|
||||||
$settings = $this->quote->client->getMergedSettings();
|
$settings = $this->quote->client->getMergedSettings();
|
||||||
|
|
||||||
if (! $this->quote->design_id) {
|
if (! $this->quote->design_id)
|
||||||
$this->quote->design_id = $this->decodePrimaryKey($settings->quote_design_id);
|
$this->quote->design_id = $this->decodePrimaryKey($settings->quote_design_id);
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->quote->footer)) {
|
if (!isset($this->quote->footer))
|
||||||
$this->quote->footer = $settings->quote_footer;
|
$this->quote->footer = $settings->quote_footer;
|
||||||
}
|
|
||||||
|
if (!isset($this->quote->terms))
|
||||||
if (!isset($this->quote->terms)) {
|
|
||||||
$this->quote->terms = $settings->quote_terms;
|
$this->quote->terms = $settings->quote_terms;
|
||||||
}
|
|
||||||
|
/* If client currency differs from the company default currency, then insert the client exchange rate on the model.*/
|
||||||
|
if(!isset($this->quote->exchange_rate) && $this->quote->client->currency()->id != (int) $this->quote->company->settings->currency_id)
|
||||||
|
$this->quote->exchange_rate = $this->quote->client->currency()->exchange_rate;
|
||||||
|
|
||||||
|
if (!isset($this->quote->public_notes))
|
||||||
|
$this->quote->public_notes = $this->quote->client->public_notes;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ class AccountTransformer extends EntityTransformer
|
|||||||
'archived_at' => (int) $account->deleted_at,
|
'archived_at' => (int) $account->deleted_at,
|
||||||
'report_errors' => (bool) $account->report_errors,
|
'report_errors' => (bool) $account->report_errors,
|
||||||
'debug_enabled' => (bool) config('ninja.debug_enabled'),
|
'debug_enabled' => (bool) config('ninja.debug_enabled'),
|
||||||
|
'is_docker' => (bool) config('ninja.is_docker'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ return [
|
|||||||
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
||||||
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', true),
|
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', true),
|
||||||
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
||||||
|
'is_docker' => env('IS_DOCKER', false),
|
||||||
'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://9b4e15e575214354a7d666489783904a@sentry.invoicing.co/6'),
|
'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://9b4e15e575214354a7d666489783904a@sentry.invoicing.co/6'),
|
||||||
'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
|
'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user