Fixes for custom email templates

This commit is contained in:
David Bomba 2021-04-11 13:46:40 +10:00
parent d91e8c438e
commit f5092e8cf4
3 changed files with 26 additions and 5 deletions

View File

@ -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;

View File

@ -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();

View File

@ -1 +1,16 @@
{!! $body !!}
{!! $body !!}
@isset($whitelabel)
@if(!$whitelabel)
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<p>
<a href="https://invoiceninja.com" target="_blank">
{{ __('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }}
</a>
</p>
</td>
</tr>
</table>
@endif
@endif