mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for blank client settings and force strings for custom_fields (#3096)
* fix for blank client settings * Force all custom fields to strings
This commit is contained in:
parent
0606973035
commit
4b4921703a
@ -84,6 +84,8 @@ class ClientSettings extends BaseSettings
|
||||
public static function buildClientSettings($company_settings, $client_settings)
|
||||
{
|
||||
|
||||
if(!$client_settings)
|
||||
return $company_settings;
|
||||
|
||||
foreach($company_settings as $key => $value)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class UpdateCompanyRequest extends Request
|
||||
|
||||
public function rules()
|
||||
{
|
||||
|
||||
|
||||
$rules = [];
|
||||
|
||||
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb
|
||||
|
@ -48,6 +48,9 @@ class CompanyRepository extends BaseRepository
|
||||
public function save(array $data, Company $company) : ?Company
|
||||
{
|
||||
|
||||
if(isset($data['custom_fields']))
|
||||
$data['custom_fields'] = $this->parseCustomFields($data['custom_fields']);
|
||||
|
||||
$company->fill($data);
|
||||
|
||||
$company->save();
|
||||
@ -56,4 +59,14 @@ class CompanyRepository extends BaseRepository
|
||||
|
||||
}
|
||||
|
||||
private function parseCustomFields($fields) :array
|
||||
{
|
||||
foreach($fields as &$value)
|
||||
{
|
||||
$value = (string)$value;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
@ -46,10 +46,10 @@ class CompanyUserTransformer extends EntityTransformer
|
||||
public function transform(CompanyUser $company_user)
|
||||
{
|
||||
return [
|
||||
'id' => $company_user->id,
|
||||
'account_id' => $company_user->account_id,
|
||||
'user_id' => $company_user->user_id,
|
||||
'company_id' => $company_user->company_id,
|
||||
// 'id' => $company_user->id,
|
||||
// 'account_id' => $company_user->account_id,
|
||||
// 'user_id' => $company_user->user_id,
|
||||
// 'company_id' => $company_user->company_id,
|
||||
'permissions' => $company_user->permissions ?: '',
|
||||
'settings' => $company_user->settings ?: '',
|
||||
'is_owner' => (bool) $company_user->is_owner,
|
||||
|
Loading…
x
Reference in New Issue
Block a user