diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 7598a54c4ea2..68350ecb1298 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -49,6 +49,10 @@ class TemplateEmail extends Mailable { $template_name = 'email.template.'.$this->build_email->getTemplate(); + if($this->build_email->getTemplate() == 'custom') { + $this->build_email->setBody(str_replace('$body', $this->build_email->getBody(), $this->client->getSetting('email_style_custom'))); + } + $settings = $this->client->getMergedSettings(); $company = $this->client->company; diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index 5442488dbc39..494e53d2b141 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -200,15 +200,17 @@ class SubscriptionService if ($outstanding->count() == 0){ //nothing outstanding + return $target->price; } - elseif ($outstanding_amounts > $current_amount){ + elseif ($outstanding->count() == 1){ //user has multiple amounts outstanding + return $target->price - $this->calculateProRataRefund($outstanding->first()); } - elseif ($outstanding_amounts < $current_amount && $outstanding_amounts > 0) { + elseif ($outstanding->count > 1) { //user is changing plan mid frequency cycle + //we cannot handle this if there are more than one invoice outstanding. } - // $current_plan_price = $this->subscription } private function calculateProRataRefund($invoice) @@ -278,7 +280,7 @@ class SubscriptionService } - private function convertInvoiceToRecurring($client_id) + private function convertInvoiceToRecurring($client_id) :RecurringInvoice { $subscription_repo = new SubscriptionRepository(); diff --git a/resources/views/email/template/custom.blade.php b/resources/views/email/template/custom.blade.php index c6e607594375..07dff7f28c56 100644 --- a/resources/views/email/template/custom.blade.php +++ b/resources/views/email/template/custom.blade.php @@ -1 +1,16 @@ -{!! $body !!} \ No newline at end of file +{!! $body !!} +@isset($whitelabel) + @if(!$whitelabel) +
+ + + {{ __('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} + + + |
+