diff --git a/app/DataMapper/FeesAndLimits.php b/app/DataMapper/FeesAndLimits.php index ecb51cc0130f..922a6cb486c1 100644 --- a/app/DataMapper/FeesAndLimits.php +++ b/app/DataMapper/FeesAndLimits.php @@ -37,9 +37,12 @@ class FeesAndLimits public $adjust_fee_percent = false; + public $is_enabled = true; + //public $gateway_type_id = 1; public static $casts = [ + 'is_enabled' => 'bool', 'gateway_type_id' => 'int', 'min_limit' => 'float', 'max_limit' => 'float', diff --git a/app/Http/Controllers/GroupSettingController.php b/app/Http/Controllers/GroupSettingController.php index 1f79f7838dc8..8f7f828270e0 100644 --- a/app/Http/Controllers/GroupSettingController.php +++ b/app/Http/Controllers/GroupSettingController.php @@ -22,6 +22,7 @@ use App\Models\GroupSetting; use App\Repositories\GroupSettingRepository; use App\Transformers\GroupSettingTransformer; use App\Utils\Traits\MakesHash; +use App\Utils\Traits\SavesDocuments; use App\Utils\Traits\Uploadable; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Http\Request; @@ -32,6 +33,7 @@ class GroupSettingController extends BaseController use DispatchesJobs; use Uploadable; use MakesHash; + use SavesDocuments; protected $entity_type = GroupSetting::class; @@ -357,6 +359,9 @@ class GroupSettingController extends BaseController $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); } diff --git a/app/Jobs/Util/ReminderJob.php b/app/Jobs/Util/ReminderJob.php index ea72979d617d..f6f53f176229 100644 --- a/app/Jobs/Util/ReminderJob.php +++ b/app/Jobs/Util/ReminderJob.php @@ -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) { if ($invoice->isPayable()) { $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) { EmailEntity::dispatch($invitation, $invitation->company, $reminder_template); diff --git a/app/Models/GroupSetting.php b/app/Models/GroupSetting.php index 14d4178a37fe..b94fffbbfd3b 100644 --- a/app/Models/GroupSetting.php +++ b/app/Models/GroupSetting.php @@ -51,6 +51,11 @@ class GroupSetting extends StaticModel 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. * diff --git a/app/Services/Credit/CreditService.php b/app/Services/Credit/CreditService.php index e2a4b2229525..a1739b825de4 100644 --- a/app/Services/Credit/CreditService.php +++ b/app/Services/Credit/CreditService.php @@ -114,6 +114,10 @@ class CreditService /* 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; } diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 295d15e84f70..5b14d4f8f3c6 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -372,6 +372,9 @@ class InvoiceService 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) diff --git a/app/Services/Quote/QuoteService.php b/app/Services/Quote/QuoteService.php index b8c2195f91fc..4feefda7b944 100644 --- a/app/Services/Quote/QuoteService.php +++ b/app/Services/Quote/QuoteService.php @@ -171,6 +171,9 @@ class QuoteService /* 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; }