Fixes for tests (#3395)
This commit is contained in:
parent
7abab22c43
commit
fba88c2d62
1 changed files with 25 additions and 7 deletions
|
|
@ -32,15 +32,12 @@ class StoreQuoteRequest extends Request
|
|||
return auth()->user()->can('create', Quote::class);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (isset($input['client_id'])) {
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
if($input['client_id'])
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
|
||||
if(isset($input['client_contacts']))
|
||||
{
|
||||
|
|
@ -53,7 +50,28 @@ class StoreQuoteRequest extends Request
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(isset($input['invitations']))
|
||||
{
|
||||
|
||||
foreach($input['invitations'] as $key => $value)
|
||||
{
|
||||
|
||||
if(isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id']))
|
||||
unset($input['invitations'][$key]['id']);
|
||||
|
||||
if(isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id']))
|
||||
$input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']);
|
||||
|
||||
if(is_string($input['invitations'][$key]['client_contact_id']))
|
||||
$input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
//$input['line_items'] = json_encode($input['line_items']);
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue