API: added activities create and update (#717)

This commit is contained in:
horlabs
2019-04-22 16:16:06 +02:00
committed by Kevin Papst
parent f9c8028ea1
commit 46cb021260
4 changed files with 216 additions and 8 deletions

View File

@@ -35,17 +35,22 @@ class ActivityEditForm extends AbstractType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
/** @var Activity $entry */
$entry = $options['data'];
$project = null;
$customer = null;
$currency = false;
$id = null;
if (null !== $entry->getProject()) {
$project = $entry->getProject();
$customer = $project->getCustomer();
$currency = $customer->getCurrency();
if (isset($options['data'])) {
/** @var Activity $entry */
$entry = $options['data'];
if (null !== $entry->getProject()) {
$project = $entry->getProject();
$customer = $project->getCustomer();
$currency = $customer->getCurrency();
}
$id = $entry->getId();
}
$builder
@@ -114,7 +119,7 @@ class ActivityEditForm extends AbstractType
])
;
if (null === $entry->getId()) {
if (null === $id) {
$builder->add('create_more', CheckboxType::class, [
'label' => 'label.create_more',
'required' => false,