mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:24:30 -04:00
minor clean up
This commit is contained in:
parent
a65d0d5067
commit
50f13eca5a
@ -33,9 +33,9 @@ class StoreNoteRequest extends Request
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'entity' => 'required|in:invoices,quotes,credits,recurring_invoices,clients,vendors,credits,payments,projects,tasks,expenses,recurring_expenses,bank_transactions,purchase_orders',
|
'entity' => 'required|bail|in:invoices,quotes,credits,recurring_invoices,clients,vendors,credits,payments,projects,tasks,expenses,recurring_expenses,bank_transactions,purchase_orders',
|
||||||
'entity_id' => ['required','bail', Rule::exists($this->entity, 'id')->where('company_id', $user->company()->id)],
|
'entity_id' => ['required','bail', Rule::exists($this->entity, 'id')->where('company_id', $user->company()->id)],
|
||||||
'notes' => 'required',
|
'notes' => 'required|bail',
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
@ -68,6 +68,9 @@ class StoreNoteRequest extends Request
|
|||||||
|
|
||||||
public function getEntity()
|
public function getEntity()
|
||||||
{
|
{
|
||||||
|
if(!$this->entity)
|
||||||
|
return false;
|
||||||
|
|
||||||
$class = "\\App\\Models\\".ucfirst(Str::camel(rtrim($this->entity, 's')));
|
$class = "\\App\\Models\\".ucfirst(Str::camel(rtrim($this->entity, 's')));
|
||||||
return $class::withTrashed()->find(is_string($this->entity_id) ? $this->decodePrimaryKey($this->entity_id) : $this->entity_id);
|
return $class::withTrashed()->find(is_string($this->entity_id) ? $this->decodePrimaryKey($this->entity_id) : $this->entity_id);
|
||||||
|
|
||||||
|
@ -70,16 +70,18 @@ class ClientTransformer extends BaseTransformer
|
|||||||
'custom_value2' => $this->getString($data, 'client.custom_value2'),
|
'custom_value2' => $this->getString($data, 'client.custom_value2'),
|
||||||
'custom_value3' => $this->getString($data, 'client.custom_value3'),
|
'custom_value3' => $this->getString($data, 'client.custom_value3'),
|
||||||
'custom_value4' => $this->getString($data, 'client.custom_value4'),
|
'custom_value4' => $this->getString($data, 'client.custom_value4'),
|
||||||
'balance' => preg_replace(
|
// 'balance' => preg_replace(
|
||||||
'/[^0-9,.]+/',
|
// '/[^0-9,.]+/',
|
||||||
'',
|
// '',
|
||||||
$this->getFloat($data, 'client.balance')
|
// $this->getFloat($data, 'client.balance')
|
||||||
),
|
// ),
|
||||||
'paid_to_date' => preg_replace(
|
// 'paid_to_date' => preg_replace(
|
||||||
'/[^0-9,.]+/',
|
// '/[^0-9,.]+/',
|
||||||
'',
|
// '',
|
||||||
$this->getFloat($data, 'client.paid_to_date')
|
// $this->getFloat($data, 'client.paid_to_date')
|
||||||
),
|
// ),
|
||||||
|
'paid_to_date' => 0,
|
||||||
|
'balance' => 0,
|
||||||
'credit_balance' => 0,
|
'credit_balance' => 0,
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'client_hash' => Str::random(40),
|
'client_hash' => Str::random(40),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user