added begin, end and export filter for API timesheets (#639)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user