CoolCMS API

CustomerPickerTrait

Customer picker for the invoice and the invoice template, pattern of {@see SellerPickerTrait}.

fieldMap fills the customer snapshot from the first contact of the picked customer. Two variants: customerPicker() fills the billing fields customer*, customerDeliveryPicker() the delivery fields customerDlv* (they share generic data keys). The snapshot is editable.

Table of Contents

Properties

$customerManager  : CustomerManager

Methods

customerDeliveryPicker()  : PickerConfig
customerPicker()  : PickerConfig
customerDeliveryFieldMap()  : array<string, string>
customerFieldMap()  : array<string, string>
Returns the mapping data key (from {@see customerPrefillData()}) to billing field. Shared by the picker (client `fieldMap`) and the server-side prefill (snippet redraw after a pick).
customerLabel()  : string
customerPrefillData()  : array<string, string>
loadCustomer()  : Customer|null
Loads the customer including contacts for the server-side prefill of the invoice snapshot.
resolveCustomerLabel()  : string|null
suggestCustomers()  : array<int, array{id: int, label: string, data: array}>

Properties

Methods

customerDeliveryPicker()

protected customerDeliveryPicker(string $formName, string $targetField[, string|null $submitButton = null ]) : PickerConfig
Parameters
$formName : string
$targetField : string
$submitButton : string|null = null
Return values
PickerConfig

customerPicker()

protected customerPicker(string $formName, string $targetField[, string|null $submitButton = null ]) : PickerConfig
Parameters
$formName : string
$targetField : string
$submitButton : string|null = null
Return values
PickerConfig

customerDeliveryFieldMap()

private customerDeliveryFieldMap() : array<string, string>
Return values
array<string, string> —

mapping to the delivery fields (customerDlv*)

customerFieldMap()

Returns the mapping data key (from {@see customerPrefillData()}) to billing field. Shared by the picker (client `fieldMap`) and the server-side prefill (snippet redraw after a pick).

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

loadCustomer()

Loads the customer including contacts for the server-side prefill of the invoice snapshot.

private loadCustomer(int $id) : Customer|null
Parameters
$id : int
Return values
Customer|null

resolveCustomerLabel()

private resolveCustomerLabel(int $id) : string|null
Parameters
$id : int
Return values
string|null

suggestCustomers()

private suggestCustomers(string $query) : array<int, array{id: int, label: string, data: array}>
Parameters
$query : string
Return values
array<int, array{id: int, label: string, data: array}>
On this page

Search results