CoolCMS API

SellerFormTrait

Edit/add form of a seller: `name`, user type `userTypeId` and client-side multipliers (no naja round trips, `client-multiplier.js`) for contacts (contacts have no user type, unlike {@see CustomerFormTrait}) and bank accounts.

Fieldset "tax status": country of establishment countryCode plus a client multiplier of the status history taxStatuses (status, valid from, note; who/when is filled by the server). There is no "VAT payer" checkbox: on save use_vat is overwritten by the mirror "payer today" from the history. The seller always shows prices with VAT, there is no display switch.

Table of Contents

Properties

$sellerCountryOptions  : array<string, string>|null

Methods

buildSellerTaxStatusAudit()  : array<int, string>
Read-only audit of the history rows for the template: `taxStatusId => "dd.mm.yyyy HH:MM · user"`.
createComponentEditForm()  : Form
addSellerBankAccountMultiplier()  : void
addSellerContactMultiplier()  : void
addSellerTaxFields()  : void
Country of establishment + VAT status history. The history is a client multiplier; the audit columns (`createdAt`, `createdByUserId`) are never posted — they come from the loaded seller (existing rows) or the current admin (new rows), see {@see buildSellerTaxStatuses()}.
addSellerTaxStatusError()  : bool
addSellerUserTypeField()  : void
Seller user type (informative classification, FK to `cms_system_user_types`).
buildSellerBankAccounts()  : ArrayCollection<int, SellerBankAccount>
buildSellerContacts()  : ArrayCollection<int, SellerContact>
buildSellerCountryName()  : string
Country name without the code prefix of the option label.
buildSellerTaxStatuses()  : ArrayCollection<int, SellerTaxStatus>|null
VAT status history from the posted rows. Validation errors go to the row controls (form-level errors are invisible in admin); null = invalid, nothing is saved. Audit columns of existing rows are copied from the loaded seller — they are not in the form, so a posted row can never rewrite them.
buildSortedSellerTaxStatuses()  : array<int, SellerTaxStatus>
prepareSellerCountryOptions()  : array<string, string>
Active countries `code => "CODE — name"` in the admin language; CZ and SK first, then by name.
prepareSellerTaxStatusOptions()  : array<string, string>
prepareUserTypeOptions()  : array<int, string>
Returns user type options: `id => name` in the current language.
saveSellerForm()  : bool
sellerBankAccountDefaults()  : array<int, array<string, mixed>>
sellerContactDefaults()  : array<int, array<string, mixed>>
sellerTaxStatusDefaults()  : array<int, array<string, mixed>>
setSellerFormDefaults()  : void

Properties

$sellerCountryOptions

private array<string, string>|null $sellerCountryOptions = null

ISO code mapped to the label "code — name"

Methods

buildSellerTaxStatusAudit()

Read-only audit of the history rows for the template: `taxStatusId => "dd.mm.yyyy HH:MM · user"`.

public buildSellerTaxStatusAudit() : array<int, string>
Return values
array<int, string>

addSellerBankAccountMultiplier()

private addSellerBankAccountMultiplier(Form $form) : void
Parameters
$form : Form

addSellerContactMultiplier()

private addSellerContactMultiplier(Form $form) : void
Parameters
$form : Form

addSellerTaxFields()

Country of establishment + VAT status history. The history is a client multiplier; the audit columns (`createdAt`, `createdByUserId`) are never posted — they come from the loaded seller (existing rows) or the current admin (new rows), see {@see buildSellerTaxStatuses()}.

private addSellerTaxFields(Form $form) : void
Parameters
$form : Form

addSellerTaxStatusError()

private addSellerTaxStatusError(object|null $rowContainer, string $field, string $messageKey) : bool
Parameters
$rowContainer : object|null
$field : string
$messageKey : string
Return values
bool

addSellerUserTypeField()

Seller user type (informative classification, FK to `cms_system_user_types`).

private addSellerUserTypeField(Form $form) : void

IMPORTANT: the UserType x PaymentRegion matrix is detached; whether the seller is a VAT payer is decided solely by the history cms_mod_invoicer_seller_tax_statuses, not by this type, so leaving it empty changes nothing about VAT.

The prompt is translated by hand: the control has its translator off (options are real type names), so a key in setPrompt() would render raw.

Parameters
$form : Form

buildSellerContacts()

private buildSellerContacts(ArrayHash<string|int, mixed> $values, Seller $seller) : ArrayCollection<int, SellerContact>
Parameters
$values : ArrayHash<string|int, mixed>
$seller : Seller
Return values
ArrayCollection<int, SellerContact>

buildSellerCountryName()

Country name without the code prefix of the option label.

private buildSellerCountryName(string $countryCode) : string
Parameters
$countryCode : string
Return values
string

buildSellerTaxStatuses()

VAT status history from the posted rows. Validation errors go to the row controls (form-level errors are invisible in admin); null = invalid, nothing is saved. Audit columns of existing rows are copied from the loaded seller — they are not in the form, so a posted row can never rewrite them.

private buildSellerTaxStatuses(ArrayHash<string|int, mixed> $values, Seller $seller, Form|null $form) : ArrayCollection<int, SellerTaxStatus>|null
Parameters
$values : ArrayHash<string|int, mixed>
$seller : Seller
$form : Form|null
Return values
ArrayCollection<int, SellerTaxStatus>|null

prepareSellerCountryOptions()

Active countries `code => "CODE — name"` in the admin language; CZ and SK first, then by name.

private prepareSellerCountryOptions() : array<string, string>
Return values
array<string, string>

prepareSellerTaxStatusOptions()

private prepareSellerTaxStatusOptions() : array<string, string>
Return values
array<string, string>

prepareUserTypeOptions()

Returns user type options: `id => name` in the current language.

private prepareUserTypeOptions() : array<int, string>
Return values
array<int, string>

saveSellerForm()

private saveSellerForm(ArrayHash<string|int, mixed> $values[, Form|null $form = null ]) : bool
Parameters
$values : ArrayHash<string|int, mixed>
$form : Form|null = null
Return values
bool

sellerBankAccountDefaults()

private sellerBankAccountDefaults() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

sellerContactDefaults()

private sellerContactDefaults() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

sellerTaxStatusDefaults()

private sellerTaxStatusDefaults() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>> —

ordered by validFrom

On this page

Search results