fix toolbar requests for empty choice (#758)
This commit is contained in:
@@ -97,7 +97,7 @@ class ActivityController extends BaseApiController
|
||||
$query->setOrderGlobalsFirst(false);
|
||||
}
|
||||
|
||||
if (null !== ($project = $paramFetcher->get('project'))) {
|
||||
if (!empty($project = $paramFetcher->get('project'))) {
|
||||
$query->setProject($project);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class ProjectController extends BaseApiController
|
||||
$query->setOrderBy($orderBy);
|
||||
}
|
||||
|
||||
if (null !== ($customer = $paramFetcher->get('customer'))) {
|
||||
if (!empty($customer = $paramFetcher->get('customer'))) {
|
||||
$query->setCustomer($customer);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,15 +111,15 @@ class TimesheetController extends BaseApiController
|
||||
$query->setUser($user);
|
||||
}
|
||||
|
||||
if (null !== ($customer = $paramFetcher->get('customer'))) {
|
||||
if (!empty($customer = $paramFetcher->get('customer'))) {
|
||||
$query->setCustomer($customer);
|
||||
}
|
||||
|
||||
if (null !== ($project = $paramFetcher->get('project'))) {
|
||||
if (!empty($project = $paramFetcher->get('project'))) {
|
||||
$query->setProject($project);
|
||||
}
|
||||
|
||||
if (null !== ($activity = $paramFetcher->get('activity'))) {
|
||||
if (!empty($activity = $paramFetcher->get('activity'))) {
|
||||
$query->setActivity($activity);
|
||||
}
|
||||
|
||||
|
||||
@@ -1108,7 +1108,7 @@ class KimaiImporterCommand extends Command
|
||||
$io->error('Found invalid mapped project - activity combinations in these old timesheet recors: ' . implode(',', $errors['projectActivityMismatch']));
|
||||
}
|
||||
if ($failed > 0) {
|
||||
$io->error(sprintf('Failed importing %s timesheet records', count($failed)));
|
||||
$io->error(sprintf('Failed importing %s timesheet records', $failed));
|
||||
}
|
||||
|
||||
return $counter;
|
||||
|
||||
@@ -77,6 +77,12 @@ class SelectWithApiDataExtension extends AbstractTypeExtension
|
||||
'data-related-select' => $formPrefix . $apiData['select'],
|
||||
'data-api-url' => $this->router->generate($apiData['route'], $apiData['route_params']),
|
||||
]);
|
||||
|
||||
if (isset($apiData['empty_route_params'])) {
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], [
|
||||
'data-empty-url' => $this->router->generate($apiData['route'], $apiData['empty_route_params']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,6 +129,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
'required' => false,
|
||||
'activity_enabled' => true,
|
||||
'choices' => [],
|
||||
'disabled' => true,
|
||||
]);
|
||||
|
||||
$builder->addEventListener(
|
||||
|
||||
@@ -74,6 +74,7 @@ class ProjectType extends AbstractType
|
||||
'select' => 'activity',
|
||||
'route' => 'get_activities',
|
||||
'route_params' => ['project' => '-s-', 'orderBy' => 'name', 'visible' => $options['activity_visibility']],
|
||||
'empty_route_params' => ['globals' => 'true', 'orderBy' => 'name', 'visible' => $options['activity_visibility']],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user