Files
kimai2/src/Form/Toolbar/InvoiceToolbarForm.php
Kevin Papst 3a5d7a62de Release 2.0.11 (#3932)
- added "today" as selector in date-range dropdown
- added feature to prevent auto-select of dropdowns with only one entry
- added hint that no changes were detected in batch update
- added negative invoice sums are possible (e.g. for credit notes)
- fix project list is expanded after submission
- fix invalid date parsing causes 500
- fix: prevent auto-select of activities in export and invoice form (in case only one global activity exists)
- fix team assignments for customer and project were not saved (using API now)
- fix form fieldset with legend styling (e.g. team project assignment)
- fix required meta-field were forced to have a value in batch update
- fix tomselect meta-field was not disabled in batch update
- fix unset internal rate is shown as 0
- fix one minute rounding problem in duration-only mode  with "now" being default time
- fix column width and label for duration-only mode
- tech debt: cleanup invoice template (remove invoice layout)
- tech debt: reorder for simpler comparison with invoice form
- possible BC for devs: remove unused methods from form trait
- bump composer packages (includes new translations for auth screens)
2023-03-21 12:42:18 +01:00

63 lines
2.0 KiB
PHP

<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Toolbar;
use App\Form\Type\DatePickerType;
use App\Form\Type\InvoiceTemplateType;
use App\Repository\Query\InvoiceQuery;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Defines the form used for filtering timesheet entries for invoices.
*/
final class InvoiceToolbarForm extends AbstractType
{
use ToolbarFormTrait;
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->addSearchTermInputField($builder);
$this->addDateRange($builder, ['timezone' => $options['timezone']]);
$this->addCustomerMultiChoice($builder, ['start_date_param' => null, 'end_date_param' => null, 'ignore_date' => true], true);
$this->addProjectMultiChoice($builder, ['ignore_date' => true], true, true);
$this->addActivitySelect($builder, [], true, true, false);
$this->addTagInputField($builder);
if ($options['include_user']) {
$this->addUsersChoice($builder);
$this->addTeamsChoice($builder);
}
$this->addExportStateChoice($builder);
$builder->add('invoiceDate', DatePickerType::class, [
'required' => true,
]);
$this->addTemplateChoice($builder);
}
protected function addTemplateChoice(FormBuilderInterface $builder): void
{
$builder->add('template', InvoiceTemplateType::class, [
'required' => true,
'placeholder' => null,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => InvoiceQuery::class,
'csrf_protection' => false,
'include_user' => true,
'timezone' => date_default_timezone_get(),
]);
}
}