allow empty date in export (#1338)

This commit is contained in:
Kevin Papst
2019-12-31 20:24:47 +01:00
committed by GitHub
parent baac4eb698
commit 022dbe32e5
5 changed files with 12 additions and 7 deletions

View File

@@ -3,7 +3,8 @@ root = true
; Unix-style newlines
[*]
end_of_line = LF
end_of_line = lf
charset = utf-8
[*.php]
indent_style = space

View File

@@ -143,8 +143,12 @@ class ExportController extends AbstractController
*/
protected function getEntries(ExportQuery $query): array
{
$query->getBegin()->setTime(0, 0, 0);
$query->getEnd()->setTime(23, 59, 59);
if (null !== $query->getBegin()) {
$query->getBegin()->setTime(0, 0, 0);
}
if (null !== $query->getEnd()) {
$query->getEnd()->setTime(23, 59, 59);
}
return $this->timesheetRepository->getTimesheetsForQuery($query, true);
}

View File

@@ -122,10 +122,10 @@ abstract class AbstractToolbarForm extends AbstractType
]);
}
protected function addDateRangeChoice(FormBuilderInterface $builder, $allowEmpty = true)
protected function addDateRangeChoice(FormBuilderInterface $builder, $allowEmpty = true, $required = false)
{
$builder->add('daterange', DateRangeType::class, [
'required' => false,
'required' => $required,
'allow_empty' => $allowEmpty,
]);
}

View File

@@ -83,7 +83,7 @@
<td class="{{ tables.data_table_column_class(tableName, columns, 'unit_price') }} text-nowrap">
{{ rate|money(currency) }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }} text-nowrap">
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }} text-nowrap" data-duration="{{ entry.duration }}">
{{ duration }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'total_rate') }} text-nowrap">

View File

@@ -83,7 +83,7 @@
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'unit_price') }} text-center">{{ rate|money(model.calculator.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'amount') }} text-center text-nowrap">{{ amount }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }} text-center text-nowrap">{{ duration }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }} text-center text-nowrap" data-duration="{{ entry.duration }}">{{ duration }}</td>
<td class="text-right text-nowrap">{{ entry.rate|money(model.calculator.currency) }}</td>
</tr>
{% endfor %}