CoolCMS API

InvoicerSelectDataTrait

Shared loading of code list data and flat options for the invoice/template selects.

Used by InvoiceTemplatePresenter, InvoicePresenter and SettingPresenter; they inject the same managers (currency/language/billingLine/productType/invoiceType/paymentMethod/paymentRegion/userType/pdfTemplate), the trait only reads them through $this->...Manager. Option builders use per-type instanceof narrowing.

All returned values are wrapped in NotTranslate: they are already translated DB data (rate, type, language name), not translation keys. NotTranslate is Stringable, so forms can use it both with the domain translator (plain addSelect) and through setTranslator(null) (see addNullableSelect in InvoiceFormTrait/InvoiceTemplateFormTrait).

Table of Contents

Properties

$billingLines  : array<int, object>
$currencies  : array<int, object>
$invoicerDefaultUnit  : string
$invoicerDuePeriod  : int
$invoiceTypes  : array<int, object>
$languages  : array<int, object>
$localizations  : array<int, object>
$paymentMethods  : array<int, object>
$paymentRegions  : array<int, object>
$pdfVariantOptionsData  : array<int, NotTranslate>
$productTypes  : array<int, object>
$userTypes  : array<int, object>

Methods

loadInvoicerSelectData()  : void
billingLineOptions()  : array<int, NotTranslate>
currencyOptions()  : array<int, NotTranslate>
defaultCurrencyShortcut()  : string
invoiceTypeOptions()  : array<int, NotTranslate>
languageOptions()  : array<int, NotTranslate>
loadPdfVariantOptions()  : array<int, NotTranslate>
localizationOptions()  : array<int, NotTranslate>
Returns localization options: the amount format on the invoice.
paymentMethodOptions()  : array<int, NotTranslate>
paymentRegionOptions()  : array<int, NotTranslate>
pdfVariantMatrixJson()  : string
Returns the JSON matrix of the PDF variant choice for the dependent select: `{invoiceTypeId: {"pt_pr_bvt_suv": variantId}}` (axes: productType, paymentRegion, buyerVatType, sellerUseVat).
pdfVariantOptions()  : array<int, NotTranslate>
pdfVariantTreatmentMatrixJson()  : string
Returns the JSON matrix of PDF variants by VAT treatment code: `{invoiceTypeId: {"<code>" | "*": variantId}}`, only rows with a selected variant.
productTypeOptions()  : array<int, NotTranslate>
resolveInvoicerSetting()  : string
userTypeOptions()  : array<int, NotTranslate>

Properties

Methods

billingLineOptions()

private billingLineOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

currencyOptions()

private currencyOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

invoiceTypeOptions()

private invoiceTypeOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

languageOptions()

private languageOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

loadPdfVariantOptions()

private loadPdfVariantOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

localizationOptions()

Returns localization options: the amount format on the invoice.

private localizationOptions() : array<int, NotTranslate>

No translations: name is an operational row label (for example the country name), not text for the customer. Wrapped in NotTranslate (see the trait header), otherwise the form domain translator would look the name up as a key.

Return values
array<int, NotTranslate>

paymentMethodOptions()

private paymentMethodOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

paymentRegionOptions()

private paymentRegionOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

pdfVariantMatrixJson()

Returns the JSON matrix of the PDF variant choice for the dependent select: `{invoiceTypeId: {"pt_pr_bvt_suv": variantId}}` (axes: productType, paymentRegion, buyerVatType, sellerUseVat).

private pdfVariantMatrixJson() : string

Source: the owned collection InvoiceType::getPdfTemplateVariantRels() across all invoice types (the same matrix the invoice type edits); only cells with a selected variant.

The matrix is dense: both seller-mode halves (1 = VAT payer, 0 = non-payer) go in and the last key part is the mode. The client fills it from the useVat checkbox of the form (VAT payer status of the invoice), so switching the mode picks the variant from the matching half.

Return values
string

pdfVariantOptions()

private pdfVariantOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

productTypeOptions()

private productTypeOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>

resolveInvoicerSetting()

private resolveInvoicerSetting(string $key, string $default) : string
Parameters
$key : string
$default : string
Return values
string

userTypeOptions()

private userTypeOptions() : array<int, NotTranslate>
Return values
array<int, NotTranslate>
On this page

Search results