added begin, end and export filter for API timesheets (#639)

This commit is contained in:
Kevin Papst
2019-03-14 03:34:54 +01:00
committed by GitHub
parent 2e6f3ed864
commit bde791fa55
28 changed files with 993 additions and 86 deletions

View File

@@ -268,11 +268,17 @@ class TimesheetEditForm extends AbstractType
if ($options['include_rate']) {
$builder
->add('fixedRate', MoneyType::class, [
'documentation' => [
'type' => 'float'
],
'label' => 'label.fixedRate',
'required' => false,
'currency' => $currency,
])
->add('hourlyRate', MoneyType::class, [
'documentation' => [
'type' => 'float'
],
'label' => 'label.hourlyRate',
'required' => false,
'currency' => $currency,

View File

@@ -125,10 +125,19 @@ class DateRangeType extends AbstractType
$pattern = $this->formatToPattern($formatDate, $separator);
$builder->addModelTransformer(new CallbackTransformer(
function (DateRange $range) use ($formatDate, $separator) {
function ($range) use ($formatDate, $separator) {
if (null === $range) {
return '';
}
if (!($range instanceof DateRange)) {
throw new \InvalidArgumentException('Invalid DateRange given');
}
if (null === $range->getBegin()) {
return '';
}
$display = $range->getBegin()->format($formatDate);
if (null !== $range->getEnd()) {
$display .= $separator . $range->getEnd()->format($formatDate);