Skip to content

Commit

Permalink
allow empty date in export (kimai#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst authored Dec 31, 2019
1 parent baac4eb commit 022dbe3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ root = true

; Unix-style newlines
[*]
end_of_line = LF
end_of_line = lf
charset = utf-8

[*.php]
indent_style = space
Expand Down
8 changes: 6 additions & 2 deletions src/Controller/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,12 @@ protected function getDefaultQuery(): ExportQuery
*/
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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Toolbar/AbstractToolbarForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ protected function addUserRoleChoice(FormBuilderInterface $builder)
]);
}

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,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion templates/export/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion templates/invoice/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down

0 comments on commit 022dbe3

Please sign in to comment.