mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:14:30 -04:00
Support creating inline vendors and categories
This commit is contained in:
parent
595a8a5aed
commit
2135d7c973
@ -24,7 +24,10 @@ class ExpenseRequest extends EntityRequest
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
if ($this->expense_category_id == '-1' && $this->user()->can('create', ENTITY_EXPENSE_CATEGORY)) {
|
if ($this->expense_category_id == '-1'
|
||||||
|
&& trim($this->expense_category_name)
|
||||||
|
&& $this->user()->can('create', ENTITY_EXPENSE_CATEGORY))
|
||||||
|
{
|
||||||
$category = app('App\Ninja\Repositories\ExpenseCategoryRepository')->save([
|
$category = app('App\Ninja\Repositories\ExpenseCategoryRepository')->save([
|
||||||
'name' => $this->expense_category_name,
|
'name' => $this->expense_category_name,
|
||||||
]);
|
]);
|
||||||
@ -33,7 +36,10 @@ class ExpenseRequest extends EntityRequest
|
|||||||
$input['expense_category_id'] = ExpenseCategory::getPrivateId($this->expense_category_id);
|
$input['expense_category_id'] = ExpenseCategory::getPrivateId($this->expense_category_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->vendor_id == '-1' && $this->user()->can('create', ENTITY_VENDOR)) {
|
if ($this->vendor_id == '-1'
|
||||||
|
&& trim($this->vendor_name)
|
||||||
|
&& $this->user()->can('create', ENTITY_VENDOR))
|
||||||
|
{
|
||||||
$vendor = app('App\Ninja\Repositories\VendorRepository')->save([
|
$vendor = app('App\Ninja\Repositories\VendorRepository')->save([
|
||||||
'name' => $this->vendor_name,
|
'name' => $this->vendor_name,
|
||||||
]);
|
]);
|
||||||
|
@ -13,7 +13,10 @@ class TaskRequest extends EntityRequest
|
|||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
// check if we're creating a new project
|
// check if we're creating a new project
|
||||||
if ($this->project_id == '-1' && $this->user()->can('create', ENTITY_PROJECT)) {
|
if ($this->project_id == '-1'
|
||||||
|
&& trim($this->project_name)
|
||||||
|
&& $this->user()->can('create', ENTITY_PROJECT))
|
||||||
|
{
|
||||||
$project = app('App\Ninja\Repositories\ProjectRepository')->save([
|
$project = app('App\Ninja\Repositories\ProjectRepository')->save([
|
||||||
'name' => $this->project_name,
|
'name' => $this->project_name,
|
||||||
'client_id' => Client::getPrivateId($this->client),
|
'client_id' => Client::getPrivateId($this->client),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user