Transformer fixes

This commit is contained in:
Hillel Coren 2018-06-28 18:16:11 +03:00
parent 392d68ffc5
commit 0832b823c8

View File

@ -33,44 +33,44 @@ class UserAccountTransformer extends EntityTransformer
return [ return [
'account_key' => $account->account_key, 'account_key' => $account->account_key,
'name' => $account->present()->name, 'name' => $account->present()->name ?: '',
'token' => $account->getToken($user->id, $this->tokenName), 'token' => $account->getToken($user->id, $this->tokenName),
'default_url' => SITE_URL, 'default_url' => SITE_URL,
'plan' => $account->company->plan, 'plan' => $account->company->plan ?: '',
'logo' => $account->logo, 'logo' => $account->logo ?: '',
'logo_url' => $account->getLogoURL(), 'logo_url' => $account->getLogoURL(),
'currency_id' => (int) $account->currency_id, 'currency_id' => (int) $account->currency_id,
'timezone_id' => (int) $account->timezone_id, 'timezone_id' => (int) $account->timezone_id,
'date_format_id' => (int) $account->date_format_id, 'date_format_id' => (int) $account->date_format_id,
'datetime_format_id' => (int) $account->datetime_format_id, 'datetime_format_id' => (int) $account->datetime_format_id,
'invoice_terms' => $account->invoice_terms, 'invoice_terms' => $account->invoice_terms ?: '',
'invoice_taxes' => (bool) $account->invoice_taxes, 'invoice_taxes' => (bool) $account->invoice_taxes,
'invoice_item_taxes' => (bool) $account->invoice_item_taxes, 'invoice_item_taxes' => (bool) $account->invoice_item_taxes,
'invoice_design_id' => (int) $account->invoice_design_id, 'invoice_design_id' => (int) $account->invoice_design_id,
'quote_design_id' => (int) $account->quote_design_id, 'quote_design_id' => (int) $account->quote_design_id,
'language_id' => (int) $account->language_id, 'language_id' => (int) $account->language_id,
'invoice_footer' => $account->invoice_footer, 'invoice_footer' => $account->invoice_footer ?: '',
'invoice_labels' => $account->invoice_labels, 'invoice_labels' => $account->invoice_labels ?: '',
'show_item_taxes' => (bool) $account->show_item_taxes, 'show_item_taxes' => (bool) $account->show_item_taxes,
'military_time' => (bool) $account->military_time, 'military_time' => (bool) $account->military_time,
'tax_name1' => $account->tax_name1 ?: '', 'tax_name1' => $account->tax_name1 ?: '',
'tax_rate1' => (float) $account->tax_rate1, 'tax_rate1' => (float) $account->tax_rate1,
'tax_name2' => $account->tax_name2 ?: '', 'tax_name2' => $account->tax_name2 ?: '',
'tax_rate2' => (float) $account->tax_rate2, 'tax_rate2' => (float) $account->tax_rate2,
'quote_terms' => $account->quote_terms, 'quote_terms' => $account->quote_terms ?: '',
'show_currency_code' => (bool) $account->show_currency_code, 'show_currency_code' => (bool) $account->show_currency_code,
'enable_second_tax_rate' => (bool) $account->enable_second_tax_rate, 'enable_second_tax_rate' => (bool) $account->enable_second_tax_rate,
'start_of_week' => $account->start_of_week, 'start_of_week' => (int) $account->start_of_week,
'financial_year_start' => $account->financial_year_start, 'financial_year_start' => (int) $account->financial_year_start,
'enabled_modules' => (int) $account->enabled_modules, 'enabled_modules' => (int) $account->enabled_modules,
'payment_terms' => (int) $account->payment_terms, 'payment_terms' => (int) $account->payment_terms,
'payment_type_id' => (int) $account->payment_type_id, 'payment_type_id' => (int) $account->payment_type_id,
'task_rate' => (float) $account->task_rate, 'task_rate' => (float) $account->task_rate,
'inclusive_taxes' => (bool) $account->inclusive_taxes, 'inclusive_taxes' => (bool) $account->inclusiveu_taxes,
'convert_products' => (bool) $account->convert_products, 'convert_products' => (bool) $account->convert_products,
'custom_invoice_taxes1' => $account->custom_invoice_taxes1, 'custom_invoice_taxes1' => (bool) $account->custom_invoice_taxes1,
'custom_invoice_taxes2' => $account->custom_invoice_taxes1, 'custom_invoice_taxes2' => (bool) $account->custom_invoice_taxes1,
'custom_fields' => $account->custom_fields, 'custom_fields' => $account->custom_fields ?: '',
]; ];
} }
} }