Fixes for subscription cron query

This commit is contained in:
David Bomba 2024-06-17 10:14:04 +10:00
parent 38114d0c48
commit 742b49c75a
30 changed files with 202 additions and 214 deletions

View File

@ -31,11 +31,11 @@ class QuoteExport extends BaseExport
private Decorator $decorator;
private array $decorate_keys = [
'client',
'currency',
'invoice',
];
// private array $decorate_keys = [
// 'client',
// 'currency',
// 'invoice',
// ];
public function __construct(Company $company, array $input)
{

View File

@ -31,7 +31,7 @@ class TaskExport extends BaseExport
public string $date_key = 'created_at';
private string $date_format = 'YYYY-MM-DD';
private string $date_format = 'Y-m-d';
public Writer $csv;
@ -180,13 +180,7 @@ class TaskExport extends BaseExport
$logs = json_decode($task->time_log, 1);
$date_format_default = 'Y-m-d';
$date_format = DateFormat::find($task->company->settings->date_format_id);
if ($date_format) {
$date_format_default = $date_format->format;
}
$date_format_default = $this->date_format;
foreach ($logs as $key => $item) {
if (in_array('task.start_date', $this->input['report_keys']) || in_array('start_date', $this->input['report_keys'])) {
@ -236,7 +230,7 @@ class TaskExport extends BaseExport
*/
protected function addTaskStatusFilter(Builder $query, string $status): Builder
{
/** @var array $status_parameters */
$status_parameters = explode(',', $status);
if (in_array('all', $status_parameters) || count($status_parameters) == 0) {

View File

@ -171,16 +171,16 @@ class VendorExport extends BaseExport
return $entity;
}
private function calculateStatus($vendor)
{
if ($vendor->is_deleted) {
return ctrans('texts.deleted');
}
// private function calculateStatus($vendor)
// {
// if ($vendor->is_deleted) {
// return ctrans('texts.deleted');
// }
if ($vendor->deleted_at) {
return ctrans('texts.archived');
}
// if ($vendor->deleted_at) {
// return ctrans('texts.archived');
// }
return ctrans('texts.active');
}
// return ctrans('texts.active');
// }
}

View File

@ -144,7 +144,7 @@ class RecurringExpenseToExpenseFactory
continue;
}
if (Str::contains($match, '|')) {
// if (Str::contains($match, '|')) {
$parts = explode('|', $match); // [ '[MONTH', 'MONTH+2]' ]
$left = substr($parts[0], 1); // 'MONTH'
@ -182,7 +182,7 @@ class RecurringExpenseToExpenseFactory
$value,
1
);
}
// }
}
// Second case with more common calculations.

View File

@ -271,6 +271,7 @@ class InvoiceFilters extends QueryFilters
if (count($parts) != 2) {
return $this->builder;
}
try {
$start_date = Carbon::parse($parts[0]);
@ -281,7 +282,6 @@ class InvoiceFilters extends QueryFilters
return $this->builder;
}
return $this->builder;
}
/**
@ -307,7 +307,6 @@ class InvoiceFilters extends QueryFilters
return $this->builder;
}
return $this->builder;
}

View File

@ -204,7 +204,6 @@ class PaymentFilters extends QueryFilters
return $this->builder;
}
return $this->builder;
}
/**

View File

@ -162,9 +162,10 @@ class RecurringInvoiceFilters extends QueryFilters
return $this->builder;
}
/** @var array $key_parameters */
$key_parameters = explode(',', $value);
if (count($key_parameters)) {
if (count($key_parameters) > 0) {
return $this->builder->where(function ($query) use ($key_parameters) {
foreach ($key_parameters as $key) {
$query->orWhereJsonContains('line_items', ['product_key' => $key]);
@ -183,6 +184,7 @@ class RecurringInvoiceFilters extends QueryFilters
*/
public function next_send_between(string $range = ''): Builder
{
/** @var array $parts */
$parts = explode('|', $range);
if (!isset($parts[0]) || !isset($parts[1])) {

View File

@ -175,6 +175,7 @@ class TaskFilters extends QueryFilters
return $this->builder;
}
/** @var array $status_parameters */
$status_parameters = explode(',', $value);
if(count($status_parameters) >= 1) {

View File

@ -26,15 +26,15 @@ use BaconQrCode\Writer;
*/
class EpcQrGenerator
{
private array $sepa = [
'serviceTag' => 'BCD',
'version' => 2,
'characterSet' => 1,
'identification' => 'SCT',
'bic' => '',
'purpose' => '',
// private array $sepa = [
// 'serviceTag' => 'BCD',
// 'version' => 2,
// 'characterSet' => 1,
// 'identification' => 'SCT',
// 'bic' => '',
// 'purpose' => '',
];
// ];
public function __construct(protected Company $company, protected Invoice|RecurringInvoice $invoice, protected float $amount)
{
@ -61,13 +61,7 @@ class EpcQrGenerator
} catch(\Throwable $e) {
nlog("EPC QR failure => ".$e->getMessage());
return '';
} catch(\Exception $e) {
nlog("EPC QR failure => ".$e->getMessage());
return '';
} catch(InvalidArgumentException $e) {
nlog("EPC QR failure => ".$e->getMessage());
return '';
}
}
}

View File

@ -399,7 +399,7 @@ class InvoiceItemSumInclusive
private function shouldCalculateTax(): self
{
if (!$this->invoice->company?->calculate_taxes || $this->invoice->company->account->isFreeHostedClient()) {
if (!$this->invoice->company->calculate_taxes || $this->invoice->company->account->isFreeHostedClient()) {
$this->calc_tax = false;
return $this;
}

View File

@ -58,12 +58,12 @@ class ProRata
* Prepares the line items of an invoice
* to be pro rata refunded.
*
* @param Invoice $invoice
* @param ?Invoice $invoice
* @param bool $is_credit
* @return array
* @throws Exception
*/
public function refundItems(Invoice $invoice, $is_credit = false): array
public function refundItems(?Invoice $invoice, $is_credit = false): array
{
if (! $invoice) {
return [];

View File

@ -118,7 +118,7 @@ class ContactForgotPasswordController extends Controller
})->first();
}
$response = false;
// $response = false;
if ($contact) {
/* Update all instances of the client */
@ -131,16 +131,16 @@ class ContactForgotPasswordController extends Controller
}
if ($request->ajax()) {
if ($response == Password::RESET_THROTTLED) {
if ($response == Password::RESET_THROTTLED) { // @phpstan-ignore-line
return response()->json(['message' => ctrans('passwords.throttled'), 'status' => false], 429);
}
return $response == Password::RESET_LINK_SENT
return $response == Password::RESET_LINK_SENT // @phpstan-ignore-line
? response()->json(['message' => 'Reset link sent to your email.', 'status' => true], 201)
: response()->json(['message' => 'Email not found', 'status' => false], 401);
}
return $response == Password::RESET_LINK_SENT
return $response == Password::RESET_LINK_SENT // @phpstan-ignore-line
? $this->sendResetLinkResponse($request, $response)
: $this->sendResetLinkFailedResponse($request, $response);
}

View File

@ -55,7 +55,7 @@ class ContactLoginController extends Controller
$company = Company::where('company_key', $company_key)->first();
}
/** @var \App\Models\Company $company **/
/** @var ?\App\Models\Company $company **/
if ($company) {
$account = $company->account;
} elseif (! $company && strpos($request->getHost(), config('ninja.app_domain')) !== false) {

View File

@ -137,8 +137,8 @@ class ResetPasswordController extends Controller
return redirect('/#/login');
}
return redirect($this->redirectPath())
->with('status', trans($response));
// return redirect($this->redirectPath())
// ->with('status', trans($response));
}
}

View File

@ -1035,7 +1035,7 @@ class BaseController extends Controller
$resource = new Item($item, $transformer, $this->entity_type);
/** @var \App\Models\User $user */
/** @var ?\App\Models\User $user */
$user = auth()->user();
if ($user && request()->include_static) {

View File

@ -19,7 +19,6 @@ use Illuminate\Http\Request;
*/
class BrevoController extends BaseController
{
private $invitation;
public function __construct()
{

View File

@ -141,7 +141,7 @@ class ClientController extends BaseController
return $request->disallowUpdate();
}
/** @var \App\Models\User $user */
/** @var ?\App\Models\User $user */
$user = auth()->user();
$client = $this->client_repo->save($request->all(), $client);
@ -426,7 +426,7 @@ class ClientController extends BaseController
try {
/** @var \Postmark\Models\DynamicResponseModel $response */
/** @var ?\Postmark\Models\DynamicResponseModel $response */
$response = $postmark->activateBounce((int)$bounce_id);
if($response && $response?->Message == 'OK' && !$response->Bounce->Inactive && $response->Bounce->Email) {

View File

@ -97,12 +97,12 @@ class InvoiceController extends Controller
$invitation = false;
match($data['entity_type'] ?? false) {
match($data['entity_type'] ?? 'invoice') {
'invoice' => $invitation = InvoiceInvitation::withTrashed()->find($data['invitation_id']),
'quote' => $invitation = QuoteInvitation::withTrashed()->find($data['invitation_id']),
'credit' => $invitation = CreditInvitation::withTrashed()->find($data['invitation_id']),
'recurring_invoice' => $invitation = RecurringInvoiceInvitation::withTrashed()->find($data['invitation_id']),
false => $invitation = false,
default => $invitation = false,
};
if (! $invitation) {

View File

@ -77,6 +77,7 @@ class PaymentController extends Controller
'EUR' => $data = $bt->formatDataforEur($payment_intent),
'JPY' => $data = $bt->formatDataforJp($payment_intent),
'GBP' => $data = $bt->formatDataforUk($payment_intent),
default => $data = $bt->formatDataforUk($payment_intent),
};
$gateway = $stripe;

View File

@ -61,7 +61,7 @@ class PasswordProtection
return $next($request);
} elseif(strlen(auth()->user()->oauth_provider_id) > 2 && !auth()->user()->company()->oauth_password_required) {
return $next($request);
} elseif ($request->header('X-API-OAUTH-PASSWORD') && strlen($request->header('X-API-OAUTH-PASSWORD')) >= 1) {
} elseif ($request->header('X-API-OAUTH-PASSWORD') && strlen($request->header('X-API-OAUTH-PASSWORD')) > 1) {
//user is attempting to reauth with OAuth - check the token value
//todo expand this to include all OAuth providers
if (auth()->user()->oauth_provider_id == 'google') {

View File

@ -65,9 +65,9 @@ class SubscriptionCron
//Requires the crons to be updated and set to hourly @ 00:01
private function timezoneAware()
{
$grouped_company_ids =
Invoice::select('company_id')
Invoice::query()
->with('company')
->where('is_deleted', 0)
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('balance', '>', 0)
@ -77,10 +77,11 @@ class SubscriptionCron
->whereNotNull('subscription_id')
->groupBy('company_id')
->cursor()
->each(function ($company_id) {
->each(function ($invoice) {
/** @var \App\Models\Company $company */
$company = Company::find($company_id);
// $company = Company::find($invoice->company_id);
$company = $invoice->company;
$timezone_now = now()->setTimezone($company->timezone()->name ?? 'Pacific/Midway');

View File

@ -63,7 +63,7 @@ class TaskScheduler implements ShouldQueue
//@var \App\Models\Schedule $scheduler
$scheduler->service()->runTask();
} catch(\Exception $e) {
nlog($e->getMessage());
nlog("Exception:: TaskScheduler:: Doing job {$scheduler->name}" . $e->getMessage());
}
});

View File

@ -130,7 +130,6 @@ use Laracasts\Presenter\PresentableTrait;
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\InvoiceInvitation> $invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
* @property object|null $tax_data
* @mixin \Eloquent
*/

View File

@ -58,7 +58,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int|null $exchange_currency_id
* @property \App\Models\Paymentable $paymentable
* @property object|null $meta
* @property object|null $refund_meta
* @property array|null $refund_meta
* @property string|null $custom_value1
* @property string|null $custom_value2
* @property string|null $custom_value3

View File

@ -46,9 +46,9 @@ class EmailReport
use MakesHash;
use MakesDates;
private Client $client;
// private Client $client;
private bool $multiple_clients = false;
// private bool $multiple_clients = false;
private string $file_name = 'file.csv';
@ -66,6 +66,7 @@ class EmailReport
$data['end_date'] = $start_end_dates[1];
$data['date_range'] = $data['date_range'] ?? 'all';
$data['report_keys'] = $data['report_keys'] ?? [];
$data['include_deleted'] = $data['include_deleted'] ?? false;
$export = false;

View File

@ -124,7 +124,7 @@ class TemplateService
$this->twig->addFilter($filter);
$allowedTags = ['if', 'for', 'set', 'filter'];
$allowedFilters = ['escape', 'e', 'upper', 'lower', 'capitalize', 'filter', 'length', 'merge','format_currency','map', 'join', 'first', 'date','sum'];
$allowedFilters = ['escape', 'e', 'upper', 'lower', 'capitalize', 'filter', 'length', 'merge','format_currency', 'format_number','format_percent_number','map', 'join', 'first', 'date','sum'];
$allowedFunctions = ['range', 'cycle', 'constant', 'date',];
$allowedProperties = ['type_id'];
$allowedMethods = ['img','t'];
@ -620,8 +620,6 @@ class TemplateService
private function transformPayment(Payment $payment): array
{
$data = [];
$this->payment = $payment;
$credits = $payment->credits->map(function ($credit) use ($payment) {
@ -694,8 +692,6 @@ class TemplateService
'refund_activity' => $this->getPaymentRefundActivity($payment),
];
return $data;
}
/**
@ -1196,6 +1192,7 @@ class TemplateService
'company-details' => $this->companyDetails($stack['labels'] == 'true'),
'company-address' => $this->companyAddress($stack['labels'] == 'true'),
'shipping-details' => $this->shippingDetails($stack['labels'] == 'true'),
default => $this->entityDetails(),
};
$this->save();

View File

@ -97,15 +97,15 @@ class Helpers
switch ($custom_field) {
case 'date':
return is_null($entity) ? $value : $this->translateDate($value, $entity->date_format(), $entity->locale());
break;
case 'switch':
return trim($value ?? '') == 'yes' ? ctrans('texts.yes') : ctrans('texts.no');
break;
default:
return is_null($value) ? '' : $this->processReservedKeywords($value, $entity);
break;
}
}
@ -252,7 +252,7 @@ class Helpers
continue;
}
if (Str::contains($match, '|')) {
// if (Str::contains($match, '|')) {
$parts = explode('|', $match); // [ '[MONTH', 'MONTH+2]' ]
$left = substr($parts[0], 1); // 'MONTH'
@ -290,7 +290,7 @@ class Helpers
$value,
1
);
}
// }
}
// Second case with more common calculations.

View File

@ -45,7 +45,7 @@ class HtmlEngine
/** @var \App\Models\Client $client */
public $client;
/** @var \App\Models\ClientContact $contact */
/** @var ?\App\Models\ClientContact $contact */
public $contact;
/** @var \App\Models\Company $company */
@ -120,7 +120,7 @@ class HtmlEngine
{
if (! $this->client->currency()) {
throw new Exception(debug_backtrace()[1]['function'], 1);
exit;
// exit;
}
App::forgetInstance('translator');
@ -132,10 +132,10 @@ class HtmlEngine
$data['$global_margin'] = ['value' => '6.35mm', 'label' => ''];
$data['$company_logo_size'] = ['value' => $this->resolveCompanyLogoSize(), 'label' => ''];
$data['$show_shipping_address'] = ['value' => $this->settings?->show_shipping_address ? 'flex' : 'none', 'label' => ''];
$data['$show_shipping_address_block'] = ['value' => $this->settings?->show_shipping_address ? 'block' : 'none', 'label' => ''];
$data['$show_shipping_address'] = ['value' => $this->settings->show_shipping_address ? 'flex' : 'none', 'label' => ''];
$data['$show_shipping_address_block'] = ['value' => $this->settings->show_shipping_address ? 'block' : 'none', 'label' => ''];
// $data['$show_shipping_address_visibility'] = ['value' => $this->settings?->show_shipping_address ? 'visible' : 'hidden', 'label' => ''];
$data['$show_shipping_address_visibility'] = ['value' => $this->settings?->show_shipping_address ? 1 : 0, 'label' => ''];
$data['$show_shipping_address_visibility'] = ['value' => $this->settings->show_shipping_address ? 1 : 0, 'label' => ''];
$data['$order_number'] = ['value' => '', 'label' => ctrans('texts.order_number')];
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
@ -226,7 +226,7 @@ class HtmlEngine
$data['$status_logo'] = ['value' => '<div class="stamp is-paid"> ' . ctrans('texts.paid') .'</div>', 'label' => ''];
$data['$show_paid_stamp'] = ['value' => $this->entity->status_id == 4 && $this->settings?->show_paid_stamp ? 'flex' : 'none', 'label' => ''];
$data['$show_paid_stamp'] = ['value' => $this->entity->status_id == 4 && $this->settings->show_paid_stamp ? 'flex' : 'none', 'label' => ''];
if ($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
@ -775,8 +775,7 @@ class HtmlEngine
return '';
}
return
collect($payment->refund_meta)
return collect($payment->refund_meta)
->map(function ($refund) use ($payment) {
$date = \Carbon\Carbon::parse($refund['date'] ?? $payment->date)->addSeconds($payment->client->timezone_offset());
@ -962,20 +961,20 @@ class HtmlEngine
* @return string a collection of <tr> rows with line item
* aggregate data
*/
private function makeLineTaxes(): string
{
$tax_map = $this->entity_calc->getTaxMap();
// private function makeLineTaxes(): string
// {
// $tax_map = $this->entity_calc->getTaxMap();
$data = '';
// $data = '';
foreach ($tax_map as $tax) {
$data .= '<tr class="line_taxes">';
$data .= '<td>'.$tax['name'].'</td>';
$data .= '<td>'.Number::formatMoney($tax['total'], $this->client).'</td></tr>';
}
// foreach ($tax_map as $tax) {
// $data .= '<tr class="line_taxes">';
// $data .= '<td>'.$tax['name'].'</td>';
// $data .= '<td>'.Number::formatMoney($tax['total'], $this->client).'</td></tr>';
// }
return $data;
}
// return $data;
// }
private function lineTaxValues(): string
{
@ -990,30 +989,30 @@ class HtmlEngine
return $data;
}
private function makeTotalTaxes(): string
{
$data = '';
// private function makeTotalTaxes(): string
// {
// $data = '';
if (! $this->entity_calc->getTotalTaxMap()) {
return $data;
}
// if (! $this->entity_calc->getTotalTaxMap()) {
// return $data;
// }
foreach ($this->entity_calc->getTotalTaxMap() as $tax) {
$data .= '<tr>';
$data .= '<td colspan="{ count($this->entity->company->settings->pdf_variables->total_columns) - 2 }"></td>';
$data .= '<td>'.$tax['name'].'</td>';
$data .= '<td>'.Number::formatMoney($tax['total'], $this->client).'</td></tr>';
}
// foreach ($this->entity_calc->getTotalTaxMap() as $tax) {
// $data .= '<tr>';
// $data .= '<td colspan="{ count($this->entity->company->settings->pdf_variables->total_columns) - 2 }"></td>';
// $data .= '<td>'.$tax['name'].'</td>';
// $data .= '<td>'.Number::formatMoney($tax['total'], $this->client).'</td></tr>';
// }
return $data;
}
// return $data;
// }
private function parseLabelsAndValues($labels, $values, $section): string
{
$section = strtr($section, $labels);
// private function parseLabelsAndValues($labels, $values, $section): string
// {
// $section = strtr($section, $labels);
return strtr($section, $values);
}
// return strtr($section, $values);
// }
/*
| Ensures the URL doesn't have duplicated trailing slash
@ -1029,98 +1028,98 @@ class HtmlEngine
* of Repeating headers and footers on the PDF.
* @return string The css string
*/
private function generateCustomCSS(): string
{
$header_and_footer = '
.header, .header-space {
height: 160px;
}
// private function generateCustomCSS(): string
// {
// $header_and_footer = '
// .header, .header-space {
// height: 160px;
// }
.footer, .footer-space {
height: 160px;
}
// .footer, .footer-space {
// height: 160px;
// }
.footer {
position: fixed;
bottom: 0;
width: 100%;
}
// .footer {
// position: fixed;
// bottom: 0;
// width: 100%;
// }
.header {
position: fixed;
top: 0mm;
width: 100%;
}
// .header {
// position: fixed;
// top: 0mm;
// width: 100%;
// }
@media print {
thead {display: table-header-group;}
tfoot {display: table-footer-group;}
button {display: none;}
body {margin: 0;}
}';
// @media print {
// thead {display: table-header-group;}
// tfoot {display: table-footer-group;}
// button {display: none;}
// body {margin: 0;}
// }';
$header = '
.header, .header-space {
height: 160px;
}
// $header = '
// .header, .header-space {
// height: 160px;
// }
.header {
position: fixed;
top: 0mm;
width: 100%;
}
// .header {
// position: fixed;
// top: 0mm;
// width: 100%;
// }
@media print {
thead {display: table-header-group;}
button {display: none;}
body {margin: 0;}
}';
// @media print {
// thead {display: table-header-group;}
// button {display: none;}
// body {margin: 0;}
// }';
$footer = '
// $footer = '
.footer, .footer-space {
height: 160px;
}
// .footer, .footer-space {
// height: 160px;
// }
.footer {
position: fixed;
bottom: 0;
width: 100%;
}
// .footer {
// position: fixed;
// bottom: 0;
// width: 100%;
// }
@media print {
tfoot {display: table-footer-group;}
button {display: none;}
body {margin: 0;}
}';
$css = '';
// @media print {
// tfoot {display: table-footer-group;}
// button {display: none;}
// body {margin: 0;}
// }';
// $css = '';
if ($this->settings->all_pages_header && $this->settings->all_pages_footer) {
$css .= $header_and_footer;
} elseif ($this->settings->all_pages_header && ! $this->settings->all_pages_footer) {
$css .= $header;
} elseif (! $this->settings->all_pages_header && $this->settings->all_pages_footer) {
$css .= $footer;
}
// if ($this->settings->all_pages_header && $this->settings->all_pages_footer) {
// $css .= $header_and_footer;
// } elseif ($this->settings->all_pages_header && ! $this->settings->all_pages_footer) {
// $css .= $header;
// } elseif (! $this->settings->all_pages_header && $this->settings->all_pages_footer) {
// $css .= $footer;
// }
$css .= '
.page {
page-break-after: always;
}
// $css .= '
// .page {
// page-break-after: always;
// }
@page {
margin: 0mm
}
// @page {
// margin: 0mm
// }
html {
';
// html {
// ';
$css .= 'font-size:'.$this->settings->font_size.'px;';
// $css .= 'font-size:'.$this->settings->font_size.'px;';
$css .= '}';
// $css .= '}';
return $css;
}
// return $css;
// }
/**
* Generate markup for HTML images on entity.
@ -1200,14 +1199,14 @@ html {
';
return '
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="'. $link .'" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">'. $text .'</a>
</td>
</tr>
</table>
';
// return '
// <table border="0" cellspacing="0" cellpadding="0" align="center">
// <tr style="border: 0 !important; ">
// <td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
// <a href="'. $link .'" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">'. $text .'</a>
// </td>
// </tr>
// </table>
// ';
}
}

View File

@ -355,14 +355,14 @@ class PaymentHtmlEngine
';
return '
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="'. $link .'" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">'. $text .'</a>
</td>
</tr>
</table>
';
// return '
// <table border="0" cellspacing="0" cellpadding="0" align="center">
// <tr style="border: 0 !important; ">
// <td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
// <a href="'. $link .'" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">'. $text .'</a>
// </td>
// </tr>
// </table>
// ';
}
}

View File

@ -240,8 +240,10 @@ class TemplateEngine
} else {
$data['signature'] = $this->settings->email_signature;
$data['settings'] = $this->settings;
$data['whitelabel'] = $this->entity_obj ? $this->entity_obj->company->account->isPaid() : true;
$data['company'] = $this->entity_obj ? $this->entity_obj->company : '';
// $data['whitelabel'] = $this->entity_obj ? $this->entity_obj->company->account->isPaid() : true;
// $data['company'] = $this->entity_obj ? $this->entity_obj->company : '';
$data['whitelabel'] = $this->entity_obj->company->account->isPaid();
$data['company'] = $this->entity_obj->company;
$data['settings'] = $this->settings;
}