VatRateFormTrait
VAT rate form — supply kind, country, percents, validity from/to, note.
Successor mode (add?successorOf=<id>, VatRatePresenter::$predecessorVatRate):
supply kind, country and validTo are fixed (disabled) and the save goes through the atomic
Api operation saveSuccessor() instead of a plain save — the predecessor is closed the day
before the new validFrom in the same transaction.
Table of Contents
Properties
- $countryOptions : array<string, string>|null
- $supplyKindOptions : array<int, string>|null
Methods
- createComponentEditForm() : Form
- addVatRateFields() : void
- buildCountryOptions() : array<string, string>
- Countries `code => "CODE — name"` in the admin language, in seed order (CZ, SK first).
- buildSupplyKindOptions() : array<int, string>
- Supply kinds `id => name` in the admin language (fallback key).
- saveVatRateForm() : bool
- saveVatRateSuccessor() : bool
- setVatRateFormDefaults() : void
Properties
$countryOptions
private
array<string, string>|null
$countryOptions
= null
$supplyKindOptions
private
array<int, string>|null
$supplyKindOptions
= null
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormaddVatRateFields()
private
addVatRateFields(Form $form) : void
Parameters
- $form : Form
buildCountryOptions()
Countries `code => "CODE — name"` in the admin language, in seed order (CZ, SK first).
private
buildCountryOptions() : array<string, string>
Return values
array<string, string>buildSupplyKindOptions()
Supply kinds `id => name` in the admin language (fallback key).
private
buildSupplyKindOptions() : array<int, string>
Return values
array<int, string>saveVatRateForm()
private
saveVatRateForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsaveVatRateSuccessor()
private
saveVatRateSuccessor(VatRate $predecessor, string $percents, string $validFrom, string|null $note) : bool
Parameters
- $predecessor : VatRate
- $percents : string
- $validFrom : string
- $note : string|null
Return values
boolsetVatRateFormDefaults()
private
setVatRateFormDefaults(Form $form) : void
Parameters
- $form : Form