support budget and timeBudget in API calls (#1658)

This commit is contained in:
Kevin Papst
2020-04-23 18:49:48 +02:00
committed by GitHub
parent f8331b74c7
commit 0debc70ead
6 changed files with 29 additions and 7 deletions

View File

@@ -202,7 +202,9 @@ class ActivityController extends BaseApiController
$event = new ActivityMetaDefinitionEvent($activity);
$this->dispatcher->dispatch($event);
$form = $this->createForm(ActivityApiEditForm::class, $activity);
$form = $this->createForm(ActivityApiEditForm::class, $activity, [
'include_budget' => $this->isGranted('budget', $activity),
]);
$form->submit($request->request->all());
@@ -264,7 +266,9 @@ class ActivityController extends BaseApiController
$event = new ActivityMetaDefinitionEvent($activity);
$this->dispatcher->dispatch($event);
$form = $this->createForm(ActivityApiEditForm::class, $activity);
$form = $this->createForm(ActivityApiEditForm::class, $activity, [
'include_budget' => $this->isGranted('budget', $activity),
]);
$form->setData($activity);
$form->submit($request->request->all(), false);

View File

@@ -175,7 +175,9 @@ class CustomerController extends BaseApiController
$event = new CustomerMetaDefinitionEvent($customer);
$this->dispatcher->dispatch($event);
$form = $this->createForm(CustomerApiEditForm::class, $customer);
$form = $this->createForm(CustomerApiEditForm::class, $customer, [
'include_budget' => $this->isGranted('budget', $customer),
]);
$form->submit($request->request->all());
@@ -237,7 +239,9 @@ class CustomerController extends BaseApiController
$event = new CustomerMetaDefinitionEvent($customer);
$this->dispatcher->dispatch($event);
$form = $this->createForm(CustomerApiEditForm::class, $customer);
$form = $this->createForm(CustomerApiEditForm::class, $customer, [
'include_budget' => $this->isGranted('budget', $customer),
]);
$form->setData($customer);
$form->submit($request->request->all(), false);

View File

@@ -224,6 +224,7 @@ class ProjectController extends BaseApiController
$form = $this->createForm(ProjectApiEditForm::class, $project, [
'date_format' => self::DATE_FORMAT,
'include_budget' => $this->isGranted('budget', $project),
]);
$form->submit($request->request->all());
@@ -288,6 +289,7 @@ class ProjectController extends BaseApiController
$form = $this->createForm(ProjectApiEditForm::class, $project, [
'date_format' => self::DATE_FORMAT,
'include_budget' => $this->isGranted('budget', $project),
]);
$form->setData($project);